Skip to content

Commit

Permalink
Added PHPStan (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveb-p authored Apr 13, 2024
1 parent f67ad5f commit acf322d
Show file tree
Hide file tree
Showing 8 changed files with 1,168 additions and 11 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ on:
jobs:
cs_fix:
name: Run code style check
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
strategy:
matrix:
php:
- '8.0'
- '8.1'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup PHP Action
uses: shivammathur/setup-php@v2
Expand All @@ -26,7 +26,7 @@ jobs:
extensions: 'pdo_sqlite, gd'
tools: cs2pr

- uses: "ramsey/composer-install@v1"
- uses: ramsey/composer-install@v3
with:
dependency-versions: "highest"

Expand All @@ -35,7 +35,7 @@ jobs:

tests:
name: Tests
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
timeout-minutes: 10

strategy:
Expand All @@ -44,10 +44,10 @@ jobs:
php:
- '7.4'
- '8.0'
- '8.1'
- '8.2'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup PHP Action
uses: shivammathur/setup-php@v2
Expand All @@ -57,7 +57,7 @@ jobs:
extensions: pdo_sqlite, gd
tools: cs2pr

- uses: "ramsey/composer-install@v1"
- uses: ramsey/composer-install@v3
with:
dependency-versions: "highest"

Expand All @@ -66,3 +66,6 @@ jobs:

- name: Run test suite
run: composer run-script --timeout=600 test

- name: Run PHPStan analysis
run: composer run-script phpstan
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,23 @@
"ibexa/code-style": "^1.0",
"phpunit/phpunit": "^8.2",
"matthiasnoback/symfony-dependency-injection-test": "4.3",
"symfony/phpunit-bridge": "^5.3"
"symfony/phpunit-bridge": "^5.3",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-symfony": "^1.3"
},
"scripts": {
"fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots",
"check-cs": "@fix-cs --dry-run",
"phpstan": "phpstan analyse",
"test": "phpunit -c phpunit.xml"
},
"extra": {
"branch-alias": {
"dev-main": "4.5.x-dev"
}
},
"config": {
"allow-plugins": false
}
}
11 changes: 11 additions & 0 deletions phpstan-baseline-7.4.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\User\\> given\\.$#"
count: 2
path: src/bundle/Controller/PasswordResetController.php

-
message: "#^Parameter \\#1 \\$input of function array_filter expects array, iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Role\\> given\\.$#"
count: 1
path: src/lib/Form/Type/Invitation/RoleChoiceType.php
11 changes: 11 additions & 0 deletions phpstan-baseline-8.0.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\User\\> given\\.$#"
count: 2
path: src/bundle/Controller/PasswordResetController.php

-
message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Role\\> given\\.$#"
count: 1
path: src/lib/Form/Type/Invitation/RoleChoiceType.php
Loading

0 comments on commit acf322d

Please sign in to comment.