Skip to content

Commit

Permalink
Use rector-src#dev-upgrade-to-php-parser5-and-phpstan-2
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Nov 19, 2024
1 parent d9cef57 commit 68dd7bf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
10 changes: 3 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@
},
"require-dev": {
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^10.5",
"rector/rector-src": "dev-main",
"rector/type-perfect": "^0.1.8",
"rector/rector-src": "dev-upgrade-to-php-parser5-and-phpstan-2",
"symplify/easy-coding-standard": "^12.3",
"symplify/phpstan-extensions": "^11.4",
"symplify/phpstan-rules": "^13.0",
"symplify/rule-doc-generator": "^12.2",
"symplify/vendor-patches": "^11.3",
"tomasvotruba/class-leak": "^0.2.13",
Expand All @@ -33,7 +29,7 @@
"classmap": ["stubs"]
},
"scripts": {
"phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify",
"phpstan": "vendor/bin/phpstan analyse --ansi",
"check-cs": "vendor/bin/ecs check --ansi",
"fix-cs": "vendor/bin/ecs check --fix --ansi"
},
Expand Down
33 changes: 25 additions & 8 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
includes:
- vendor/symplify/phpstan-rules/config/symplify-rules.neon
- vendor/symplify/phpstan-rules/config/rector-rules.neon
# to be enabled later once rector upgraded to use phpstan v2
# includes:
# - vendor/symplify/phpstan-rules/config/symplify-rules.neon
# - vendor/symplify/phpstan-rules/config/rector-rules.neon

parameters:
level: 8
Expand All @@ -10,6 +11,8 @@ parameters:
# requires exact closure types
checkMissingCallableSignature: true

treatPhpDocTypesAsCertain: false

paths:
- src
- config
Expand All @@ -24,11 +27,12 @@ parameters:
- '*/Source/*'

# see https://github.com/rectorphp/type-perfect/
type_perfect:
no_mixed: true
null_over_false: true
narrow_param: true
narrow_return: true
# to be enabled later once rector upgraded to use phpstan v2
# type_perfect:
# no_mixed: true
# null_over_false: true
# narrow_param: true
# narrow_return: true

ignoreErrors:
# php enum value minus
Expand All @@ -55,3 +59,16 @@ parameters:
message: '#Parameter \#1 \$attributeClass of class Rector\\DowngradePhp80\\ValueObject\\DowngradeAttributeToAnnotation constructor expects class\-string, string given#'
path: "config/*"

# more advanced usage, but not always working
# see https://github.com/rectorphp/rector-src/actions/runs/11798721617/job/32865546672?pr=6422#step:5:110
- '#Doing instanceof PHPStan\\Type\\.+ is error\-prone and deprecated#'

# follow parent signature
-
identifier: return.unusedType

# phpstan instanceof
-
identifier: phpstanApi.instanceofAssumption

- '#Asking about instanceof PHPStan\\.* is not covered by backward compatibility promise#'

0 comments on commit 68dd7bf

Please sign in to comment.