Skip to content

Commit aa6fb84

Browse files
committed
Switch from PHPStan to Psalm - Close #17
1 parent 9dfcabc commit aa6fb84

11 files changed

+5858
-126
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Check Coding Standards"
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
coding-standards:
9+
name: "Check Coding Standards"
10+
11+
runs-on: ${{ matrix.operating-system }}
12+
13+
strategy:
14+
matrix:
15+
dependencies:
16+
- "locked"
17+
php-version:
18+
- "7.4"
19+
operating-system:
20+
- "ubuntu-latest"
21+
22+
steps:
23+
- name: "Checkout"
24+
uses: "actions/checkout@v2"
25+
26+
- name: "Install PHP"
27+
uses: "shivammathur/setup-php@v2"
28+
with:
29+
coverage: "pcov"
30+
php-version: "${{ matrix.php-version }}"
31+
ini-values: memory_limit=-1
32+
tools: composer:v2
33+
34+
- name: "Cache dependencies"
35+
uses: "actions/cache@v2"
36+
with:
37+
path: |
38+
~/.composer/cache
39+
vendor
40+
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
41+
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
42+
43+
- name: "Install lowest dependencies"
44+
if: ${{ matrix.dependencies == 'lowest' }}
45+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
46+
47+
- name: "Install highest dependencies"
48+
if: ${{ matrix.dependencies == 'highest' }}
49+
run: "composer update --no-interaction --no-progress --no-suggest"
50+
51+
- name: "Install locked dependencies"
52+
if: ${{ matrix.dependencies == 'locked' }}
53+
run: "composer install --no-interaction --no-progress --no-suggest"
54+
55+
- name: "Coding Standard"
56+
run: "vendor/bin/php-cs-fixer fix -v --diff --dry-run"

.github/workflows/integration.yml

Lines changed: 0 additions & 110 deletions
This file was deleted.

.github/workflows/phpunit.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: "PHPUnit tests"
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
phpunit:
9+
name: "PHPUnit tests"
10+
11+
runs-on: ${{ matrix.operating-system }}
12+
13+
strategy:
14+
matrix:
15+
dependencies:
16+
- "lowest"
17+
- "highest"
18+
- "locked"
19+
php-version:
20+
- "7.4"
21+
- "8.0"
22+
operating-system:
23+
- "ubuntu-latest"
24+
25+
steps:
26+
- name: "Checkout"
27+
uses: "actions/checkout@v2"
28+
29+
- name: "Install PHP"
30+
uses: "shivammathur/setup-php@v2"
31+
with:
32+
coverage: "pcov"
33+
php-version: "${{ matrix.php-version }}"
34+
ini-values: memory_limit=-1
35+
tools: composer:v2
36+
37+
- name: "Cache dependencies"
38+
uses: "actions/cache@v2"
39+
with:
40+
path: |
41+
~/.composer/cache
42+
vendor
43+
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
44+
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
45+
46+
- name: "Install lowest dependencies"
47+
if: ${{ matrix.dependencies == 'lowest' }}
48+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
49+
50+
- name: "Install highest dependencies"
51+
if: ${{ matrix.dependencies == 'highest' }}
52+
run: "composer update --no-interaction --no-progress --no-suggest"
53+
54+
- name: "Install locked dependencies"
55+
if: ${{ matrix.dependencies == 'locked' }}
56+
run: "composer install --no-interaction --no-progress --no-suggest"
57+
58+
- name: "Tests"
59+
run: "vendor/bin/phpunit"

.github/workflows/psalm.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Static Analysis by Psalm"
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
static-analysis-psalm:
9+
name: "Static Analysis by Psalm"
10+
11+
runs-on: ${{ matrix.operating-system }}
12+
13+
strategy:
14+
matrix:
15+
dependencies:
16+
- "locked"
17+
php-version:
18+
- "8.0"
19+
operating-system:
20+
- "ubuntu-latest"
21+
22+
steps:
23+
- name: "Checkout"
24+
uses: "actions/checkout@v2"
25+
26+
- name: "Install PHP"
27+
uses: "shivammathur/setup-php@v2"
28+
with:
29+
coverage: "pcov"
30+
php-version: "${{ matrix.php-version }}"
31+
ini-values: memory_limit=-1
32+
tools: composer:v2, cs2pr
33+
34+
- name: "Cache dependencies"
35+
uses: "actions/cache@v2"
36+
with:
37+
path: |
38+
~/.composer/cache
39+
vendor
40+
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
41+
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
42+
43+
- name: "Install lowest dependencies"
44+
if: ${{ matrix.dependencies == 'lowest' }}
45+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
46+
47+
- name: "Install highest dependencies"
48+
if: ${{ matrix.dependencies == 'highest' }}
49+
run: "composer update --no-interaction --no-progress --no-suggest"
50+
51+
- name: "Install locked dependencies"
52+
if: ${{ matrix.dependencies == 'locked' }}
53+
run: "composer install --no-interaction --no-progress --no-suggest"
54+
55+
- name: "psalm"
56+
run: "vendor/bin/psalm --output-format=github --shepherd --stats"

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ app.env
33
.phpunit.result.cache
44
build/*
55
vendor/
6-
composer.lock
76
.idea
87
.php_cs.cache

composer.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@
3838
"jangregor/phpstan-prophecy": "^0.8.0",
3939
"laminas/laminas-filter": "^2.9",
4040
"phpspec/prophecy-phpunit": "^2.0",
41-
"phpstan/phpstan": "^0.12.33",
42-
"phpstan/phpstan-strict-rules": "^0.12.4",
43-
"phpunit/phpunit": "^9.2.6",
44-
"prooph/php-cs-fixer-config": "^0.3",
41+
"phpunit/phpunit": "^9.5.0",
42+
"prooph/php-cs-fixer-config": "^v0.4.0",
43+
"psalm/plugin-phpunit": "^0.15.0",
4544
"roave/security-advisories": "dev-master",
46-
"squizlabs/php_codesniffer": "^3.4"
45+
"vimeo/psalm": "^4.4"
4746
},
4847
"suggest": {
4948
"laminas/laminas-filter": "If you want to use the FilterFactory"
@@ -54,12 +53,13 @@
5453
"check": [
5554
"@cs",
5655
"@test",
57-
"@analyse"
56+
"@static-analysis"
5857
],
59-
"cs": "php-cs-fixer fix src -v --diff --dry-run",
60-
"cs-fix": "php-cs-fixer fix src -v --diff",
61-
"test": "vendor/bin/phpunit",
62-
"analyse": "php vendor/bin/phpstan.phar analyse --no-interaction"
58+
"cs": "php-cs-fixer fix -v --diff --dry-run",
59+
"cs-fix": "php-cs-fixer fix -v --diff",
60+
"test": "phpunit --colors=always",
61+
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
62+
"static-analysis": "psalm --shepherd --stats"
6363
},
6464
"config": {
6565
"sort-packages": true,

0 commit comments

Comments
 (0)