includes: - 'vendor/symplify/phpstan-extensions/config/config.neon' - 'vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon' - 'vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon' parameters: # to allow intalling with various phsptan versions without reporting old errors here reportUnmatchedIgnoredErrors: false excludes_analyse: # test files - '*packages/NodeTypeResolver/tests/Source/AnotherClass.php' - '*tests/Rector/MethodCall/MethodNameReplacerRector/**/SomeClass.php' - '*packages/BetterReflection/tests/Reflector/NotLoadedSource/SomeClass.php' - 'packages/NodeTypeResolver/tests/PerNodeTypeResolver/VariableTypeResolver/Source/NewClass.php' # tests files - '*tests/**/Wrong/*' - '*tests/**/Correct/*' - '*tests/**/Source/*' # intetionally original - 'packages/Php/src/EregToPcreTransformer.php' - '*/packages/ContributorTools/templates/*' # part of composer - 'tests/Composer/AutoloadWrongCasesEventSubscriber.php' ignoreErrors: # missuse of interface and class - '#Parameter \#1 (.*?) expects Symfony\\Component\\DependencyInjection\\ContainerBuilder, Symfony\\Component\\DependencyInjection\\ContainerInterface given#' # 2 - '#Method Rector\\Symfony\\Bridge\\DefaultAnalyzedSymfonyApplicationContainer::getContainer\(\) should return Symfony\\Component\\DependencyInjection\\ContainerBuilder but returns Symfony\\Component\\DependencyInjection\\Container#' # 1 - '#(.*?)\(\) should return Psr\\Container\\ContainerInterface but returns Symfony\\Component\\DependencyInjection\\ContainerInterface\|null#' # false positives - '#In method "Rector\\Rector\\AbstractRector::(.*?)", parameter \$(.*?) has no type-hint and no \@param annotation#' - '#Offset string does not exist on string#' # 1 - '#Array \(array>\) does not accept array#' - '#Property Rector\\DependencyInjection\\Loader\\RectorServiceParametersShifter::\$serviceKeywords \(array\) does not accept ReflectionProperty#' - '#Strict comparison using === between string and null will always evaluate to false#' # nette container - '#Method Rector\\NodeTypeResolver\\DependencyInjection\\PHPStanServicesFactory::create(.*?)() should return (.*?) but returns object#' # false postive - type is set by annotatoin above - '#Method Rector\\Php\\Rector\\TryCatch\\MultiExceptionCatchRector\:\:collectCatchKeysByContent\(\) should return array\> but returns array\>#' - '#Method Rector\\NodeTypeResolver\\PhpDoc\\NodeAnalyzer\\DocBlockAnalyzer::getTagByName\(\) should return PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode but returns PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode\|null#' # irelevant - '#Call to function in_array\(\) with arguments string, (.*?) and true will always evaluate to false#' # known values # - '#Call to an undefined method PhpParser\\Node\\Expr|PhpParser\\Node\\Name|PhpParser\\Node\\Stmt\\Class_::toString\(\)#' - '#Method Rector\\ContributorTools\\Configuration\\ConfigurationFactory::resolveCategoryFromFqnNodeTypes\(\) should return string but returns string\|false#' - '#Array \(array\) does not accept PhpParser\\Node\\Expr#' - '#Cannot access property \$expr on PhpParser\\Node\\Stmt\|null#' - '#Access to an undefined property PhpParser\\Node\\Expr\\MethodCall\|PhpParser\\Node\\Stmt\\ClassMethod::\$params#' - '#Cannot call method getName\(\) on PHPStan\\Reflection\\ClassReflection\|null#' # 1 - '#Parameter \#1 \$classReflection of method Rector\\NodeTypeResolver\\Reflection\\ClassReflectionTypesResolver::resolve\(\) expects PHPStan\\Reflection\\ClassReflection, PHPStan\\Reflection\\ClassReflection|null given#' - '#Cannot call method getAttribute\(\) on PhpParser\\Node\\Name\|null#' - '#Cannot call method getText\(\) on PhpParser\\Comment\\Doc\|null#' # false positive, has annotation type above - '#Parameter \#1 \$node of method Rector\\PHPUnit\\Rector\\Foreach_\\SimplifyForeachInstanceOfRector\:\:resolveVar\(\) expects PhpParser\\Node\\Expr\\MethodCall\|PhpParser\\Node\\Expr\\StaticCall, PhpParser\\Node given#' # - '#Access to an undefined property PhpParser\\Node::\$name#' # 11 - '#Access to an undefined property PhpParser\\Node\\Expr::\$expr#' - '#Method Rector\\CodeQuality\\Rector\\Foreach_\\SimplifyForeachToCoalescingRector\:\:matchReturnOrAssignNode\(\) should return PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Stmt\\Return_\|null but returns PhpParser\\Node\|null#' # false positive, resolved in previous method - '#Parameter (.*?) of method Rector\\PhpParser\\Node\\Builder\\IdentifierRenamer\:\:(.*?)\(\) expects PhpParser\\Node\\Expr\\ClassConstFetch\|PhpParser\\Node\\Expr\\MethodCall\|PhpParser\\Node\\Expr\\PropertyFetch\|PhpParser\\Node\\Expr\\StaticCall\|PhpParser\\Node\\Stmt\\ClassMethod, PhpParser\\Node given#' # subtype - '#Property PhpParser\\Node\\Param::\$type \(PhpParser\\Node\\Name|PhpParser\\Node\\NullableType\|string\|null\) does not accept PhpParser\\Node\\Identifier|PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType#' # 3 # intentionally incorrect - part of the test - '#Parameter \#2 \$codeSamples of class Rector\\RectorDefinition\\RectorDefinition constructor expects array, array given#' # 1 # invalid interface type resolution - '#Method Rector\\PhpParser\\NodeTraverser\\RectorNodeTraverser::getRectors\(\) should return array but returns array#' # 1 # known values - '#Access to an undefined property PHPStan\\PhpDocParser\\Ast\\Node::\$name#' # 2 - '#Cannot access property \$value on PhpParser\\Node\\Expr\\ArrayItem\|null#' # use of 3rd party factory that returns general type - '#Method Rector\\Node\\NodeFactory::(.*?)\(\) should return PhpParser\\Node\\(.*?) but returns PhpParser\\Node(.*?)#' # 1 - '#Method Rector\\Utils\\BetterNodeFinder::findFirstAncestorInstanceOf\(\) should return PhpParser\\Node\|null but returns object#' # 1 - '#Property Rector\\NodeTypeResolver\\NodeVisitor\\NamespaceNodeVisitor::\$useNodes \(array\) does not accept array#' # 1 # ...variadic false positive - '#In method "Rector\\Node\\NodeFactory::createArray", parameter \$items can be type-hinted to "array"#' - '#In method (.*?) type is "array". Please provide a \@(param|return) annotation to further specify the type of the array. For instance: \@(param|return) int\[\]#' # not really needed, empty - '#Rector\\PhpParser\\NodeTraverser\\RectorNodeTraverser::__construct\(\) does not call parent constructor from PhpParser\\NodeTraverser#' # intentionally - '#In method "(.*?)", caught "Throwable" must be rethrown. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception#' services: - class: Symplify\PHPStanExtensions\Type\SplFileInfoTolerantDynamicMethodReturnTypeExtension tags: - phpstan.broker.dynamicMethodReturnTypeExtension