rector/phpstan.neon

109 lines
7.2 KiB
Plaintext

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:
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/*'
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#'
# 0.10.2
# false positives & ->toString() methods
- '#Cannot cast PhpParser\\Node\\Expr\|string to string#' # 8
- '#Offset string does not exist on string#' # 1
- '#Cannot cast PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Identifier to string#'
- '#Cannot cast PhpParser\\Node\\Expr\|PhpParser\\Node\\Identifier to string#' # 4
- '#Cannot cast PhpParser\\Node\\Expr\|PhpParser\\Node\\Name to string#'
- '#Array \(array<array<PhpParser\\Node\\Stmt>>\) does not accept array<PhpParser\\Node\\Stmt|null>#'
- '#Property Rector\\DependencyInjection\\Loader\\RectorServiceParametersShifter::\$serviceKeywords \(array<string>\) does not accept ReflectionProperty#'
# already fixed, invalidated cache?
- '#Access to an undefined property PhpParser\\Node\\Expr::\$args#'
# nette container
- '#Method Rector\\NodeTypeResolver\\DependencyInjection\\PHPStanServicesFactory::create(.*?)() should return (.*?) but returns object#'
# false postive - type is set by annotatoin above
- '#Access to an undefined property PhpParser\\Node::\$(args|var)#'
- '#Method Rector\\Php\\Rector\\TryCatch\\MultiExceptionCatchRector\:\:collectCatchKeysByContent\(\) should return array<array<int\>\> but returns array<string, array<int, int\|string\>\>#'
# irelevant
- '#Call to function in_array\(\) with arguments string, array<array<string\|false>> and true will always evaluate to false#'
# known values
- '#Array \(array<PhpParser\\Node\\Expr\\MethodCall>\) 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#'
# Error php-parser token
- '#Access to an undefined property PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable::\$name#'
# false positive, has annotation type above
- '#Access to an undefined property PhpParser\\Node::\$name#' # 11
- '#Access to an undefined property PhpParser\\Node\\Expr::\$expr#'
# 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<Rector\\Contract\\RectorDefinition\\CodeSampleInterface>, array<int, stdClass> given#' # 1
# invalid interface type resolution
- '#Method Rector\\NodeTraverser\\RectorNodeTraverser::getRectors\(\) should return array<Rector\\Contract\\Rector\\PhpRectorInterface> but returns array<PhpParser\\NodeVisitor>#' # 1
# known values
- '#Access to an undefined property PHPStan\\PhpDocParser\\Ast\\Node::\$name#' # 2
- '#Cannot access property \$value on PhpParser\\Node\\Expr\\ArrayItem\|null#'
- '#Method Rector\\Node\\NodeFactory::createNullConstant\(\) should return PhpParser\\Node\\Expr\\ConstFetch but returns PhpParser\\Node\\Expr#' # 1
- '#Method Rector\\Node\\NodeFactory::createNamespace\(\) should return PhpParser\\Node\\Stmt\\Namespace_ 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<PhpParser\\Node\\Stmt\\Use_>\) does not accept array<PhpParser\\Node>#' # 1
- '#Parameter \#1 \$node of method Rector\\NodeTypeResolver\\NodeTypeResolver::resolve\(\) expects PhpParser\\Node, PhpParser\\Node\\Expr|string given#' # 3
# buggy
- '#Access to an undefined property PhpParser\\Node\\Expr::\$value#' # 2
- '#Access to an undefined property PhpParser\\Node\\Expr::\$(name|var)#' # 2
- '#Access to an undefined property PhpParser\\Node\\Stmt::\$expr#'
- '#Binary operation "\+" between int\|string and 1 results in an error#'
# 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\\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#'
# incorrect 3rd party code typehinting
- '#Instanceof between PhpParser\\Node\\Expr and PhpParser\\Node\\Identifier will always evaluate to false#'
services:
-
class: Symplify\PHPStanExtensions\Type\SplFileInfoTolerantDynamicMethodReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension