Skip to content

Commit

Permalink
[TASK] Restructure phpstan configuration
Browse files Browse the repository at this point in the history
This patch simply pulls out the level 2 rules into
a separate configuration file which is a copy of the
original level 2 configuration file of phpstan with
some rules, services and parameters disabled.

Also, additional configuration files are put into the
Build folder and phpstan.neon has been added to the
.gitattributes file.

Releases: master
Resolves: #90789
Change-Id: Ia3b3c30cfa57227c0607904df38add31f36be0e2
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63802
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Alexander Schnitzler <git@alexanderschnitzler.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Alexander Schnitzler <git@alexanderschnitzler.de>
  • Loading branch information
alexanderschnitzler committed Mar 20, 2020
1 parent 2097634 commit 334210e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/.travis.yml export-ignore
/Build/ export-ignore
/dynamicReturnTypeMeta.json export-ignore
/phpstan.neon export-ignore
/rector.yml export-ignore
/typo3/sysext/*/Resources/Private/TypeScript/ export-ignore
/typo3/sysext/*/Tests/ export-ignore
Expand Down
48 changes: 48 additions & 0 deletions Build/phpstan.level2.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
parameters:
checkClassCaseSensitivity: true
# checkThisOnly: false
# checkPhpDocMissingReturn: true

rules:
- PHPStan\Rules\Cast\EchoRule
- PHPStan\Rules\Cast\InvalidCastRule
- PHPStan\Rules\Cast\InvalidPartOfEncapsedStringRule
- PHPStan\Rules\Cast\PrintRule
- PHPStan\Rules\Functions\IncompatibleDefaultParameterTypeRule
- PHPStan\Rules\Generics\ClassAncestorsRule
- PHPStan\Rules\Generics\ClassTemplateTypeRule
- PHPStan\Rules\Generics\FunctionTemplateTypeRule
- PHPStan\Rules\Generics\FunctionSignatureVarianceRule
- PHPStan\Rules\Generics\InterfaceAncestorsRule
- PHPStan\Rules\Generics\InterfaceTemplateTypeRule
- PHPStan\Rules\Generics\MethodTemplateTypeRule
- PHPStan\Rules\Generics\MethodSignatureVarianceRule
- PHPStan\Rules\Generics\TraitTemplateTypeRule
- PHPStan\Rules\Methods\IncompatibleDefaultParameterTypeRule
- PHPStan\Rules\Operators\InvalidBinaryOperationRule
# - PHPStan\Rules\Operators\InvalidUnaryOperationRule
- PHPStan\Rules\Operators\InvalidComparisonOperationRule
- PHPStan\Rules\PhpDoc\IncompatiblePhpDocTypeRule
- PHPStan\Rules\PhpDoc\IncompatiblePropertyPhpDocTypeRule
- PHPStan\Rules\PhpDoc\InvalidPhpDocTagValueRule
- PHPStan\Rules\PhpDoc\InvalidPHPStanDocTagRule
- PHPStan\Rules\PhpDoc\InvalidThrowsPhpDocValueRule
- PHPStan\Rules\PhpDoc\WrongVariableNameInVarTagRule

services:
-
class: PHPStan\Rules\Functions\CallCallablesRule
arguments:
reportMaybes: %reportMaybes%

tags:
- phpstan.rules.rule

-
class: PHPStan\Rules\PhpDoc\InvalidPhpDocVarTagTypeRule
arguments:
checkClassCaseSensitivity: %checkClassCaseSensitivity%
checkMissingVarTagTypehint: %checkMissingVarTagTypehint%

tags:
- phpstan.rules.rule
File renamed without changes.
12 changes: 2 additions & 10 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
includes:
- phpstan.typo3.neon
- Build/phpstan.typo3.neon
- Build/phpstan.level2.neon
# Include bleeding edge rules if necessary but do not commit
# - vendor/phpstan/phpstan/conf/bleedingEdge.neon

rules:
# those are level 2 rules, will be removed once level 2 is completely active
- PHPStan\Rules\PhpDoc\IncompatiblePhpDocTypeRule
- PHPStan\Rules\PhpDoc\IncompatiblePropertyPhpDocTypeRule
- PHPStan\Rules\PhpDoc\InvalidPhpDocTagValueRule
- PHPStan\Rules\PhpDoc\InvalidPHPStanDocTagRule
- PHPStan\Rules\PhpDoc\InvalidThrowsPhpDocValueRule
- PHPStan\Rules\PhpDoc\WrongVariableNameInVarTagRule

parameters:
level: 1

Expand Down

0 comments on commit 334210e

Please sign in to comment.