mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
61e1ceaf5c
Co-authored-by: rector-bot <tomas@getrector.org>
694 lines
38 KiB
YAML
694 lines
38 KiB
YAML
includes:
|
|
- utils/phpstan-extensions/config/phpstan-extensions.neon
|
|
# allows symplify error formatter
|
|
- vendor/symplify/phpstan-extensions/config/config.neon
|
|
|
|
# see https://github.com/symplify/coding-standard
|
|
# - vendor/symplify/phpstan-rules/config/configurable-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/static-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/services/services.neon
|
|
- vendor/symplify/phpstan-rules/packages/cognitive-complexity/config/cognitive-complexity-services.neon
|
|
|
|
- vendor/symplify/phpstan-rules/config/array-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/code-complexity-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/doctrine-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/naming-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/regex-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/services-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/size-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/forbidden-static-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/string-to-constant-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/symfony-rules.neon
|
|
- vendor/symplify/phpstan-rules/config/test-rules.neon
|
|
|
|
services:
|
|
-
|
|
class: Symplify\PHPStanRules\Rules\ForbiddenMethodCallOnTypeRule
|
|
tags: [phpstan.rules.rule]
|
|
arguments:
|
|
forbiddenMethodNamesByTypes:
|
|
PhpParser\Node:
|
|
- 'getDocComment'
|
|
- 'getComments'
|
|
- 'setDocComment'
|
|
|
|
-
|
|
class: Symplify\PHPStanRules\Rules\OnlyOneClassMethodRule
|
|
tags: [phpstan.rules.rule]
|
|
arguments:
|
|
onlyOneMethodsByType:
|
|
Rector\Testing\PHPUnit\AbstractRectorTestCase:
|
|
- getRectorClass
|
|
- provideConfigFileInfo
|
|
- getRectorsWithConfiguration
|
|
|
|
-
|
|
class: Symplify\PHPStanRules\Rules\ForbiddenNodeRule
|
|
tags: [phpstan.rules.rule]
|
|
arguments:
|
|
forbiddenNodes:
|
|
- PhpParser\Node\Expr\ErrorSuppress
|
|
- PhpParser\Node\Stmt\Switch_
|
|
- PhpParser\Node\Expr\Empty_
|
|
|
|
-
|
|
class: Symplify\PHPStanRules\Rules\RequireClassTypeInClassMethodByTypeRule
|
|
tags: [phpstan.rules.rule]
|
|
arguments:
|
|
requiredTypeInMethodByClass:
|
|
Rector\Core\Contract\Rector\PhpRectorInterface:
|
|
getNodeTypes: 'PhpParser\Node'
|
|
|
|
-
|
|
class: Symplify\PHPStanRules\CognitiveComplexity\Rules\FunctionLikeCognitiveComplexityRule
|
|
tags: [phpstan.rules.rule]
|
|
arguments:
|
|
maxMethodCognitiveComplexity: 9
|
|
|
|
-
|
|
class: Symplify\PHPStanRules\CognitiveComplexity\Rules\ClassLikeCognitiveComplexityRule
|
|
tags: [phpstan.rules.rule]
|
|
arguments:
|
|
maxClassCognitiveComplexity: 50
|
|
limitsByTypes:
|
|
Rector\Core\Rector\AbstractRector: 40
|
|
Symfony\Component\Console\Command\Command: 40
|
|
PHPStan\Rule\Rule: 30
|
|
|
|
# require constant in argument position
|
|
-
|
|
class: Symplify\PHPStanRules\Rules\RequireMethodCallArgumentConstantRule
|
|
tags: [phpstan.rules.rule]
|
|
arguments:
|
|
constantArgByMethodByType:
|
|
Symfony\Component\Console\Command\Command:
|
|
addArgument: [0]
|
|
addOption: [0]
|
|
Symfony\Component\Console\Input\InputInterface:
|
|
getOption: [0]
|
|
getArgument: [0]
|
|
PhpParser\Node:
|
|
getAttribute: [0]
|
|
hasAttribute: [0]
|
|
setAttribute: [0]
|
|
|
|
-
|
|
class: Symplify\PHPStanRules\Rules\SeeAnnotationToTestRule
|
|
tags: [phpstan.rules.rule]
|
|
arguments:
|
|
requiredSeeTypes:
|
|
- PHPStan\Rules\Rule
|
|
- Rector\Core\Rector\AbstractRector
|
|
|
|
# this rule prevents bug in phar like these: https://github.com/rectorphp/rector/pull/3692/files
|
|
-
|
|
class: Symplify\PHPStanRules\Rules\RequireStringArgumentInMethodCallRule
|
|
tags: [phpstan.rules.rule]
|
|
arguments:
|
|
stringArgByMethodByType:
|
|
Rector\Core\Rector\AbstractRector:
|
|
isObjectType: [1]
|
|
|
|
-
|
|
class: Symplify\PHPStanRules\Rules\ClassNameRespectsParentSuffixRule
|
|
tags: [phpstan.rules.rule]
|
|
arguments:
|
|
parentClasses:
|
|
- Rector
|
|
|
|
-
|
|
class: Symplify\PHPStanRules\Rules\PreferredClassRule
|
|
tags: [phpstan.rules.rule]
|
|
arguments:
|
|
oldToPreferredClasses:
|
|
# prevent PHPStorm autocomplete mess
|
|
'Symfony\Component\DependencyInjection\Variable': 'PhpParser\Node\Expr\Variable'
|
|
'phpDocumentor\Reflection\Types\Expression': 'PhpParser\Node\Stmt\Expression'
|
|
'phpDocumentor\Reflection\DocBlock\Tags\Param': 'PhpParser\Node\Param'
|
|
'phpDocumentor\Reflection\DocBlock\Tags\Return_': 'PhpParser\Node\Stmt\Return_'
|
|
'Closure': 'PhpParser\Node\Expr\Closure'
|
|
'PHPUnit\TextUI\Configuration\Variable': 'PhpParser\Node\Expr\Variable'
|
|
'SebastianBergmann\Type\MixedType': 'PHPStan\Type\MixedType'
|
|
'Hoa\Protocol\Node\Node': 'PhpParser\Node'
|
|
'Nette\Utils\FileSystem': 'Symplify\SmartFileSystem\SmartFileSystem'
|
|
'Symfony\Component\Filesystem\Filesystem': 'Symplify\SmartFileSystem\SmartFileSystem'
|
|
# builder typo nodes
|
|
PhpParser\Builder\Use_: Rector\Core\PhpParser\Builder\UseBuilder
|
|
PhpParser\Builder\Class_: Rector\Core\PhpParser\Builder\ClassBuilder
|
|
PhpParser\Builder\Method: Rector\Core\PhpParser\Builder\MethodBuilder
|
|
PhpParser\Builder\Namespace_: Rector\Core\PhpParser\Builder\NamespaceBuilder
|
|
PhpParser\Builder\Param: Rector\Core\PhpParser\Builder\ParamBuilder
|
|
PhpParser\Builder\Property: Rector\Core\PhpParser\Builder\PropertyBuilder
|
|
PhpParser\Builder\TraitUse: Rector\Core\PhpParser\Builder\TraitUseBuilder
|
|
|
|
parameters:
|
|
level: max
|
|
|
|
parallel:
|
|
maximumNumberOfProcesses: 6
|
|
|
|
paths:
|
|
- bin
|
|
- src
|
|
- rules
|
|
- packages
|
|
- tests
|
|
- utils
|
|
# this cannot be put it, because it wipes PHPStan cache on each run :( - must run in separate
|
|
#- config
|
|
|
|
# to allow installing with various phsptan versions without reporting old errors here
|
|
bootstrapFiles:
|
|
- vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php
|
|
|
|
scanDirectories:
|
|
- stubs
|
|
|
|
reportUnmatchedIgnoredErrors: false
|
|
|
|
checkGenericClassInNonGenericObjectType: false
|
|
|
|
excludes_analyse:
|
|
- */config.php
|
|
- packages/*/config/*
|
|
- tests/debug_functions.php
|
|
|
|
# broken in PHPStan https://github.com/rectorphp/rector/runs/1305002460#step:5:56
|
|
- packages/better-php-doc-parser/src/ValueObject/PhpDocNode/AbstractTagValueNode.php
|
|
- packages/testing/src/PHPUnit/*.php
|
|
- packages/node-type-resolver/tests/NodeVisitor/FunctionMethodAndClassNodeVisitor/FunctionMethodAndClassNodeVisitorTest.php
|
|
|
|
# phsptan bug
|
|
- utils/phpstan-extensions/src/Rule/KeepRectorNamespaceForRectorRule.php
|
|
- packages/rector-generator/templates/*
|
|
# this invalidates whole cache everytime
|
|
- 'packages/symfony-php-config/*'
|
|
- 'packages/simple-php-doc-parser'
|
|
|
|
# generated files
|
|
- 'packages/doctrine-annotation-generated/src/ConstantPreservingDocParser.php'
|
|
- 'packages/doctrine-annotation-generated/src/ConstantPreservingAnnotationReader.php'
|
|
|
|
- "*/Expected/*"
|
|
# complex printer
|
|
- '*tests/Rector/MethodCall/RenameMethodRector/**/SomeClass.php'
|
|
# tests files
|
|
- '*tests/*/Fixture/*'
|
|
- '*tests/*/Source/*'
|
|
- '*tests/Source/*'
|
|
# part of composer
|
|
- '*/tests/Rector/Psr4/MultipleClassFileToPsr4ClassesRector/Expected/Just*ExceptionWithoutNamespace.php'
|
|
|
|
# tests
|
|
- tests/DependencyInjection/config
|
|
|
|
ignoreErrors:
|
|
- '#Parameter \#1 \$children of class PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocNode constructor expects array<PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocChildNode\>, array<int, PHPStan\\PhpDocParser\\Ast\\Node\> given#'
|
|
|
|
# known types
|
|
- '#Access to an undefined property PhpParser\\Node\\Expr\:\:\$args#'
|
|
|
|
- '#Parameter \#2 \$name of method Rector\\Core\\Rector\\AbstractRector\:\:isName\(\) expects string, string\|null given#'
|
|
|
|
# sense-less errors
|
|
|
|
# PHP 7.4 1_000 support
|
|
- '#Property PhpParser\\Node\\Scalar\\DNumber\:\:\$value \(float\) does not accept string#'
|
|
|
|
-
|
|
message: '#Class Rector\\Generic\\Tests\\Rector\\StaticCall\\SwapClassMethodArgumentsRector\\Fixture\\SomeClass not found#'
|
|
path: rules/generic/tests/Rector/StaticCall/SwapClassMethodArgumentsRector/SwapClassMethodArgumentsRectorTest.php
|
|
|
|
# mixed
|
|
- '#Offset int\|string\|null does not exist on array<PhpParser\\Node\\Stmt>\|null#'
|
|
- '#class-string<T of object>\|T of object#'
|
|
|
|
- '#Method Rector\\Php80\\Rector\\NotIdentical\\StrContainsRector\:\:matchNotIdenticalToFalse\(\) should return PhpParser\\Node\\Expr\\FuncCall\|null but returns PhpParser\\Node\\Expr#'
|
|
|
|
# broken
|
|
- '#Parameter \#2 \$name of method Rector\\NodeNameResolver\\NodeNameResolver\:\:isName\(\) expects string, string\|null given#'
|
|
|
|
- '#Parameter \#1 \$funcCall of method Rector\\Php80\\MatchAndRefactor\\StrStartsWithMatchAndRefactor\\AbstractMatchAndRefactor\:\:createStrStartsWithValueObjectFromFuncCall\(\) expects PhpParser\\Node\\Expr\\FuncCall, PhpParser\\Node\\Expr given#'
|
|
|
|
# mostly strings in tests
|
|
- '#Method Rector\\Naming\\Naming\\PropertyNaming\:\:resolveShortClassName\(\) should return string but returns string\|null#'
|
|
|
|
-
|
|
message: "#in iterable type Iterator#"
|
|
paths:
|
|
- *Test.php
|
|
- *TestCase.php
|
|
|
|
-
|
|
message: "#^Cognitive complexity for \"Rector\\\\BetterPhpDocParser\\\\Printer\\\\WhitespaceDetector\\:\\:detectOldWhitespaces\\(\\)\" is 18, keep it under 9$#"
|
|
count: 1
|
|
path: packages/better-php-doc-parser/src/Printer/WhitespaceDetector.php
|
|
|
|
-
|
|
message: "#^Parameter \\#1 \\$input of function array_splice expects array, array\\<PhpParser\\\\Node\\\\Stmt\\>\\|null given\\.$#"
|
|
count: 1
|
|
path: rules/coding-style/src/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php
|
|
|
|
-
|
|
message: "#^Cognitive complexity for \"Rector\\\\PhpSpecToPHPUnit\\\\Rector\\\\MethodCall\\\\PhpSpecPromisesToPHPUnitAssertRector\\:\\:refactor\\(\\)\" is 13, keep it under 9$#"
|
|
count: 1
|
|
path: rules/php-spec-to-phpunit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php
|
|
|
|
-
|
|
message: "#Use explicit property fetch names over dynamic#"
|
|
path: packages/doctrine-annotation-generated/src/PhpDocNode/ConstantReferenceIdentifierRestorer.php
|
|
|
|
- "#^Cognitive complexity for \"Rector\\\\Php70\\\\EregToPcreTransformer\\:\\:(.*?)\" is (.*?), keep it under 9$#"
|
|
|
|
- '#In method "Rector\\Utils\\ProjectValidator\\Process\\ParallelTaskRunner\:\:(.*?)", caught "Throwable" must be rethrown\. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception#'
|
|
# weird
|
|
|
|
- '#Cannot cast PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Identifier to string#'
|
|
|
|
- '#Parameter \#1 \$node of method Rector\\PostRector\\Collector\\NodesToAddCollector\:\:wrapToExpression\(\) expects PhpParser\\Node\\Expr\|PhpParser\\Node\\Stmt, PhpParser\\Node given#'
|
|
- '#Access to an undefined property PhpParser\\Node\\Expr\:\:\$class#'
|
|
- '#Method Rector\\BetterPhpDocParser\\Tests\\PhpDocParser\\AbstractPhpDocInfoTest\:\:parseFileAndGetFirstNodeOfType\(\) should return PhpParser\\Node but returns PhpParser\\Node\|null#'
|
|
- '#Property PhpParser\\Node\\Stmt\\Namespace_\:\:\$stmts \(array<PhpParser\\Node\\Stmt\>\) does not accept array<PhpParser\\Node\>#'
|
|
|
|
- '#Cognitive complexity for "Rector\\TypeDeclaration\\PHPStan\\Type\\ObjectTypeSpecifier\:\:matchShortenedObjectType\(\)" is 10, keep it under 9#'
|
|
- '#Parameter \#1 \$type of method PhpParser\\Builder\\FunctionLike\:\:setReturnType\(\) expects PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|string, PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType given#'
|
|
- '#Cognitive complexity for "Rector\\Core\\PhpParser\\Node\\Value\\ValueResolver\:\:getValue\(\)" is \d+, keep it under 9#'
|
|
- '#Cognitive complexity for "Rector\\NetteKdyby\\ContributeEventClassResolver\:\:resolveGetterMethodByEventClassAndParam\(\)" is \d+, keep it under 9#'
|
|
- '#Parameter \#1 \$type of class PhpParser\\Node\\NullableType constructor expects PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|string, PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType given#'
|
|
- '#Parameter \#1 \$node of method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findFirstAncestorInstanceOf\(\) expects PhpParser\\Node, PhpParser\\Node\\Expr\\Variable\|null given#'
|
|
- '#Parameter \#1 \$objectType of method Rector\\Naming\\Naming\\PropertyNaming\:\:fqnToVariableName\(\) expects PHPStan\\Type\\ObjectType\|string, PHPStan\\Type\\Type given#'
|
|
# known value
|
|
- '#Property PhpParser\\Node\\Stmt\\Foreach_\:\:\$valueVar \(PhpParser\\Node\\Expr\) does not accept PhpParser\\Node\\Expr\|null#'
|
|
- '#Access to an undefined property PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode\:\:\$type#'
|
|
|
|
# only local use
|
|
-
|
|
message: '#Class "Rector\\RectorGenerator\\Rector\\Closure\\AddNewServiceToSymfonyPhpConfigRector" is missing @see annotation with test case class reference#'
|
|
path: 'packages/rector-generator/src/Rector/Closure/AddNewServiceToSymfonyPhpConfigRector.php'
|
|
|
|
- '#Class Rector\\Renaming\\Tests\\Rector\\MethodCall\\RenameMethodRector\\Fixture\\SkipSelfMethodRename not found#'
|
|
|
|
# fixed in symplfiy dev
|
|
-
|
|
message: '#Separate function "Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ref\(\)" in method call to standalone row to improve readability#'
|
|
path: 'packages/rector-generator/config/config.php'
|
|
|
|
- '#Parameter \#1 \$shortControlString of method Rector\\NetteCodeQuality\\Rector\\Assign\\MakeGetComponentAssignAnnotatedRector\:\:resolveTypeFromShortControlNameAndVariable\(\) expects PhpParser\\Node\\Scalar\\String_, PhpParser\\Node\\Expr\|null given#'
|
|
- '#Parameter \#1 \$variable of class Rector\\Php70\\ValueObject\\VariableAssignPair constructor expects PhpParser\\Node\\Expr\\ArrayDimFetch\|PhpParser\\Node\\Expr\\PropertyFetch\|PhpParser\\Node\\Expr\\StaticPropertyFetch\|PhpParser\\Node\\Expr\\Variable, PhpParser\\Node\\Expr given#'
|
|
|
|
# is nested expr
|
|
- '#Access to an undefined property PhpParser\\Node\\Expr\:\:\$expr#'
|
|
- '#Cognitive complexity for "Rector\\DeadCode\\NodeManipulator\\LivingCodeManipulator\:\:keepLivingCodeFromExpr\(\)" is \d+, keep it under 9#'
|
|
- '#Parameter \#1 \$files of method Symplify\\SmartFileSystem\\Finder\\FinderSanitizer\:\:sanitize\(\) expects \(iterable<SplFileInfo\|string\>&Nette\\Utils\\Finder\)\|Symfony\\Component\\Finder\\Finder, array<string\> given#'
|
|
# wtf
|
|
-
|
|
message: '#Else branch is unreachable because ternary operator condition is always true#'
|
|
path: 'rules/psr4/src/Composer/PSR4NamespaceMatcher.php'
|
|
|
|
-
|
|
message: '#Class "Rector\\RectorGenerator\\ValueObject\\RectorRecipe" has invalid namespace category "ValueObject"\. Pick one of\: ""#'
|
|
path: packages/rector-generator/src/ValueObject/RectorRecipe.php
|
|
|
|
- '#Parameter \#2 \$currentNode of method Rector\\CodingStyle\\Rector\\Assign\\ManualJsonStringToJsonEncodeArrayRector\:\:matchNextExprAssignConcatToSameVariable\(\) expects PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Expr\\AssignOp\\Concat, PhpParser\\Node given#'
|
|
|
|
-
|
|
message: '#Array (with keys|destruct) is not allowed\. Use value object to pass data instead#'
|
|
paths:
|
|
# working with cvs file
|
|
# 3rd party package
|
|
- rules/php70/src/EregToPcreTransformer.php
|
|
# template variables
|
|
- packages/rector-generator/src/TemplateVariablesFactory.php
|
|
# output format to json
|
|
- rules/doctrine/src/Collector/UuidMigrationDataCollector.php
|
|
|
|
-
|
|
message: '#Use explicit return value over magic &reference#'
|
|
paths:
|
|
# 3rd party code
|
|
- rules/php70/src/EregToPcreTransformer.php
|
|
|
|
# symfony/console
|
|
-
|
|
message: '#Use explicit return value over magic &reference#'
|
|
path: 'rules/dead-code/src/Rector/BinaryOp/RemoveDuplicatedInstanceOfRector.php'
|
|
|
|
-
|
|
message: '#Use value object over return of values#'
|
|
path: 'rules/phpunit/src/Composer/ComposerAutoloadedDirectoryProvider.php'
|
|
|
|
-
|
|
message: '#Use value object over return of values#'
|
|
path: 'rules/php70/src/EregToPcreTransformer.php'
|
|
|
|
# 3rd party
|
|
- '#Class cognitive complexity for "(NodeTypeResolver|EregToPcreTransformer|DumpNodesCommand)" is \d+, keep it under 50#'
|
|
|
|
# -
|
|
# message: '#Instead of "Symfony\\Component\\Finder\\SplFileInfo" class/interface use "Symplify\\SmartFileSystem\\SmartFileInfo"#'
|
|
# paths:
|
|
# - src/FileSystem/FilesFinder.php
|
|
|
|
-
|
|
message: '#Instead of container injection, use specific service#'
|
|
paths:
|
|
- src/Configuration/RectorClassesProvider.php
|
|
|
|
# nodes/stmts mixup
|
|
- '#Parameter \#2 \$stmts of class PhpParser\\Node\\Stmt\\Namespace_ constructor expects array<PhpParser\\Node\\Stmt\>\|null, array<PhpParser\\Node\> given#'
|
|
|
|
-
|
|
message: '#Nested foreach with empty statement is not allowed#'
|
|
path: packages/better-php-doc-parser/tests/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php
|
|
|
|
-
|
|
message: '#Function "dump\(\)" cannot be used/left in the code#'
|
|
path: tests/debug_functions.php
|
|
|
|
- '#Method Rector\\Utils\\PHPStanAttributeTypeSyncer\\NodeFactory\\AttributeAwareClassFactoryFactory\:\:createFromPhpDocParserNodeClass\(\) should return PhpParser\\Node\\Stmt\\Namespace_ but returns PhpParser\\Node#'
|
|
- '#Method Rector\\Utils\\PHPStanAttributeTypeSyncer\\NodeFactory\\AttributeAwareClassFactory\:\:createFromPhpDocParserNodeClass\(\) should return PhpParser\\Node\\Stmt\\Namespace_ but returns PhpParser\\Node#'
|
|
- '#Method Rector\\NetteKdyby\\NodeFactory\\EventValueObjectClassFactory\:\:wrapClassToNamespace\(\) should return PhpParser\\Node\\Stmt\\Namespace_ but returns PhpParser\\Node#'
|
|
|
|
# 3rd party code
|
|
-
|
|
message: '#Do not use static property#'
|
|
path: packages/doctrine-annotation-generated/src/DataCollector/ResolvedConstantStaticCollector.php
|
|
|
|
- '#Parameter \#1 \$node of method Rector\\DeadCode\\Rector\\Plus\\RemoveDeadZeroAndOneOperationRector\:\:refactor\(\) expects PhpParser\\Node\\Expr\\AssignOp\\Div\|PhpParser\\Node\\Expr\\AssignOp\\Minus\|PhpParser\\Node\\Expr\\AssignOp\\Mul\|PhpParser\\Node\\Expr\\AssignOp\\Plus\|PhpParser\\Node\\Expr\\BinaryOp\\Div\|PhpParser\\Node\\Expr\\BinaryOp\\Minus\|PhpParser\\Node\\Expr\\BinaryOp\\Mul\|PhpParser\\Node\\Expr\\BinaryOp\\Plus, PhpParser\\Node\\Expr\\AssignOp\|PhpParser\\Node\\Expr\\BinaryOp given#'
|
|
|
|
-
|
|
message: '#Do not use trait#'
|
|
paths:
|
|
- packages/better-php-doc-parser/src/Attributes/Attribute/AttributeTrait.php # 7
|
|
- packages/better-php-doc-parser/src/PartPhpDocTagPrinter/Behavior/ArrayPartPhpDocTagPrinterTrait.php # 14
|
|
- packages/better-php-doc-parser/src/PhpDocNode/PrintTagValueNodeTrait.php # 13
|
|
- packages/changes-reporting/src/Rector/AbstractRector/NotifyingRemovingNodeTrait.php # 17
|
|
- packages/post-rector/src/Rector/AbstractRector/NodeCommandersTrait.php # 31
|
|
- rules/doctrine/src/AbstractRector/DoctrineTrait.php # 13
|
|
- src/Rector/AbstractRector/*
|
|
|
|
-
|
|
message: '#Do not use scalar or array as constructor parameter\. Use "Symplify\\PackageBuilder\\Parameter\\ParameterProvider" service instead#'
|
|
paths:
|
|
# value objects
|
|
- packages/attribute-aware-php-doc/src/Ast/*
|
|
- packages/better-php-doc-parser/src/PhpDocInfo/PhpDocInfo.php # 108
|
|
- rules/coding-style/src/Rector/ClassMethod/YieldClassMethodToArrayClassMethodRector.php # 47
|
|
- rules/php70/src/EregToPcreTransformer.php # 66
|
|
- rules/phpstan/src/Type/AliasedObjectType.php # 24
|
|
- rules/phpstan/src/Type/ShortenedObjectType.php # 18
|
|
- rules/restoration/src/Rector/Class_/RemoveUselessJustForSakeInterfaceRector.php # 42
|
|
- rules/type-declaration/src/Rector/FunctionLike/ReturnTypeDeclarationRector.php # 82
|
|
- src/PhpParser/Builder/UseBuilder.php # 17
|
|
|
|
# nodes/stmts
|
|
- '#Parameter \#1 \$nodes of method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findFirst\(\) expects array<PhpParser\\Node\>\|PhpParser\\Node, array<PhpParser\\Node\\Stmt\>\|null given#'
|
|
# finder type
|
|
- '#Method Rector\\SOLID\\Rector\\Assign\\MoveVariableDeclarationNearReferenceRector\:\:findFirstVariableUsageInScope\(\) should return PhpParser\\Node\\Expr\\Variable\|null but returns PhpParser\\Node\|null#'
|
|
|
|
- '#Class with base "Application" name is already used in "(.*?)\\Symfony\\Component\\Console\\Application", "Symfony\\Component\\Console\\Application", "Rector\\Core\\Console\\Application"\. Use unique name to make classes easy to recognize#'
|
|
- '#Class with base "FileNode" name is already used in "PHPStan\\Node\\FileNode", "Rector\\Core\\PhpParser\\Node\\CustomNode\\FileNode"\. Use unique name to make classes easy to recognize#'
|
|
|
|
# trait in trait call
|
|
- '#Call to an undefined method Rector\\PostRector\\Rector\\AbstractPostRector\:\:isObjectType\(\)#'
|
|
- '#Parameter \#1 \$expr of class PhpParser\\Node\\Stmt\\Expression constructor expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|PhpParser\\Node\\Stmt given#'
|
|
|
|
-
|
|
message: '#Class cognitive complexity is \d+, keep it under \d+#'
|
|
paths:
|
|
- rules/php70/src/EregToPcreTransformer.php
|
|
- packages/node-collector/src/NodeCollector/NodeRepository.php
|
|
- packages/node-type-resolver/src/NodeTypeResolver.php
|
|
- rules/solid/src/Rector/Variable/MoveVariableDeclarationNearReferenceRector.php
|
|
- src/Rector/AbstractRector.php
|
|
- rules/php80/src/Rector/If_/NullsafeOperatorRector.php
|
|
- rules/code-quality/src/Rector/For_/ForToForeachRector.php
|
|
- rules/coding-style/src/Rector/Use_/RemoveUnusedAliasRector.php
|
|
|
|
# symplify 9
|
|
- '#Use decoupled factory service to create "(.*?)" object#'
|
|
- '#Use another value object over array with string\-keys and objects, array<string, ValueObject\>#'
|
|
- '#SymfonyStyle usage is unneeded for only newline, write, and/or writeln, use PHP_EOL and concatenation instead#'
|
|
- '#Trait method "(.*?)" should not contain any logic, but only delegate to other class call#'
|
|
- '#Do not use factory/method call in constructor\. Put factory in config and get service with dependency injection#'
|
|
- '#Constant string value need to only have small letters, _, \-, \. and numbers#'
|
|
|
|
-
|
|
message: '#Use explicit names over dynamic ones#'
|
|
paths:
|
|
- packages/doctrine-annotation-generated/src/PhpDocNode/ConstantReferenceIdentifierRestorer.php # 61
|
|
|
|
- '#Class with base "Regex" name is already used in "MongoDB\\BSON\\Regex", "Symplify\\PHPStanRules\\ValueObject\\Regex"\. Use unique name to make classes easy to recognize#'
|
|
|
|
- '#Method Rector\\BetterPhpDocParser\\Tests\\PhpDocInfo\\PhpDocInfo\\PhpDocInfoTest\:\:createPhpDocInfoFromFile\(\) should return Rector\\BetterPhpDocParser\\PhpDocInfo\\PhpDocInfo but returns Rector\\BetterPhpDocParser\\PhpDocInfo\\PhpDocInfo\|null#'
|
|
|
|
# Symfony spl file info false positive
|
|
- '#Parameter \#1 \$callback of function set_error_handler expects \(callable\(int, string, string, int, array\)\: bool\)\|null, \(array&callable\(\)\: mixed\)\|\(callable\(\)\: mixed&object\)\|\(callable\(\)\: mixed&string\) given#'
|
|
|
|
-
|
|
message: '#"(getComments|getDocComment|setDocComment)\(\)" call on "PhpParser\\Node" type is not allowed#'
|
|
paths:
|
|
# merging comments
|
|
- packages/better-php-doc-parser/tests/PhpDocInfo/PhpDocInfo/PhpDocInfoTest.php
|
|
- src/Rector/AbstractRector.php
|
|
- src/PhpParser/NodeTransformer.php
|
|
# playing around with doc block format
|
|
- rules/phpstan/src/Rector/Assign/PHPStormVarAnnotationRector.php
|
|
- rules/phpstan/src/Rector/Node/RemoveNonExistingVarAnnotationRector.php
|
|
- rules/code-quality/src/Rector/Return_/SimplifyUselessVariableRector.php
|
|
- rules/dead-code/src/Rector/Expression/RemoveDeadStmtRector.php
|
|
- rules/php-spec-to-phpunit/src/Rector/MethodCall/PhpSpecMocksToPHPUnitMocksRector.php
|
|
- packages/better-php-doc-parser/src/Comment/CommentsMerger.php
|
|
- packages/node-type-resolver/src/PhpDoc/NodeAnalyzer/DocBlockManipulator.php
|
|
- rules/coding-style/src/Node/DocAliasResolver.php
|
|
- packages/better-php-doc-parser/src/PhpDocInfo/PhpDocInfoFactory.php
|
|
- packages/better-php-doc-parser/tests/PhpDocParser/AbstractPhpDocInfoTest.php
|
|
- packages/better-php-doc-parser/tests/PhpDocInfo/PhpDocInfoPrinter/AbstractPhpDocInfoPrinterTest.php
|
|
|
|
# bug in simplify - @todo fix
|
|
- '#Parameter 2 should use "Rector\\Core\\PhpParser\\Node\\CustomNode\\FileWithoutNamespace" type as the only type passed to this method#'
|
|
|
|
# false positives checked in another method
|
|
-
|
|
message: '#If condition is always false#'
|
|
paths:
|
|
- rules/renaming/src/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector.php
|
|
- rules/code-quality/src/Rector/Concat/JoinStringConcatRector.php
|
|
- rules/php80/src/Rector/Switch_/ChangeSwitchToMatchRector.php
|
|
- packages/node-nesting-scope/src/NodeFinder/ScopeAwareNodeFinder.php
|
|
|
|
-
|
|
message: '#new <class\> is limited to 3 "new <class\>\(new <class\>\)\)" nesting to each other\. You have \d+ nesting#'
|
|
paths:
|
|
# allow configuration object nesting
|
|
- config/set
|
|
|
|
# internal generating Rector
|
|
-
|
|
message: '#Class "Rector\\Utils\\DoctrineAnnotationParserSyncer\\Rector\\(.*?)" is missing @see annotation with test case class reference#'
|
|
paths:
|
|
- utils/doctrine-annotation-parser-syncer/src/Rector/*
|
|
|
|
-
|
|
message: '#Unreachable statement \- code above always terminates#'
|
|
paths:
|
|
- src/Rector/AbstractRector/NodeTypeResolverTrait.php
|
|
# false positive
|
|
- rules/php72/src/Rector/ConstFetch/BarewordStringRector.php
|
|
|
|
|
|
-
|
|
message: '#Do not use setter on a service#'
|
|
paths:
|
|
- packages/rector-generator/src/Rector/Closure/AddNewServiceToSymfonyPhpConfigRector.php
|
|
- src/Configuration/Configuration.php
|
|
|
|
- '#Unable to resolve the template type ExpectedType in call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\)#'
|
|
# class-string vs string
|
|
- '#Parameter \#1 \$expected of method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) expects class\-string<object\>, string given#'
|
|
|
|
-
|
|
message: '#Method "renamePhpDocType\(\)" returns bool type, so the name should start with is/has/was#'
|
|
paths:
|
|
- packages/node-type-resolver/src/PhpDoc/NodeAnalyzer/DocBlockClassRenamer.php
|
|
|
|
-
|
|
message: '#Use "\$class\-\>namespaceName" instead of "\$class\-\>name" that only returns short class name#'
|
|
paths:
|
|
- packages/node-name-resolver/src/NodeNameResolver/ClassNameResolver.php
|
|
|
|
-
|
|
message: '#Cannot cast array<string\>\|bool\|string\|null to string#'
|
|
paths:
|
|
- utils/node-documentation-generator/src/Command/DumpNodesCommand.php
|
|
- src/Configuration/Configuration.php
|
|
- src/Console/Command/ProcessCommand.php
|
|
|
|
- '#Method (.*?) should return array<PhpParser\\Node\\(.*?)\> but returns array<PhpParser\\Node\>#'
|
|
- '#Parameter \#1 (.*?) expects Symfony\\Component\\DependencyInjection\\ContainerBuilder, Symfony\\Component\\DependencyInjection\\ContainerInterface given#'
|
|
|
|
-
|
|
message: '#Strict comparison using \=\=\= between PhpParser\\Node and null will always evaluate to false#'
|
|
paths:
|
|
# looping
|
|
- src/PhpParser/Node/BetterNodeFinder.php
|
|
|
|
# intersection
|
|
- '#Property Rector\\TypeDeclaration\\TypeInferer\\ReturnTypeInferer\:\:\$returnTypeInferers \(array<Rector\\TypeDeclaration\\Contract\\TypeInferer\\ReturnTypeInfererInterface\>\) does not accept array<Rector\\TypeDeclaration\\Contract\\TypeInferer\\PriorityAwareTypeInfererInterface\>#'
|
|
- '#Property Rector\\TypeDeclaration\\TypeInferer\\PropertyTypeInferer\:\:\$propertyTypeInferers \(array<Rector\\TypeDeclaration\\Contract\\TypeInferer\\PropertyTypeInfererInterface\>\) does not accept array<Rector\\TypeDeclaration\\Contract\\TypeInferer\\PriorityAwareTypeInfererInterface\>#'
|
|
|
|
- '#Access to an undefined property PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable\:\:\$name#'
|
|
|
|
# @todo resolve later
|
|
- '#Configurable rules must have configure code sample#'
|
|
- '#Configurable code sample is used but "Rector\\Core\\Contract\\Rector\\ConfigurableRectorInterface" interface is not implemented#'
|
|
|
|
# @todo bug in symplify, fix later
|
|
- '#Parameter 2 should use "PhpParser\\Node\\Stmt\\Namespace_" type as the only type passed to this method#'
|
|
|
|
-
|
|
message: '#Class cognitive complexity is 41, keep it under 40#'
|
|
paths:
|
|
- rules/phpunit/src/Rector/Class_/ArrayArgumentInTestToDataProviderRector.php
|
|
|
|
# @todo loop magic, resolve later
|
|
-
|
|
message: '#Access to an undefined property PhpParser\\Node\:\:\$expr#'
|
|
paths:
|
|
- rules/php80/src/Rector/If_/NullsafeOperatorRector.php
|
|
-
|
|
message: '#Call to an undefined method PHPStan\\Type\\Type\:\:getClassName\(\)#'
|
|
paths:
|
|
- rules/strict-code-quality/src/Rector/ClassMethod/ParamTypeToAssertTypeRector.php
|
|
|
|
###################################################
|
|
|
|
# is fixed in never simplify
|
|
-
|
|
message: '#Do not use setter on a service#'
|
|
paths:
|
|
- src/Configuration/RenamedClassesDataCollector.php
|
|
- '#Method "mustMatchGitDiff\(\)" returns bool type, so the name should start with is/has/was#'
|
|
|
|
-
|
|
message: '#Class cognitive complexity is 43, keep it under 40#'
|
|
paths:
|
|
- rules/phpunit/src/Rector/Class_/ArrayArgumentInTestToDataProviderRector.php
|
|
|
|
- '#should return ReflectionClassConstant\|null but returns ReflectionClassConstant\|false#'
|
|
|
|
- '#Method "evaluateBinaryToVersionCompareCondition\(\)" returns bool type, so the name should start with is/has/was#'
|
|
|
|
# soo many false positive naming - fix later with Recto rule
|
|
- '#Method "(.*?)\(\)" returns bool type, so the name should start with is/has/was#'
|
|
|
|
|
|
# false positives
|
|
-
|
|
message: '#Unreachable statement \- code above always terminates#'
|
|
paths:
|
|
- rules/php70/src/Rector/FuncCall/MultiDirnameRector.php
|
|
|
|
-
|
|
message: '#Comparison operation "<" between 0 and 2 is always true#'
|
|
paths:
|
|
- rules/php70/src/Rector/FuncCall/MultiDirnameRector.php
|
|
- '#PHPDoc tag @param for parameter \$node with type float is incompatible with native type PhpParser\\Node#'
|
|
|
|
# intersection mess
|
|
- '#Parameter \#1 \$phpDocTagNodes of method Rector\\PHPUnit\\NodeFactory\\ExpectExceptionMethodCallFactory\:\:createFromTagValueNodes\(\) expects array<PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode\>, array<PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode\|Rector\\BetterPhpDocParser\\Contract\\PhpDocNode\\AttributeAwareNodeInterface\> given#'
|
|
|
|
# false postives
|
|
- '#Parameter \#2 \$right of class PhpParser\\Node\\Expr\\BinaryOp\\Spaceship constructor expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|null given#'
|
|
- '#Parameter \#1 \$stmts of class Rector\\Core\\PhpParser\\Node\\CustomNode\\FileWithoutNamespace constructor expects array<PhpParser\\Node\\Stmt\>, array<PhpParser\\Node\> given#'
|
|
|
|
|
|
-
|
|
message: '#Call to function is_string\(\) with float will always evaluate to false#'
|
|
path: src/PhpParser/Printer/BetterStandardPrinter.php
|
|
|
|
- '#Parameter \#1 \$node of method Rector\\Php80\\Rector\\If_\\NullsafeOperatorRector\:\:getStartNode\(\) expects PhpParser\\Node, PhpParser\\Node\|null given#'
|
|
|
|
# @todo resolve in symplify
|
|
- '#Content of method "(.*?)\(\)" is duplicated with method in "(.*?)Trait" class\. Use unique content or abstract service instead#'
|
|
|
|
# known values from other methods
|
|
-
|
|
message: '#Negated boolean expression is always true#'
|
|
path: rules/php-spec-to-phpunit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php
|
|
|
|
-
|
|
message: '#Call to function in_array\(\) with arguments string, array\(\) and true will always evaluate to false#'
|
|
path: rules/php56/src/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php
|
|
|
|
-
|
|
message: '#Parameter \#1 \$left of class PhpParser\\Node\\Expr\\BinaryOp\\Spaceship constructor expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|null given#'
|
|
path: rules/php70/src/Rector/If_/IfToSpaceshipRector.php
|
|
|
|
- '#PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable given#'
|
|
|
|
# unable to test, because the method is final
|
|
- '#Class "Rector\\Nette\\Rector\\Class_\\MoveFinalGetUserToCheckRequirementsClassMethodRector" is missing @see annotation with test case class reference#'
|
|
|
|
# type juggling
|
|
- '#AttributeAwareNodeInterface#'
|
|
- '#Method Rector\\Doctrine\\Rector\\MethodCall\\ChangeSetIdToUuidValueRector\:\:getSetUuidMethodCallOnSameVariable\(\) should return PhpParser\\Node\\Expr\\MethodCall\|null but returns PhpParser\\Node\|null#'
|
|
|
|
-
|
|
message: '#Use `\$class\-\>namespaceName` instead of `\$class\-\>name` that only returns short class name#'
|
|
paths:
|
|
- rules/coding-style/src/Naming/NameRenamer.php
|
|
- packages/node-name-resolver/src/NodeNameResolver/ClassNameResolver.php
|
|
|
|
-
|
|
message: '#Property with protected modifier is not allowed\. Use interface contract method instead#'
|
|
paths:
|
|
- rules/defluent/src/ValueObject/*
|
|
|
|
- '#Parameter \#1 \$keyName of method Rector\\AttributeAwarePhpDoc\\Ast\\Type\\AttributeAwareArrayShapeItemNode\:\:createKeyWithSpacePattern\(\) expects PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprIntegerNode\|PHPStan\\PhpDocParser\\Ast\\Type\\IdentifierTypeNode\|null, PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprIntegerNode\|PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprStringNode\|PHPStan\\PhpDocParser\\Ast\\Type\\IdentifierTypeNode\|null given#'
|
|
- '#AttributeAwarePhpDocNode#'
|
|
|
|
# doc types
|
|
-
|
|
message: '#Access to an undefined property PhpParser\\Node\:\:\$args#'
|
|
paths:
|
|
- rules/naming/src/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php
|
|
- '#Method Rector\\CodeQuality\\Rector\\Foreach_\\SimplifyForeachToCoalescingRector\:\:matchReturnOrAssignNode\(\) should return PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Stmt\\Return_\|null but returns PhpParser\\Node\|null#'
|
|
- '#Cognitive complexity for "Rector\\CodeQuality\\Rector\\If_\\SimplifyIfIssetToNullCoalescingRector\:\:shouldSkip\(\)" is 10, keep it under 9#'
|
|
- '#Instanceof between PhpParser\\Node\\Stmt and Rector\\Core\\PhpParser\\Node\\CustomNode\\FileWithoutNamespace will always evaluate to false#'
|
|
|
|
-
|
|
message: '#Use value object over multi array assign#'
|
|
paths:
|
|
- packages/node-collector/src/NodeCollector/ParsedClassConstFetchNodeCollector.php
|
|
|
|
# @todo improvate later
|
|
- '#Access to an undefined property PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode\:\:\$description#'
|
|
|
|
-
|
|
message: '#Unreachable statement \- code above always terminates#'
|
|
path: 'bin/rector.php'
|
|
|
|
-
|
|
message: '#Do not use setter on a service#'
|
|
paths:
|
|
- packages/better-php-doc-parser/src/PhpDocNodeFactory/ParamPhpDocNodeFactory.php
|
|
|
|
|
|
-
|
|
message: '#Class cognitive complexity is 42, keep it under 40#'
|
|
paths:
|
|
- rules/php-spec-to-phpunit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php
|
|
|
|
# @todo fix later
|
|
-
|
|
message: '#Property with protected modifier is not allowed\. Use interface contract method instead#'
|
|
paths:
|
|
- rules/naming/src/Guard/PropertyConflictingNameGuard/AbstractPropertyConflictingNameGuard.php
|
|
- rules/naming/src/PropertyRenamer/AbstractPropertyRenamer.php
|
|
|
|
- '#Cannot call method getParentNode\(\) on Rector\\DeadCode\\ValueObject\\VariableNodeUse\|null#'
|
|
|
|
# @todo resolve later
|
|
- '#Content of method "endsWith\(\)" is duplicated with method in "Rector\\Naming\\ExpectedNameResolver\\AbstractExpectedNameResolver" class\. Use unique content or abstract service instead#'
|