Skip to content

Commit b01e697

Browse files
authored
Feature/Add PHPStan. (#1)
1 parent 2b03ef2 commit b01e697

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ 'main' ]
6+
pull_request:
7+
types: [ 'opened', 'synchronize', 'reopened' ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
php-version: [ '8.1', '8.2', '8.3' ]
16+
17+
steps:
18+
- name: Checkout source code
19+
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set up PHP ${{ matrix.php-version }}
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php-version }}
27+
coverage: xdebug
28+
tools: composer:v2
29+
30+
- name: Cache dependencies
31+
uses: actions/cache@v2
32+
with:
33+
path: ~/.composer/cache
34+
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
35+
restore-keys: php-${{ matrix.php-version }}-composer-
36+
37+
- name: Validate composer.json and composer.lock
38+
run: composer validate
39+
40+
- name: Install dependencies
41+
if: steps.composer-cache.outputs.cache-hit != 'true'
42+
run: composer install --prefer-dist --no-progress --no-suggest
43+
44+
- name: Execute Static Code analysis
45+
run: composer analyse

composer.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,21 @@
1313
"require": {
1414
"php": "^8.1"
1515
},
16+
"require-dev": {
17+
"phpstan/phpstan": "^1.0",
18+
"phpstan/extension-installer": "^1.3"
19+
},
1620
"autoload": {
1721
"psr-4": {
1822
"ComplexHeart\\": "src/"
1923
}
24+
},
25+
"scripts": {
26+
"analyse": "vendor/bin/phpstan analyse src --no-progress --level=9"
27+
},
28+
"config": {
29+
"allow-plugins": {
30+
"phpstan/extension-installer": true
31+
}
2032
}
2133
}

src/Domain/Contracts/Model/ValueObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface ValueObject
1515
/**
1616
* Return the attribute values.
1717
*
18-
* @return array
18+
* @return array<string, mixed>
1919
*/
2020
public function values(): array;
2121

0 commit comments

Comments
 (0)