mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
226 lines
16 KiB
YAML
226 lines
16 KiB
YAML
includes:
|
|
- 'utils/PHPStanExtensions/config/phpstan-extensions.neon'
|
|
- 'vendor/symplify/phpstan-extensions/config/config.neon'
|
|
- 'vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon'
|
|
- 'vendor/phpstan/phpstan/conf/bleedingEdge.neon'
|
|
|
|
parameters:
|
|
checkGenericClassInNonGenericObjectType: false
|
|
level: max
|
|
|
|
# to allow installing with various phsptan versions without reporting old errors here
|
|
reportUnmatchedIgnoredErrors: false
|
|
|
|
autoload_directories:
|
|
- stubs
|
|
- compiler/src
|
|
|
|
excludes_analyse:
|
|
- "*/Expected/*"
|
|
# complex printer
|
|
- "packages/ContributorTools/src/Command/DumpNodesCommand.php"
|
|
- "utils/phpstan/generate-paths.php"
|
|
# test files
|
|
- '*packages/NodeTypeResolver/tests/Source/AnotherClass.php'
|
|
- '*tests/Rector/MethodCall/RenameMethodRector/**/SomeClass.php'
|
|
- '*packages/BetterReflection/tests/Reflector/NotLoadedSource/SomeClass.php'
|
|
- 'packages/NodeTypeResolver/tests/PerNodeTypeResolver/VariableTypeResolver/Source/NewClass.php'
|
|
# tests files
|
|
- '*tests/*/Fixture/*'
|
|
- '*tests/*/Source/*'
|
|
- '*tests/Source/*'
|
|
- 'packages/NodeTypeResolver/tests/Source/SomeClass.php'
|
|
# intentionally original
|
|
- 'packages/Php70/src/EregToPcreTransformer.php'
|
|
- '*/packages/ContributorTools/templates/*'
|
|
# part of composer
|
|
- 'tests/Composer/AutoloadWrongCasesEventSubscriber.php'
|
|
- '*/tests/Rector/Psr4/MultipleClassFileToPsr4ClassesRector/Expected/Just*ExceptionWithoutNamespace.php'
|
|
# stubs
|
|
- 'stubs/*'
|
|
|
|
ignoreErrors:
|
|
# false positive
|
|
# - '#Call to function method_exists\(\) with string and (.*?) will always evaluate to false#'
|
|
- '#PHPDoc tag \@param for parameter \$node with type float is incompatible with native type PhpParser\\Node#'
|
|
|
|
# misuse of interface and class
|
|
- '#Parameter \#1 (.*?) expects Symfony\\Component\\DependencyInjection\\ContainerBuilder, Symfony\\Component\\DependencyInjection\\ContainerInterface given#'
|
|
- '#Strict comparison using === between string and null will always evaluate to false#'
|
|
|
|
# false positive - type is set by annotation above
|
|
- '#Array \(array<PhpParser\\Node\\Stmt>\) does not accept PhpParser\\Node#'
|
|
- '#Method Rector\\NodeTypeResolver\\PhpDoc\\NodeAnalyzer\\DocBlockManipulator::getTagByName\(\) should return PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode but returns PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode\|null#'
|
|
- '#Parameter \#1 \$node of method Rector\\PhpParser\\Node\\Commander\\NodeAddingCommander::wrapToExpression\(\) expects PhpParser\\Node\\Expr\|PhpParser\\Node\\Stmt, PhpParser\\Node given#'
|
|
|
|
# irrelevant
|
|
- '#Call to function in_array\(\) with arguments string, (.*?) and true will always evaluate to false#'
|
|
|
|
# known values
|
|
- '#Access to an undefined property PhpParser\\Node\\Expr::\$left#'
|
|
- '#Access to an undefined property PhpParser\\Node\\Expr::\$right#'
|
|
|
|
- '#Access to an undefined property PhpParser\\Node\\Expr\\MethodCall\|PhpParser\\Node\\Stmt\\ClassMethod::\$params#'
|
|
- '#Cannot call method getName\(\) on PHPStan\\Reflection\\ClassReflection\|null#'
|
|
|
|
- '#Cannot call method getText\(\) on PhpParser\\Comment\\Doc\|null#'
|
|
|
|
# false positive, has annotation type above
|
|
- '#Method Rector\\CodeQuality\\Rector\\Foreach_\\SimplifyForeachToCoalescingRector\:\:matchReturnOrAssignNode\(\) should return PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Stmt\\Return_\|null but returns PhpParser\\Node\|null#'
|
|
- '#Access to an undefined property PhpParser\\Node::\$(\w+)#'
|
|
|
|
# false positive, resolved in previous method
|
|
- '#Parameter (.*?) of method Rector\\PhpParser\\Node\\Manipulator\\IdentifierManipulator\:\:(.*?)\(\) expects PhpParser\\Node\\Expr\\ClassConstFetch\|PhpParser\\Node\\Expr\\MethodCall\|PhpParser\\Node\\Expr\\PropertyFetch\|PhpParser\\Node\\Expr\\StaticCall\|PhpParser\\Node\\Stmt\\ClassMethod, PhpParser\\Node given#'
|
|
|
|
# intentionally incorrect - part of the test
|
|
- '#Parameter \#2 \$codeSamples of class Rector\\RectorDefinition\\RectorDefinition constructor expects array<Rector\\Contract\\RectorDefinition\\CodeSampleInterface>, array<int, stdClass> given#'
|
|
|
|
# known values
|
|
- '#Cannot access property \$value on PhpParser\\Node\\Expr\\ArrayItem\|null#'
|
|
- '#Method Rector\\Symfony\\Rector\\New_\\StringToArrayArgumentProcessRector::findPreviousNodeAssign\(\) should return PhpParser\\Node\\Expr\\Assign\|null but returns PhpParser\\Node\|null#'
|
|
|
|
# known values
|
|
- '#Strict comparison using === between PhpParser\\Node\\Expr and null will always evaluate to false#'
|
|
|
|
# console argument/option
|
|
- '#Cannot cast array<string\>\|string\|null to string#'
|
|
|
|
- '#Parameter \#1 \$nodes of method Rector\\PhpParser\\Node\\BetterNodeFinder\:\:find\(\) expects array<PhpParser\\Node\>\|PhpParser\\Node, array<PhpParser\\Node\\Stmt\>\|null given#'
|
|
- '#Method Rector\\NetteToSymfony\\Rector\\ClassMethod\\RouterListToControllerAnnotationsRector\:\:resolveAssignRouteNodes\(\) should return array<PhpParser\\Node\\Expr\\Assign\> but returns array<PhpParser\\Node\>#'
|
|
- '#Access to an undefined property PhpParser\\Node\\Stmt\:\:\$expr#'
|
|
- '#Cannot access property \$stmts on PhpParser\\Node\\Stmt\\Else_\|null#'
|
|
|
|
# node finder
|
|
- '#Method Rector\\(.*?) should return array<PhpParser\\Node\\(.*?)> but returns array<PhpParser\\Node\>#'
|
|
|
|
# known values
|
|
- '#Parameter \#2 \$variableName of class Rector\\DeadCode\\Data\\VariableNodeUseInfo constructor expects string, string\|null given#'
|
|
- '#Cannot call method getParentNode\(\) on Rector\\DeadCode\\Data\\VariableNodeUseInfo\|null#'
|
|
|
|
# part of test
|
|
- '#(.*?)(AttributeAwareNodeInterface|AttributeAware(.*?)TagValueNode)(.*?)#'
|
|
|
|
- '#Call to an undefined method PHPStan\\PhpDocParser\\Ast\\PhpDoc\\(.*?)\:\:getAttribute\(\)#'
|
|
- '#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#'
|
|
- '#Method Rector\\PHPUnit\\Rector\\MethodCall\\ReplaceAssertArraySubsetRector\:\:matchArray\(\) should return PhpParser\\Node\\Expr\\Array_\|null but returns PhpParser\\Node\\Expr#'
|
|
|
|
- '#(.*?)PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable given#'
|
|
|
|
# false positive 0.11.5
|
|
- '#Unreachable statement \- code above always terminates#'
|
|
- '#Negated boolean expression is always true#'
|
|
- '#Strict comparison using \=\=\= between PhpParser\\Node and null will always evaluate to false#'
|
|
|
|
# known types
|
|
- '#Method Rector\\NodeContainer\\ParsedNodesByType\:\:(.*?)\(\) should return PhpParser\\Node\\Stmt\\(.*?)\|null but returns PhpParser\\Node\|null#'
|
|
- '#Method Rector\\NodeContainer\\ParsedNodesByType\:\:findImplementersOfInterface\(\) should return array<PhpParser\\Node\\Stmt\\Interface_\> but returns array<int, PhpParser\\Node\>#'
|
|
- '#Access to an undefined property PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable\:\:\$name#'
|
|
- '#Strict comparison using \=\=\= between PhpParser\\Node\\Expr\\ArrayItem and null will always evaluate to false#'
|
|
- '#Parameter \#2 \.\.\.\$args of function array_merge expects array, array<int, string\>\|false given#'
|
|
- '#Access to an undefined property PhpParser\\Node\\Expr\:\:\$args#'
|
|
|
|
- '#Parameter \#2 \$name of method Rector\\Rector\\AbstractRector\:\:isName\(\) expects string, string\|null given#'
|
|
# cascade irrelevant
|
|
- '#Parameter (.*?) expects array<PhpParser\\Node\\Stmt\>, array<PhpParser\\Node\> given#'
|
|
|
|
# known value
|
|
- '#Parameter \#1 \$node of method Rector\\Rector\\AbstractRector\:\:getName\(\) expects PhpParser\\Node, PhpParser\\Node\\Identifier\|null given#'
|
|
- '#Cannot cast array<string\>\|bool\|string\|null to string#'
|
|
- '#Method Rector\\Legacy\\Rector\\ClassMethod\\ChangeSingletonToServiceRector\:\:matchStaticPropertyFetchAndGetSingletonMethodName\(\) should return array<string\>\|null but returns array<int, string\|null\>#'
|
|
|
|
- '#Method Rector\\Rector\\AbstractRector\:\:wrapToArg\(\) should return array<PhpParser\\Node\\Arg\> but returns array<PhpParser\\Node\\Arg\|PhpParser\\Node\\Expr\>#'
|
|
- '#Parameter \#2 \$currentNode of method Rector\\CodingStyle\\Rector\\String_\\ManualJsonStringToJsonEncodeArrayRector\:\:matchNextExpressionAssignConcatToSameVariable\(\) expects PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Expr\\AssignOp\\Concat, PhpParser\\Node given#'
|
|
- '#Method Rector\\FileSystemRector\\Rector\\AbstractFileSystemRector\:\:wrapToArg\(\) should return array<PhpParser\\Node\\Arg\> but returns array<PhpParser\\Node\\Arg\|PhpParser\\Node\\Expr\>#'
|
|
|
|
# array is callable
|
|
- '#If condition is always true#'
|
|
|
|
- '#Ternary operator condition is always true#'
|
|
|
|
- '#Call to function property_exists\(\) with string and (.*?) will always evaluate to false#'
|
|
- '#Access to an undefined property PhpParser\\Node\\FunctionLike\|PhpParser\\Node\\Stmt\\ClassLike\:\:\$stmts#'
|
|
|
|
- '#Property Rector\\TypeDeclaration\\TypeInferer\\(.*?)\:\:\$(.*?)TypeInferers \(array<Rector\\TypeDeclaration\\Contract\\TypeInferer\\(.*?)TypeInfererInterface\>\) does not accept array<Rector\\TypeDeclaration\\Contract\\TypeInferer\\PriorityAwareTypeInfererInterface\>#'
|
|
# sense-less errors
|
|
|
|
- '#Parameter \#1 \$functionLike of method Rector\\NodeTypeResolver\\PhpDoc\\NodeAnalyzer\\DocBlockManipulator\:\:getParamTypesByName\(\) expects PhpParser\\Node\\Expr\\Closure\|PhpParser\\Node\\Stmt\\ClassMethod\|PhpParser\\Node\\Stmt\\Function_, PhpParser\\Node\\FunctionLike given#'
|
|
|
|
# PHP 7.4 1_000 support
|
|
- '#Property PhpParser\\Node\\Scalar\\DNumber\:\:\$value \(float\) does not accept string#'
|
|
- '#Call to function is_string\(\) with float will always evaluate to false#'
|
|
|
|
- '#Parameter \#1 \$obj of function spl_object_hash expects object, PhpParser\\Comment\\Doc\|null given#'
|
|
|
|
- '#Method Rector\\Doctrine\\Rector\\MethodCall\\ChangeSetIdToUuidValueRector\:\:getSetUuidMethodCallOnSameVariable\(\) should return PhpParser\\Node\\Expr\\MethodCall\|null but returns PhpParser\\Node\|null#'
|
|
|
|
# bugs
|
|
- '#Parameter \#1 \$items of class PhpParser\\Node\\Expr\\Array_ constructor expects array<PhpParser\\Node\\Expr\\ArrayItem\>, array<PhpParser\\Node\\Expr\\ArrayItem\|null\> given#'
|
|
- '#Parameter \#1 \$sprintfFuncCall of method Rector\\PhpParser\\NodeTransformer\:\:transformSprintfToArray\(\) expects PhpParser\\Node\\Expr\\FuncCall, PhpParser\\Node given#'
|
|
- '#Method Rector\\BetterPhpDocParser\\Tests\\PhpDocParser\\OrmTagParser\\AbstractPhpDocInfoTest\:\:parseFileAndGetFirstNodeOfType\(\) should return PhpParser\\Node but returns PhpParser\\Node\|null#'
|
|
|
|
- '#Method Rector\\BetterPhpDocParser\\PhpDocNodeFactory\\JMS\\SerializerTypePhpDocNodeFactory::resolveTypeAnnotation\(\) should return JMS\\Serializer\\Annotation\\Type\|null but returns object\|null#'
|
|
|
|
# known value
|
|
- '#Method Rector\\StrictCodeQuality\\Rector\\Stmt\\VarInlineAnnotationToAssertRector\:\:findVariableByName\(\) should return PhpParser\\Node\\Expr\\Variable\|null but returns PhpParser\\Node\|null#'
|
|
|
|
- '#Method Rector\\PhpParser\\Node\\Manipulator\\MethodCallManipulator\:\:findAssignToVariableName\(\) should return PhpParser\\Node\\Expr\\Assign\|null but returns PhpParser\\Node\|null#'
|
|
- '#Method Rector\\PhpParser\\Node\\Manipulator\\MethodCallManipulator\:\:findMethodCallsIncludingChain\(\) should return array<PhpParser\\Node\\Expr\\MethodCall\> but returns array<object\>#'
|
|
- '#Method Rector\\NodeTypeResolver\\PHPStan\\Type\\TypeFactory\:\:createUnionOrSingleType\(\) should return PHPStan\\Type\\MixedType\|PHPStan\\Type\\UnionType but returns PHPStan\\Type\\Type#'
|
|
|
|
#phpstan seems to be missing the entire docblock, though it's there
|
|
- '#.*keepLivingCodeFromExpr.*#'
|
|
|
|
# wrong deduction
|
|
- '#Parameter \#1 \$nodes of method Rector\\PhpParser\\Node\\BetterNodeFinder\:\:find\(\) expects array<PhpParser\\Node\>\|PhpParser\\Node, array<int, PhpParser\\Node\\Stmt\\Class_\|PhpParser\\Node\\Stmt\\Trait_\|null\> given#'
|
|
|
|
# test
|
|
- '#Class Rector\\DynamicTypeAnalysis\\Tests\\Rector\\ClassMethod\\AddArgumentTypeWithProbeDataRector\\Fixture\\SomeClass not found#'
|
|
|
|
# known value
|
|
- '#Parameter \#1 \$type of method PhpParser\\Builder\\Param\:\:setType\(\) expects PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|string, PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType given#'
|
|
|
|
-
|
|
message: '#Class Rector\\Tests\\Rector\\StaticCall\\SwapClassMethodArgumentsRector\\Fixture\\SomeClass not found#'
|
|
path: tests/Rector/StaticCall/SwapClassMethodArgumentsRector/SwapClassMethodArgumentsRectorTest.php
|
|
|
|
# mixed
|
|
- '#in iterable type Iterator#'
|
|
- '#with no typehint specified#'
|
|
- '#return type has no value type specified in iterable type array#'
|
|
- '#has no return typehint#'
|
|
- '#Offset int\|string\|null does not exist on array<PhpParser\\Node\\Stmt>\|null#'
|
|
- '#class-string<T of object>\|T of object#'
|
|
- '#with no value type specified in iterable type array#'
|
|
- '#type specified in iterable type (array|iterable)#'
|
|
|
|
# known values
|
|
- '#Offset 0 does not exist on array<PhpParser\\Node\\Stmt>\|null#'
|
|
- '#Parameter \#1 \$left of class PhpParser\\Node\\Expr\\BinaryOp\\Spaceship constructor expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|null given#'
|
|
- '#Parameter \#2 \$right of class PhpParser\\Node\\Expr\\BinaryOp\\Spaceship constructor expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|null given#'
|
|
- '#Parameter \#3 \$nodeCallback of method PHPStan\\Analyser\\NodeScopeResolver::processNodes\(\) expects Closure\(PhpParser\\Node, PHPStan\\Analyser\\Scope\): void, Closure\(PhpParser\\Node, PHPStan\\Analyser\\MutatingScope\): void given#'
|
|
|
|
# false positive
|
|
- '#Comparison operation "<" between 0 and 2 is always true#'
|
|
|
|
-
|
|
message: '#Method Rector\\Symfony\\Rector\\FrameworkBundle\\AbstractToConstructorInjectionRector\:\:getServiceTypeFromMethodCallArgument\(\) should return PHPStan\\Type\\Type but returns PHPStan\\Type\\Type\|null#'
|
|
path: packages/Symfony/src/Rector/FrameworkBundle/AbstractToConstructorInjectionRector.php
|
|
|
|
- '#Parameter \#1 \$error_handler of function set_error_handler expects \(callable\(int, string, string, int, array\)\: bool\)\|null, Closure\(int, string\)\: void given#'
|
|
|
|
- '#Method Rector\\BetterPhpDocParser\\PhpDocNodeFactory\\Gedmo\\(.*?)\:\:createFromNodeAndTokens\(\) should return Rector\\BetterPhpDocParser\\PhpDocNode\\Gedmo\\(.*?)\|null but returns PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode\|null#'
|
|
|
|
- '#Parameter \#1 \$expected of method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) expects class\-string<object\>, string given#'
|
|
- '#Unable to resolve the template type ExpectedType in call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\)#'
|
|
- '#Right side of \|\| is always false#'
|
|
|
|
# fix Symplify 7.2 later
|
|
- '#Method (.*?) returns bool type, so the name should start with is/has/was#'
|
|
|
|
# known value
|
|
- "#^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\\.$#"
|
|
- '#Cannot cast \(array<string\>\)\|string\|true to string#'
|
|
|
|
- '#In method "Rector\\BetterPhpDocParser\\AnnotationReader\\NodeAnnotationReader\:\:createPropertyReflectionFromPropertyNode", caught "Throwable" must be rethrown\. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception\. More info\: http\://bit\.ly/failloud#'
|
|
- '#Method Rector\\CakePHPToSymfony\\Rector\\Template\\TemplateMethodCallManipulator\:\:matchThisRenderMethodCallBareOrInReturn\(\) should return PhpParser\\Node\\Expr\\MethodCall\|null but returns PhpParser\\Node\\Expr#'
|