mirror of https://github.com/rectorphp/rector.git
701 lines
38 KiB
Plaintext
701 lines
38 KiB
Plaintext
includes:
|
|
- vendor/symplify/phpstan-rules/config/symplify-rules.neon
|
|
|
|
parameters:
|
|
level: 8
|
|
|
|
# requires exact closure types
|
|
checkMissingCallableSignature: true
|
|
|
|
parallel:
|
|
# to prevent full thread lagging pc
|
|
maximumNumberOfProcesses: 15
|
|
|
|
paths:
|
|
- rector.php
|
|
- 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
|
|
|
|
excludePaths:
|
|
# too modern code for PHPStan 0.12.2
|
|
- bin/validate-phpstan-version.php
|
|
- bin/detect-rules-not-used-in-any-set.php
|
|
|
|
# temporary stinrgable migration from template type provider
|
|
- src/Console/Command/InitCommand.php
|
|
- bin/generate-changelog.php
|
|
|
|
- */config.php
|
|
|
|
# broken in PHPStan https://github.com/rectorphp/rector/runs/1305002460#step:5:56
|
|
- packages/BetterPhpDocParser/ValueObject/PhpDocNode/AbstractTagValueNode.php
|
|
- packages/Testing/PHPUnit/*.php
|
|
- rules/DowngradePhp70/Rector/FunctionLike/AbstractDowngradeParamDeclarationRector.php
|
|
|
|
# demo rule
|
|
- tests/Issues/AliasedImportDouble/Rector/ClassMethod/AddAliasImportRector.php
|
|
|
|
# complex printer
|
|
- '*tests/Rector/MethodCall/RenameMethodRector/**/SomeClass.php'
|
|
# tests files
|
|
- "*tests/*/Expected/*"
|
|
- '*tests/*/Fixture/*'
|
|
- '*tests/*/Source/*'
|
|
- '*tests/Source/*'
|
|
# part of composer
|
|
- '*/tests/Rector/Psr4/MultipleClassFileToPsr4ClassesRector/Expected/Just*ExceptionWithoutNamespace.php'
|
|
- packages-tests/BetterPhpDocPraser/PhpDocParser/TagValueNodeReprint/Fixture/SymfonyRoute/RouteName.php
|
|
|
|
# tests
|
|
- tests/DependencyInjection/config
|
|
|
|
ignoreErrors:
|
|
# PHP 7.4 1_000 support
|
|
- '#Property PhpParser\\Node\\Scalar\\DNumber\:\:\$value \(float\) does not accept string#'
|
|
|
|
- '#Parameter \#1 \$node of method Rector\\PostRector\\Collector\\NodesToAddCollector\:\:wrapToExpression\(\) expects PhpParser\\Node\\Expr\|PhpParser\\Node\\Stmt, PhpParser\\Node given#'
|
|
|
|
- '#Cognitive complexity for "Rector\\Php80\\NodeResolver\\SwitchExprsResolver\:\:resolve\(\)" is (.*?), keep it under 10#'
|
|
|
|
-
|
|
message: '#Class cognitive complexity is \d+, keep it under \d+#'
|
|
paths:
|
|
- rules/Php70/EregToPcreTransformer.php
|
|
- packages/NodeTypeResolver/NodeTypeResolver.php
|
|
- rules/Renaming/NodeManipulator/ClassRenamer.php
|
|
- src/Rector/AbstractRector.php
|
|
|
|
- "#^Cognitive complexity for \"Rector\\\\Php70\\\\EregToPcreTransformer\\:\\:(.*?)\" is (.*?), keep it under 10$#"
|
|
- '#Cognitive complexity for "Rector\\Core\\PhpParser\\Node\\Value\\ValueResolver\:\:getValue\(\)" is \d+, keep it under 10#'
|
|
- '#Cognitive complexity for "Rector\\DeadCode\\NodeManipulator\\LivingCodeManipulator\:\:keepLivingCodeFromExpr\(\)" is \d+, keep it under 10#'
|
|
|
|
# known value
|
|
- '#Property PhpParser\\Node\\Stmt\\Foreach_\:\:\$valueVar \(PhpParser\\Node\\Expr\) does not accept PhpParser\\Node\\Expr\|null#'
|
|
|
|
- '#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#'
|
|
|
|
# 3rd party package
|
|
-
|
|
message: '#Array (with keys|destruct) is not allowed\. Use value object to pass data instead#'
|
|
path: rules/Php70/EregToPcreTransformer.php
|
|
-
|
|
message: '#Use explicit return value over magic &reference#'
|
|
path: rules/Php70/EregToPcreTransformer.php
|
|
|
|
# symplify 9
|
|
- '#Use another value object over array with string\-keys and objects, array<string, ValueObject\>#'
|
|
- '#Do not use factory/method call in constructor\. Put factory in config and get service with dependency injection#'
|
|
|
|
# false positives checked in another method
|
|
-
|
|
message: '#If condition is always false#'
|
|
paths:
|
|
- rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php
|
|
- packages/NodeNestingScope/NodeFinder/ScopeAwareNodeFinder.php
|
|
|
|
- '#Method (.*?) should return array<PhpParser\\Node\\(.*?)\> but returns array<PhpParser\\Node\>#'
|
|
|
|
- '#Access to an undefined property PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable\:\:\$name#'
|
|
|
|
-
|
|
message: '#Comparison operation "<" between 0 and 2 is always true#'
|
|
paths:
|
|
- rules/Php70/Rector/FuncCall/MultiDirnameRector.php
|
|
|
|
-
|
|
message: '#Call to function is_string\(\) with float will always evaluate to false#'
|
|
path: src/PhpParser/Printer/BetterStandardPrinter.php
|
|
|
|
# class_exists is forbidden to enforce static reflection, but in a compiler pass we want runtime autoloading
|
|
-
|
|
message: '#Function "class_exists\(\)" cannot be used/left in the code#'
|
|
paths:
|
|
- src/DependencyInjection/CompilerPass/VerifyRectorServiceExistsCompilerPass.php
|
|
# for config class reflection
|
|
- packages/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php
|
|
|
|
- '#PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable given#'
|
|
|
|
- '#Method Rector\\CodeQuality\\Rector\\Foreach_\\SimplifyForeachToCoalescingRector\:\:matchReturnOrAssignNode\(\) should return PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Stmt\\Return_\|null but returns PhpParser\\Node\|null#'
|
|
|
|
-
|
|
message: '#Unreachable statement \- code above always terminates#'
|
|
paths:
|
|
- bin/rector.php
|
|
- rules/Php70/Rector/FuncCall/MultiDirnameRector.php
|
|
|
|
-
|
|
message: '#Function "class_exists\(\)" cannot be used/left in the code#'
|
|
paths:
|
|
- src/Bootstrap/ExtensionConfigResolver.php
|
|
|
|
# @todo fix later
|
|
-
|
|
message: '#There should be no empty class#'
|
|
paths:
|
|
- packages/StaticTypeMapper/ValueObject/Type/*Type.php
|
|
- */Exception/*
|
|
|
|
-
|
|
message: '#Namespace "Rector\\(.*?)\\Rector" is only reserved for "Rector"\. Move the class somewhere else#'
|
|
paths:
|
|
- */Contract/*
|
|
|
|
# generics nullable bugs
|
|
- '#Method (.*?) should return (.*?)\|null but returns PhpParser\\Node\|null#'
|
|
- '#Method (.*?) should return array<T of PhpParser\\Node\> but returns array<PhpParser\\Node\>#'
|
|
|
|
# fixed in php-parser master
|
|
- '#Parameter \#4 \$classWithConstants of class Rector\\Privatization\\ValueObject\\ReplaceStringWithClassConstant constructor expects class\-string, string given#'
|
|
|
|
# buggy phpstan clas-string
|
|
- '#Method (.*?) should return class\-string but returns string#'
|
|
|
|
-
|
|
message: '#\$this as argument is not allowed\. Refactor method to service composition#'
|
|
paths:
|
|
- src/Rector/AbstractRector.php
|
|
|
|
- '#Property Rector\\Core\\PhpParser\\Node\\AssignAndBinaryMap\:\:\$binaryOpToAssignClasses \(array<class\-string<PhpParser\\Node\\Expr\\BinaryOp\>, class\-string<PhpParser\\Node\\Expr\\BinaryOp\>\>\) does not accept array#'
|
|
|
|
-
|
|
message: '#Function "property_exists\(\)" cannot be used/left in the code#'
|
|
paths:
|
|
# on PhpParser Nodes
|
|
- packages/NodeNameResolver/NodeNameResolver.php
|
|
|
|
# known types
|
|
- '#Call to an undefined method PHPStan\\Type\\ConstantType\:\:getValue\(\)#'
|
|
- '#Parameter \#1 \$stmts of method Rector\\EarlyReturn\\Rector\\Return_\\PreparedValueToEarlyReturnRector\:\:collectIfs\(\) expects array<PhpParser\\Node\\Stmt\\If_\>, array<PhpParser\\Node\\Stmt\> given#'
|
|
- '#Access to an undefined property PhpParser\\Node\\FunctionLike\|PhpParser\\Node\\Stmt\\If_\:\:\$stmts#'
|
|
|
|
- '#Cognitive complexity for "Rector\\CodeQuality\\Rector\\Isset_\\IssetOnPropertyObjectToPropertyExistsRector\:\:refactor\(\)" is \d+, keep it under 10#'
|
|
- '#Cognitive complexity for "Rector\\DogFood\\Rector\\Closure\\UpgradeRectorConfigRector\:\:refactor\(\)" is \d+, keep it under 10#'
|
|
|
|
- '#(.*?) class\-string, string given#'
|
|
|
|
# part of refactor() API, node must be returned, or does bring any value
|
|
-
|
|
message: '#Use void instead of modify and return self object#'
|
|
paths:
|
|
- '*Rector.php'
|
|
|
|
# PHP 7_4 literal syntax
|
|
- '#Property PhpParser\\Node\\Scalar\\DNumber\:\:\$value \(float\|int\) does not accept string#'
|
|
|
|
-
|
|
message: '#Array destruct is not allowed\. Use value object to pass data instead#'
|
|
paths:
|
|
- packages/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParser.php
|
|
|
|
-
|
|
message: '#\$this as argument is not allowed\. Refactor method to service composition#'
|
|
paths:
|
|
- packages/BetterPhpDocParser/ValueObject/Parser/BetterTokenIterator.php
|
|
|
|
- '#Cognitive complexity for "Rector\\BetterPhpDocParser\\PhpDocParser\\DoctrineAnnotationDecorator\:\:mergeNestedDoctrineAnnotations\(\)" is \d+, keep it under 10#'
|
|
|
|
- '#Cognitive complexity for "Rector\\BetterPhpDocParser\\Printer\\PhpDocInfoPrinter\:\:printDocChildNode\(\)" is \d+, keep it under 10#'
|
|
- '#Cognitive complexity for "Rector\\NodeTypeResolver\\NodeTypeResolver\:\:getType\(\)" is \d+, keep it under 10#'
|
|
|
|
-
|
|
message: '#Property with protected modifier is not allowed\. Use interface contract method instead#'
|
|
path: 'packages/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php'
|
|
|
|
# known type
|
|
- '#Parameter \#3 \$pseudoNamespaceToNamespace of method Rector\\NodeTypeResolver\\PhpDocNodeVisitor\\UnderscoreRenamePhpDocNodeVisitor\:\:shouldSkip\(\) expects Rector\\Renaming\\ValueObject\\PseudoNamespaceToNamespace, Rector\\Renaming\\ValueObject\\PseudoNamespaceToNamespace\|null given#'
|
|
|
|
# known types
|
|
- '#Parameter (.*?) expects PhpParser\\Node, PhpParser\\Node\|null given#'
|
|
|
|
-
|
|
message: '#Class cognitive complexity is \d+, keep it under \d+#'
|
|
paths:
|
|
- packages/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php
|
|
|
|
-
|
|
message: '#Property with protected modifier is not allowed\. Use interface contract method instead#'
|
|
paths:
|
|
- src/Rector/AbstractRector.php
|
|
|
|
- '#Cannot call method getSmartFileInfo\(\) on Rector\\Core\\ValueObject\\Application\\File\|null#'
|
|
|
|
-
|
|
message: '#Function "function_exists\(\)" cannot be used/left in the code#'
|
|
paths:
|
|
- src/functions/node_helper.php
|
|
|
|
- '#Method Rector\\BetterPhpDocParser\\PhpDocParser\\BetterPhpDocParser\:\:parseChildAndStoreItsPositions\(\) should return PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode\|PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTextNode but returns PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocChildNode#'
|
|
|
|
# deserves better architecture
|
|
-
|
|
message: '#Do not use chained method calls#'
|
|
path: packages/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php
|
|
|
|
-
|
|
message: '#Function "dump_node\(\)" cannot be used/left in the code#'
|
|
path: src/functions/node_helper.php
|
|
|
|
# union false positive
|
|
- '#Method Rector\\Comments\\CommentRemover\:\:removeFromNode\(\) has parameter \$node with no value type specified in iterable type array#'
|
|
|
|
# false positive
|
|
- '#Attribute class JetBrains\\PhpStorm\\Immutable does not exist#'
|
|
|
|
# class-string miss match
|
|
- '#Parameter \#1 \$classes of method Rector\\BetterPhpDocParser\\PhpDocInfo\\PhpDocInfo<PHPStan\\PhpDocParser\\Ast\\Node\>\:\:getByAnnotationClasses\(\) expects array<class\-string\>, array<int, string\> given#'
|
|
- '#Parameter \#1 \$classes of method Rector\\BetterPhpDocParser\\PhpDocInfo\\PhpDocInfo<TNode of PHPStan\\PhpDocParser\\Ast\\Node\>\:\:getByAnnotationClasses\(\) expects array<class\-string\>, array<string\> given#'
|
|
|
|
- '#expects class\-string<TNode of PHPStan\\PhpDocParser\\Ast\\Node\>, string given#'
|
|
# weird generics
|
|
- '#Method Rector\\BetterPhpDocParser\\PhpDocInfo\\PhpDocInfo\:\:getByType\(\) should return array<TNode of PHPStan\\PhpDocParser\\Ast\\Node\> but returns array<PHPStan\\PhpDocParser\\Ast\\Node\>#'
|
|
|
|
# array_index on generic types
|
|
- '#Method Rector\\NodeTypeResolver\\PHPStan\\Type\\TypeFactory\:\:uniquateTypes\(\) should return array<TType of PHPStan\\Type\\Type\> but returns array<int, PHPStan\\Type\\Type\>#'
|
|
|
|
# resolve later
|
|
- '#Method "(.*?)\(\)" only calling another method call and has no added value\. Use the inlined call instead#'
|
|
- '#Method "processRenameVariable\(\)" returns bool type, so the name should start with is/has/was#'
|
|
- '#Method "refactorParamType\(\)" returns bool type, so the name should start with is/has/was#'
|
|
- '#Method "decorateReturnWithSpecificType\(\)" returns bool type, so the name should start with is/has/was#'
|
|
- '#Method "resolveObjectType\(\)" returns bool type, so the name should start with is/has/was#'
|
|
|
|
# native filesystem calls, required for performance reasons
|
|
-
|
|
message: '#"@\\unlink\(\$tmpPath\)" is forbidden to use#'
|
|
paths:
|
|
- packages/Caching/ValueObject/Storage/FileCacheStorage.php
|
|
-
|
|
message: '#"@\\rename\(\$tmpPath, \$path\)" is forbidden to use#'
|
|
paths:
|
|
- packages/Caching/ValueObject/Storage/FileCacheStorage.php
|
|
-
|
|
message: '#"@\\var_export\(new \\Rector\\Caching\\ValueObject\\CacheItem\(\$variableKey, \$data\), true\)" is forbidden to use#'
|
|
paths:
|
|
- packages/Caching/ValueObject/Storage/FileCacheStorage.php
|
|
|
|
# resolve later
|
|
- '#Variables "\$(.*?)" are overridden\. This can lead to unwanted bugs, please pick a different name to avoid it#'
|
|
|
|
-
|
|
message: '#Instead of abstract class, use specific service with composition#'
|
|
paths:
|
|
- packages/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php
|
|
- packages/PostRector/Rector/AbstractPostRector.php
|
|
- src/Rector/AbstractRector.php
|
|
- src/Rector/AbstractScopeAwareRector.php
|
|
|
|
-
|
|
message: '#This call has duplicate argument#'
|
|
paths:
|
|
- rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php
|
|
|
|
-
|
|
message: '#foreach\(\), while\(\), for\(\) or if\(\) cannot contain a complex expression\. Extract it to a new variable on a line before#'
|
|
paths:
|
|
- rules/Php70/Rector/FuncCall/MultiDirnameRector.php
|
|
- src/Application/FileProcessor.php
|
|
- src/PhpParser/Node/BetterNodeFinder.php
|
|
|
|
# find everything class, better then 10 different finders
|
|
-
|
|
message: '#Class cognitive complexity is \d+, keep it under 50#'
|
|
paths:
|
|
- src/PhpParser/Node/BetterNodeFinder.php
|
|
|
|
-
|
|
message: '#Parameter \#2 \$length of function str_split expects int<1, max\>, int given#'
|
|
paths:
|
|
- rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php
|
|
|
|
-
|
|
message: '#Class has a static method must so must contains "Static" in its name#'
|
|
paths:
|
|
- packages/FileFormatter/ValueObject/Indent.php #17
|
|
- packages/FileFormatter/ValueObject/NewLine.php #15
|
|
- src/Application/VersionResolver.php #16
|
|
- utils/compiler/src/Unprefixer.php #9
|
|
- src/Configuration/ValueObjectInliner.php
|
|
|
|
# waits for phpstan upgrade to php-parser 4.13
|
|
- '#Access to an undefined property PhpParser\\Node\\Arg\|PhpParser\\Node\\VariadicPlaceholder\:\:\$value#'
|
|
- '#(.*?), array<PhpParser\\Node\\Arg\|PhpParser\\Node\\VariadicPlaceholder\> given#'
|
|
|
|
# share configuration to avoid duplication in 5 rules
|
|
-
|
|
message: '#Instead of abstract class, use specific service with composition#'
|
|
path: rules/Strict/Rector/AbstractFalsyScalarRuleFixerRector.php
|
|
|
|
# false positive - configured parmaeter
|
|
-
|
|
message: '#Property with protected modifier is not allowed\. Use interface contract method instead#'
|
|
path: rules/Strict/Rector/AbstractFalsyScalarRuleFixerRector.php
|
|
|
|
# internal tag
|
|
- '#Unknown PHPDoc tag\: @phpstan\-rule#'
|
|
|
|
# many internal cases
|
|
- '#Calling (.*?) is not covered by backward compatibility promise\. The method might change in a minor PHPStan version#'
|
|
|
|
# generated content - not reliable values
|
|
-
|
|
message: '#Offset (.*?) on array(.*?) on left side of \?\? always exists and is not nullable#'
|
|
paths:
|
|
- packages/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php
|
|
|
|
-
|
|
path: src/Bootstrap/RectorConfigsResolver.php
|
|
message: '#Method Rector\\Core\\Bootstrap\\RectorConfigsResolver\:\:resolveFromInput\(\) should return string\|null but returns string\|false#'
|
|
|
|
- '#Cognitive complexity for "Rector\\Core\\NodeManipulator\\ClassMethodAssignManipulator\:\:collectReferenceVariableNames\(\)" is 13, keep it under 10#'
|
|
|
|
# caching
|
|
-
|
|
message: '#Use separate function calls with readable variable names#'
|
|
paths:
|
|
- src/DependencyInjection/Loader/Configurator/RectorServiceConfigurator.php
|
|
|
|
# on purpose to make use of worker paralle pattern
|
|
-
|
|
message: '#Instead of abstract class, use specific service with composition#'
|
|
path: src/Console/Command/AbstractProcessCommand.php
|
|
|
|
# known value object, nullable due to typed property
|
|
-
|
|
message: '#Cannot call method (.*?)\(\) on (.*?)\\ProcessPool\|null#'
|
|
path: packages/Parallel/Application/ParallelFileProcessor.php
|
|
|
|
# parallel complexity
|
|
- '#Cognitive complexity for "Rector\\Parallel\\Application\\ParallelFileProcessor\:\:process\(\)" is \d+, keep it under 10#'
|
|
|
|
- '#Argument and options "debug", "clear\-cache" got confused#'
|
|
|
|
# strict rules
|
|
- '#Dynamic call to static method PHPUnit\\Framework\\Assert\:\:(.*?)\(\)#'
|
|
|
|
# specific generics
|
|
- '#Parameter \#1 \$node (.*?) of method Rector\\(.*?)Rector\:\:refactor\(\) should be contravariant with parameter \$node \(PhpParser\\Node\) of method Rector\\Core\\Contract\\Rector\\PhpRectorInterface\:\:refactor\(\)#'
|
|
- '#Return type (.*?) of method Rector\\(.*?)\\Rector\\(.*?)\\(.*?)\:\:refactor\(\) should be covariant with return type \(array<PhpParser\\Node>\|PhpParser\\Node\|null\) of method Rector\\Core\\Contract\\Rector\\PhpRectorInterface\:\:refactor\(\)#'
|
|
|
|
# only for empty ctor
|
|
- '#Rector\\Core\\PhpParser\\NodeTraverser\\RectorNodeTraverser\:\:__construct\(\) does not call parent constructor from PhpParser\\NodeTraverser#'
|
|
|
|
-
|
|
message: '#Class has a static method must so must contains "Static" in its name#'
|
|
path: src/Util/StringUtils.php
|
|
|
|
# generics
|
|
- '#Method Rector\\Core\\PhpParser\\NodeTraverser\\RectorNodeTraverser\:\:traverse\(\) should return array<TNode of PhpParser\\Node\> but returns array<PhpParser\\Node\>#'
|
|
- '#Parameter \#1 \$stmts of class Rector\\Core\\PhpParser\\Node\\CustomNode\\FileWithoutNamespace constructor expects array<PhpParser\\Node\\Stmt\>, array<TNode of PhpParser\\Node\> given#'
|
|
|
|
# strict - resolve later
|
|
- '#Foreach overwrites \$(.*?) with its value variable#'
|
|
|
|
-
|
|
message: '#Strict comparison using \!\=\= between null and null will always evaluate to false#'
|
|
path: rules/Renaming/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector.php
|
|
|
|
# stricter child type on purpose
|
|
- '#Parameter \#1 \$nodes \(array<PhpParser\\Node\\Stmt\>\) of method Rector\\PostRector\\Rector\\(.*?)\:\:beforeTraverse\(\) should be contravariant with parameter \$nodes \(array<PhpParser\\Node\>\) of method PhpParser\\NodeVisitor\:\:beforeTraverse\(\)#'
|
|
|
|
# stricter child type on purpose
|
|
- '#Parameter \#1 \$tokenIterator \(Rector\\BetterPhpDocParser\\ValueObject\\Parser\\BetterTokenIterator\) of method Rector\\BetterPhpDocParser\\PhpDocParser\\BetterPhpDocParser\:\:parseTagValue\(\) should be contravariant with parameter \$tokens \(PHPStan\\PhpDocParser\\Parser\\TokenIterator\) of method PHPStan\\PhpDocParser\\Parser\\PhpDocParser\:\:parseTagValue\(\)#'
|
|
- '#Parameter \#1 \$nodes \(array<PhpParser\\Node\\Stmt\>\) of method Rector\\PostRector\\Rector\\(.*?)\:\:beforeTraverse\(\) should be contravariant with parameter \$nodes \(array<PhpParser\\Node\>\) of method PhpParser\\NodeVisitorAbstract\:\:beforeTraverse\(\)#'
|
|
|
|
# property changed else-where
|
|
-
|
|
message: '#If condition is always false#'
|
|
path: rules/TypeDeclaration/Rector/FunctionLike/ParamTypeDeclarationRector.php
|
|
|
|
# on purpose, allows empty tokens
|
|
- '#Rector\\BetterPhpDocParser\\ValueObject\\Parser\\BetterTokenIterator\:\:__construct\(\) does not call parent constructor from PHPStan\\PhpDocParser\\Parser\\TokenIterator#'
|
|
- '#Rector\\Comments\\NodeTraverser\\CommentRemovingNodeTraverser\:\:__construct\(\) does not call parent constructor from PhpParser\\NodeTraverser#'
|
|
|
|
# confused generics
|
|
- '#Return type \(array<class\-string<PhpParser\\Node\>\>\) of method Rector\\NodeTypeResolver\\NodeTypeResolver\\(.*?)TypeResolver\:\:getNodeClasses\(\) should be covariant with return type \(array<class\-string<PhpParser\\Node\\(.*?)\>\>\) of method Rector\\NodeTypeResolver\\Contract\\NodeTypeResolverInterface<PhpParser\\Node\\(.*?)\>\:\:getNodeClasses\(\)#'
|
|
|
|
-
|
|
message: '#Class has a static method must so must contains "Static" in its name#'
|
|
path: src/Validation/RectorAssert.php
|
|
|
|
# parallel
|
|
-
|
|
message: '#Instead of array shape, use value object with specific types in constructor and getters#'
|
|
paths:
|
|
- src/ValueObjectFactory/ProcessResultFactory.php
|
|
- src/*/*Processor.php
|
|
- rules/Composer/Application/FileProcessor/ComposerFileProcessor.php
|
|
- src/Contract/Processor/FileProcessorInterface.php
|
|
- packages/Parallel/Application/ParallelFileProcessor.php
|
|
- rules/CodeQuality/Rector/PropertyFetch/ExplicitMethodCallOverMagicGetSetRector.php
|
|
|
|
# skipped on purpose, as ctor overrie
|
|
- '#Rector\\StaticTypeMapper\\ValueObject\\Type\\SimpleStaticType\:\:__construct\(\) does not call parent constructor from PHPStan\\Type\\StaticType#'
|
|
|
|
# complex detection
|
|
- '#Cognitive complexity for "Rector\\Core\\DependencyInjection\\Collector\\ConfigureCallValuesCollector\:\:addConfigureCallValues\(\)" is \d+, keep it under 10#'
|
|
- '#Cognitive complexity for "Rector\\TypeDeclaration\\Rector\\FunctionLike\\ParamTypeDeclarationRector\:\:refactorParam\(\)" is 11, keep it under 10#'
|
|
|
|
# return bool on change
|
|
- '#Method "(change|remove)(.*?)" returns bool type, so the name should start with is/has/was#'
|
|
|
|
-
|
|
message: '#Casting to float something that.{1}s already float#'
|
|
path: packages/NodeTypeResolver/NodeTypeResolver/ScalarTypeResolver.php #38
|
|
|
|
-
|
|
message: '#Casting to string something that.{1}s already string#'
|
|
path: packages/NodeTypeResolver/NodeTypeResolver/ScalarTypeResolver.php #42
|
|
|
|
-
|
|
message: '#Casting to int something that.{1}s already int#'
|
|
path: packages/NodeTypeResolver/NodeTypeResolver/ScalarTypeResolver.php #46
|
|
|
|
-
|
|
message: '#Cognitive complexity for "Rector\\Php80\\Rector\\Class_\\AnnotationToAttributeRector\:\:processDoctrineAnnotationClasses\(\)" is \d+, keep it under 10#'
|
|
path: rules/Php80/Rector/Class_/AnnotationToAttributeRector.php
|
|
|
|
-
|
|
message: '#Use value object over return of values#'
|
|
paths:
|
|
- src/Application/ApplicationFileProcessor.php
|
|
- packages/Parallel/Application/ParallelFileProcessor.php
|
|
- packages/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParser.php
|
|
- rules/EarlyReturn/Rector/If_/ChangeNestedIfsToEarlyReturnRector.php
|
|
- rules/CodeQuality/Rector/PropertyFetch/ExplicitMethodCallOverMagicGetSetRector.php
|
|
- rules/Php70/EregToPcreTransformer.php
|
|
- rules/CodeQuality/Rector/PropertyFetch/ExplicitMethodCallOverMagicGetSetRector.php
|
|
- src/Kernel/RectorKernel.php
|
|
|
|
- '#Method Rector\\Core\\Application\\ApplicationFileProcessor\:\:runParallel\(\) should return array\{system_errors\: array<Rector\\Core\\ValueObject\\Error\\SystemError\>, file_diffs\: array<Rector\\Core\\ValueObject\\Reporting\\FileDiff\>\} but returns array#'
|
|
|
|
# Configuration value object, useful
|
|
-
|
|
message: '#Named arguments do not add any value here\. Use normal arguments in the same order#'
|
|
paths:
|
|
- tests/Application/ApplicationFileProcessor/ApplicationFileProcessorTest.php
|
|
|
|
# impossible to validate json string is a class-string
|
|
- '#Parameter \#1 \$rectorClass of class Rector\\ChangesReporting\\ValueObject\\RectorWithLineChange constructor expects class\-string<Rector\\Core\\Contract\\Rector\\RectorInterface\>\|Rector\\Core\\Contract\\Rector\\RectorInterface, string given#'
|
|
|
|
-
|
|
message: '#Only booleans are allowed in an if condition, array\|null given#'
|
|
path: rules/Naming/Naming/PropertyNaming.php
|
|
|
|
-
|
|
path: src/Bootstrap/ExtensionConfigResolver.php
|
|
message: '#Offset (.*?)includes(.*?) always exists and is not nullable#'
|
|
|
|
# mapper re-use
|
|
- '#Parameter \#1 \$type of method Rector\\PHPStanStaticTypeMapper\\TypeMapper\\ObjectWithoutClassTypeMapper\:\:mapToPhpParserNode\(\) expects PHPStan\\Type\\ObjectWithoutClassType, PHPStan\\Type\\Accessory\\Has(Property|Method)Type given#'
|
|
|
|
# Scope vs MutatingScope interchangable false positive
|
|
- '#Parameter \#3 \$nodeCallback of method PHPStan\\Analyser\\NodeScopeResolver\:\:processNodes\(\) expects callable\(PhpParser\\Node, PHPStan\\Analyser\\Scope\)\: void, (callable|Closure)\(PhpParser\\Node, PHPStan\\Analyser\\MutatingScope\)\: void given#'
|
|
|
|
# internal reflection
|
|
- '#Instead of "new ClassReflection\(\)" use ReflectionProvider service or "\(new PHPStan\\Reflection\\ClassReflection\(<desired_type>\)\)" for static reflection to work#'
|
|
|
|
- '#Callable callable\(PHPStan\\Type\\Type\)\: PHPStan\\Type\\Type invoked with 2 parameters, 1 required#'
|
|
|
|
# PHPStan 1.4.7
|
|
- '#Call to static method Webmozart\\Assert\\Assert\:\:allIsAOf|isAOf\(\) with .* will always evaluate to true#'
|
|
|
|
-
|
|
message: '#Make callable type explicit#'
|
|
path: src/NodeManipulator/BinaryOpManipulator.php
|
|
|
|
# resolve later
|
|
- '#Complete known array shape to the method @return type#'
|
|
# @todo remove from phpstan-rules for reoctr
|
|
|
|
# 3rd party code without types
|
|
- '#Add explicit array type to assigned "(.*?)->(args|params|items|parts|stmts)" expression#'
|
|
# false positive on string type
|
|
- '#Add explicit array type to assigned "\$unusedParameters" expression#'
|
|
- '#Add explicit array type to assigned "\$unnamedArgs" expression#'
|
|
- '#Add explicit array type to assigned "\$innerPattern" expression#'
|
|
# known doc
|
|
- '#Add explicit array type to assigned "\$spreadParams" expression#'
|
|
|
|
- '#foreach\(\), while\(\), for\(\) or if\(\) cannot contain a complex expression\. Extract it to a new variable on a line before#'
|
|
|
|
# double protection on purpose to ensure the type
|
|
-
|
|
message: '#Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with array<string> will always evaluate to true#'
|
|
path: packages/Config/RectorConfig.php
|
|
|
|
- '#Method "processStmt\(\)" returns bool type, so the name should start with is/has/was#'
|
|
- '#Method "refactorReturnAndAssign\(\)" returns bool type, so the name should start with is/has/was#'
|
|
|
|
# move later in BC break release
|
|
- '#Class "(Rector\\DeadCode\\Rector\\(.*?)\\(RemoveUnreachableStatementRector|RemoveDoubleAssignRector))" has invalid namespace category "(.*?)"\. Pick one of\: "(.*?)"#'
|
|
|
|
# stmts refactoring
|
|
- '#Cognitive complexity for "Rector\\DeadCode\\Rector\\Assign\\RemoveDoubleAssignRector\:\:refactor\(\)" is \d+, keep it under 10#'
|
|
|
|
# empty parent construct
|
|
- '#Rector\\Core\\PhpParser\\NodeTraverser\\FileWithoutNamespaceNodeTraverser\:\:__construct\(\) does not call parent constructor from PhpParser\\NodeTraverser#'
|
|
|
|
- '#Cognitive complexity for "Rector\\TypeDeclaration\\PHPStan\\ObjectTypeSpecifier\:\:matchShortenedObjectType\(\)" is \d+, keep it under 10#'
|
|
- '#Cognitive complexity for "Rector\\TypeDeclaration\\PHPStan\\ObjectTypeSpecifier\:\:narrowToFullyQualifiedOrAliasedObjectType\(\)" is \d+, keep it under 10#'
|
|
|
|
- '#Parameter \#1 \$node (.*?) of method Rector\\(.*?)\:\:refactorWithScope\(\) should be contravariant with parameter \$node \(PhpParser\\Node\) of method Rector\\Core\\Contract\\Rector\\ScopeAwarePhpRectorInterface\:\:refactorWithScope\(\)#'
|
|
|
|
# cleanup after merge of assing remover refactoring
|
|
- '#Cognitive complexity for "Rector\\Removing\\NodeManipulator\\ComplexNodeRemover\:\:removePropertyAndUsages\(\)" is \d+, keep it under 10#'
|
|
|
|
# avoid moving rule around, while re-targeting to stmt
|
|
- '#Class "Rector\\(.*?)\\Rector\\(.*?) has invalid namespace category "(.*?)"\. Pick one of\: "(Expression|Class_|NodeTypeGroup)"#'
|
|
- '#Class "Rector\\DeadCode\\Rector\\ConstFetch\\RemovePhpVersionIdCheckRector" has invalid namespace category "ConstFetch"\. Pick one of\: "If_"#'
|
|
|
|
-
|
|
message: '#Cognitive complexity for "Rector\\(.*?)Rector\:\:refactor\(\)" is \d+, keep it under 10#'
|
|
paths:
|
|
- rules/EarlyReturn/Rector/If_/ChangeAndIfToEarlyReturnRector.php
|
|
- rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php
|
|
|
|
# known value
|
|
- '#Method Rector\\Core\\Php\\PhpVersionProvider\:\:provide\(\) should return 50200\|50300\|50400\|50500\|50600\|70000\|70100\|70200\|70300\|70400\|80000\|80100\|80200\|100000 but returns int#'
|
|
|
|
# stubs-rector directory exists on target-repository
|
|
-
|
|
message: '#The path "/\.\./\.\./stubs\-rector" was not found#'
|
|
path: src/Autoloading/BootstrapFilesIncluder.php # 54
|
|
|
|
-
|
|
message: '#PHPDoc tag @param for parameter \$node with type array<PhpParser\\Node\\Stmt\\Expression>\|null is incompatible with native type PhpParser\\Node#'
|
|
paths:
|
|
- rules/CodeQuality/Rector/FuncCall/ChangeArrayPushToArrayAssignRector.php
|
|
|
|
-
|
|
message: '#Method Rector\\CodeQuality\\Rector\\FuncCall\\ChangeArrayPushToArrayAssignRector\:\:refactor\(\) return type has no value type specified in iterable type array#'
|
|
paths:
|
|
- rules/CodeQuality/Rector/FuncCall/ChangeArrayPushToArrayAssignRector.php
|
|
|
|
-
|
|
message: '#Access to an undefined property PhpParser\\Node\:\:\$expr#'
|
|
paths:
|
|
- rules/CodeQuality/Rector/FuncCall/ChangeArrayPushToArrayAssignRector.php
|
|
|
|
- '#Class "Rector\\(.*?)" has invalid namespace category "(.*?)"\. Pick one of\: "StmtsAwareInterface"#'
|
|
|
|
# to be fixed in https://github.com/symplify/symplify/pull/4052
|
|
-
|
|
message: '#Use separate function calls with readable variable names#'
|
|
path: rules/CodingStyle/Rector/ClassMethod/OrderAttributesRector.php
|
|
|
|
- '#Class "Rector\\CodeQuality\\Rector\\FunctionLike\\RemoveAlwaysTrueConditionSetInConstructorRector" has invalid namespace category "FunctionLike"\. Pick one of\: "If_"#'
|
|
|
|
# doc arrays cannot be trusted
|
|
-
|
|
message: '#Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with array<class\-string<Rector\\Core\\Contract\\Rector\\RectorInterface>> will always evaluate to true#'
|
|
path: packages/Config/RectorConfig.php
|
|
|
|
# hash key
|
|
-
|
|
path: rules/Renaming/NodeManipulator/ClassRenamer.php
|
|
message: '#Use separate function calls with readable variable names#'
|
|
|
|
# doc validation
|
|
-
|
|
message: '#Call to function array_key_exists\(\) with (.*?) and array(.*?) will always evaluate to true#'
|
|
path: packages/FileFormatter/ValueObject/Indent.php
|
|
|
|
# hash key
|
|
-
|
|
path: rules/Renaming/NodeManipulator/ClassRenamer.php
|
|
message: '#Use separate function calls with readable variable names#'
|
|
|
|
- '#Cognitive complexity for "Rector\\NodeTypeResolver\\PHPStan\\Scope\\PHPStanNodeScopeResolver\:\:processNodes\(\)" is \d+, keep it under 10#'
|
|
|
|
# depends on falsy docs
|
|
- '#Call to static method Webmozart\\Assert\\Assert\:\:allIsInstanceOf\(\) with array<PhpParser\\Node\\Stmt> and (.*?)Stmt(.*?) will always evaluate to true#'
|
|
|
|
# doc validation
|
|
-
|
|
message: '#Call to function array_key_exists\(\) with (.*?) and array(.*?) will always evaluate to true#'
|
|
path: packages/FileFormatter/ValueObject/Indent.php
|
|
|
|
|
|
# autoload check in bin file
|
|
-
|
|
message: '#Function "class_exists\(\)" cannot be used/left in the code\: use ReflectionProvider\->has\*\(\) instead#'
|
|
path: bin/rector.php
|
|
|
|
-
|
|
message: '#Do not compare call directly, use a variable assign#'
|
|
path: bin/rector.php
|
|
|
|
# use of internal phpstan classes
|
|
-
|
|
message: '#Creating new PHPStan\\Reflection\\BetterReflection\\SourceLocator\\Optimized(.*?)SourceLocator is not covered by backward compatibility promise\. The class might change in a minor PHPStan version#'
|
|
path: packages/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php
|
|
-
|
|
message: '#Creating new PHPStan\\Reflection\\Native\\NativeFunctionReflection is not covered by backward compatibility promise\. The class might change in a minor PHPStan version#'
|
|
path: src/PHPStan/Reflection/TypeToCallReflectionResolver/ClosureTypeToCallReflectionResolver
|
|
|
|
-
|
|
message: '#Creating new PHPStan\\Reflection\\Php\\PhpParameterReflection is not covered by backward compatibility promise\. The class might change in a minor PHPStan version#'
|
|
path: rules/DowngradePhp80/NodeAnalyzer/NamedToUnnamedArgs.php
|
|
|
|
-
|
|
message: '#Do not name "[a-z]", shorter than 2 chars#'
|
|
paths:
|
|
# override parent method named "p"
|
|
- src/PhpParser/Printer/BetterStandardPrinter.php
|
|
# regex
|
|
- rules/Php70/EregToPcreTransformer.php
|
|
|
|
# Symfony Finder filter
|
|
-
|
|
message: '#Instead of "Symfony\\Component\\Finder\\SplFileInfo" class/interface use "Symplify\\SmartFileSystem\\SmartFileInfo"#'
|
|
path: src/FileSystem/FilesFinder.php #113
|
|
|
|
# format specifiers definition rule
|
|
-
|
|
message: '#Modifier "%s" is not matching passed variable type "array<int, string>"\. The "string" type is expected \- see https\://dibiphp\.com/en/documentation\#toc\-modifiers\-for\-arrays#'
|
|
path: rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php #35
|
|
|
|
# PropertyFetches inside method are different
|
|
-
|
|
message: '#Content of method "processGreater(Left|Right)\(\)" is duplicated with method "processGreaterOrEqual(Left|Right)\(\)" in "Rector\\DeadCode\\Rector\\ConstFetch\\RemovePhpVersionIdCheckRector" class\. Use unique content or service instead#'
|
|
path: rules/DeadCode/Rector/ConstFetch/RemovePhpVersionIdCheckRector.php
|
|
|
|
-
|
|
message: '#Instead of "DateTime" class/interface use "Nette\\Utils\\DateTime"#'
|
|
path: src/Application/VersionResolver.php
|
|
|
|
-
|
|
message: '#Class cognitive complexity is 55, keep it under 50#'
|
|
path: src/PhpParser/Printer/BetterStandardPrinter.php #41
|
|
|
|
# trust in 3rd party api
|
|
- '#Parameter \#1 \$indentStyle of method Rector\\FileFormatter\\ValueObjectFactory\\EditorConfigConfigurationBuilder\:\:withIndentStyle\(\) expects (.*?) string given#'
|
|
|
|
# list() function accepts null arguments
|
|
- '#Parameter \#2 \$args of class PhpParser\\Node\\Expr\\FuncCall constructor expects array<PhpParser\\Node\\Arg\|PhpParser\\Node\\VariadicPlaceholder>, array<int, PhpParser\\Node\\Arg\|null> given#'
|
|
|
|
# validate class-string input
|
|
-
|
|
message: '#Call to static method Webmozart\\Assert\\Assert\:\:(.*?)\(\) with (.*?) will always evaluate to (false|true)#'
|
|
path: packages/Config/RectorConfig.php
|