Skip to content

Commit

Permalink
[FEATURE] Add rector/type-perfect PHPStan rules
Browse files Browse the repository at this point in the history
This package provides some opiniated PHPStan rules to make
our code more explicit and easier to read.

https://github.com/rectorphp/type-perfect

As our code already is in pretty good shape, the new rules do
not create any new warnings.

Also add some blank lines to the PHPStan configuration file to
make it more readable.

Fixes #1335
  • Loading branch information
oliverklee committed Feb 16, 2025
1 parent a6fcefd commit a2cb545
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"phpstan/phpstan-phpunit": "1.4.2",
"phpstan/phpstan-strict-rules": "1.6.1",
"phpunit/phpunit": "9.6.22",
"rector/type-perfect": "1.0.0",
"saschaegerer/phpstan-typo3": "1.10.2",
"seld/jsonlint": "1.11.0",
"spaze/phpstan-disallowed-calls": "4.3.1",
Expand Down
10 changes: 10 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ parameters:
class: 10
function: 5

type_perfect:
no_mixed_property: true
no_mixed_caller: true
null_over_false: true
narrow_param: true
narrow_return: true

disallowedFunctionCalls:
-
function:
Expand All @@ -40,12 +47,14 @@ parameters:
-
function: 'header()'
message: 'Use PSR-7 API instead'

disallowedStaticCalls:
-
method:
- 'TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump()'
- 'TYPO3\CMS\Core\Utility\DebugUtility::debug()'
message: 'Use logging instead or remove if it was for debugging purposes.'

disallowedSuperglobals:
-
superglobal:
Expand All @@ -54,6 +63,7 @@ parameters:
- '$_FILES'
- '$_SERVER'
message: 'Use PSR-7 API instead'

ignoreErrors:
-
message: '#Out of 1 possible constant types#'
Expand Down

0 comments on commit a2cb545

Please sign in to comment.