Skip to content

Commit

Permalink
fix: improve typing using phpstan and fix some errors identified by p…
Browse files Browse the repository at this point in the history
…hpstan
  • Loading branch information
SamMousa committed Jan 24, 2024
1 parent 2971f1f commit c0b8f5d
Show file tree
Hide file tree
Showing 9 changed files with 219 additions and 200 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction --no-suggest
- name: Run PHPStan
run: php vendor/bin/phpstan

- name: Run test suite
run: |
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
"yiisoft/yii2-app-advanced": "dev-master",
"codeception/verify": "^3.0",
"codemix/yii2-localeurls": "^1.7",
"codeception/module-asserts": "^3.0",
"codeception/module-filesystem": "^3.0"
"codeception/module-asserts": ">= 3.0",
"codeception/module-filesystem": "> 3.0",
"phpstan/phpstan": "^1.10"
},
"autoload":{
"classmap": ["src/"]
Expand Down
20 changes: 20 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#includes:
# - phpstan-baseline.neon
parameters:
reportUnmatchedIgnoredErrors: true
dynamicConstantNames:
- CONSOLE
- YII_DEBUG
level: 5
paths:
- src
checkMaybeUndefinedVariables: true
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
# All Yii setters accept `null` but their phpdoc is incorrect.
- message: '~^Parameter #1 \$value of method yii\\web\\Request::set(.*)\(\) expects (.*), null given.$~'
path: 'src/'
- message: '~^Variable \$_COOKIE in isset\(\) always exists and is not nullable.$~'
path: 'src/'
stubFiles:
- tests/Yii.stub
Loading

0 comments on commit c0b8f5d

Please sign in to comment.