mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-09-20 00:36:14 +02:00
tea/phpstan.neon
Daniel Siepmann 1462282da6
[TASK] Add PHPStan extension for disallowed calls (#1159)
A new composer package "spaze/phpstan-disallowed-calls" is added.
This one is a PHPStan extension which will check for forbidden calls.
Those calls need to be defined per project.
We use this to prevent debugging and other none good practices from
showing up in our code base.

We include the pre defined rules from the package.
Those can be argued and adjusted once we hit them.

Resolves: #1158
2024-02-06 12:55:29 +00:00

58 lines
1.4 KiB
Text

includes:
- phpstan-baseline.neon
- .Build/vendor/spaze/phpstan-disallowed-calls/disallowed-dangerous-calls.neon
- .Build/vendor/spaze/phpstan-disallowed-calls/disallowed-execution-calls.neon
- .Build/vendor/spaze/phpstan-disallowed-calls/disallowed-insecure-calls.neon
- .Build/vendor/spaze/phpstan-disallowed-calls/disallowed-loose-calls.neon
parameters:
parallel:
# Don't be overly greedy on machines with more CPU's to be a good neighbor especially on CI
maximumNumberOfProcesses: 5
level: 3
bootstrapFiles:
- .Build/vendor/autoload.php
paths:
- Classes
- Configuration
- Tests
scanDirectories:
- Classes
- Configuration
- Tests
type_coverage:
return_type: 100
param_type: 100
property_type: 95
cognitive_complexity:
class: 10
function: 5
disallowedFunctionCalls:
-
function:
- 'var_dump()'
- 'xdebug_break()'
- 'debug()'
message: 'Use logging instead or remove if it was for debugging purposes.'
-
function: 'header()'
message: 'Use PSR-7 API instead'
disallowedStaticCalls:
-
method: 'TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump()'
message: 'Use logging instead or remove if it was for debugging purposes.'
disallowedSuperglobals:
-
superglobal:
- '$_GET'
- '$_POST'
- '$_FILES'
- '$_SERVER'
message: 'Use PSR-7 API instead'