diff --git a/phpstan.neon b/phpstan.neon index fb16736e642..f39ec55eb37 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -10,7 +10,7 @@ services: - phpstan.broker.dynamicMethodReturnTypeExtension parameters: - # reportUnmatchedIgnoredErrors: false + reportUnmatchedIgnoredErrors: false cognitive_complexity: class: 50 @@ -24,6 +24,7 @@ parameters: paths: - rector.php - bin + - config - src - rules - packages @@ -33,8 +34,6 @@ parameters: - rules-tests - utils - utils-tests - # this cannot be put it, because it wipes PHPStan cache on each run :( - must run in separate - #- config scanDirectories: - stubs @@ -90,11 +89,6 @@ parameters: message: '#Access to an undefined property PhpParser\\Node\\Expr\:\:\$expr#' path: rules/DeadCode/NodeManipulator/LivingCodeManipulator.php - # 3rd party package - - - message: '#Array (with keys|destruct) is not allowed\. Use value object to pass data instead#' - path: rules/Php70/EregToPcreTransformer.php - # lack of generic array in nikic/php-parser - '#Method (.*?) should return array but returns array#' @@ -107,12 +101,6 @@ parameters: - '#Method (.*?) should return (.*?)\|null but returns PhpParser\\Node\|null#' - '#Method (.*?) should return array but returns array#' - - - message: '#\$this as argument is not allowed\. Refactor method to service composition#' - paths: - - src/Rector/AbstractRector.php - - src/PhpParser/AstResolver.php - - '#Property Rector\\Core\\PhpParser\\Node\\AssignAndBinaryMap\:\:\$binaryOpToAssignClasses \(array, class\-string\>\) does not accept array#' - @@ -134,11 +122,6 @@ parameters: - packages/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php - rules/Php70/EregToPcreTransformer.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 11#' - '#Cognitive complexity for "Rector\\NodeTypeResolver\\NodeTypeResolver\:\:getType\(\)" is \d+, keep it under 11#' @@ -275,10 +258,6 @@ parameters: - '#Callable callable\(PHPStan\\Type\\Type\)\: PHPStan\\Type\\Type invoked with 2 parameters, 1 required#' - - - message: '#Make callable type explicit#' - path: src/NodeManipulator/BinaryOpManipulator.php - # stmts refactoring - '#Cognitive complexity for "Rector\\DeadCode\\Rector\\Assign\\RemoveDoubleAssignRector\:\:refactorWithScope\(\)" is \d+, keep it under 11#' @@ -433,11 +412,6 @@ parameters: message: '#Function "(.*?)\(\)" cannot be used/left in the code#' path: src/Util/Reflection/PrivatesAccessor.php - # for reflection - - - message: '#\$this as argument is not allowed\. Refactor method to service composition#' - path: packages/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php - - message: '#Offset \(int\|string\) on array in isset\(\) always exists and is not nullable#' path: packages/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php @@ -446,10 +420,6 @@ parameters: message: '#Method Rector\\Core\\Util\\ArrayParametersMerger\:\:mergeLeftToRightWithCallable\(\) has parameter \$mergeCallback with no signature specified for callable#' path: src/Util/ArrayParametersMerger.php - - - message: '#Make callable type explicit\. Here is how\: https\://phpstan\.org/writing\-php\-code/phpdoc\-types\#callables#' - path: src/Util/ArrayParametersMerger.php - # fixture class - '#Class "Rector\\Core\\Tests\\Issues\\ScopeNotAvailable\\Variable\\ArrayItemForeachValueRector" is missing @see annotation with test case class reference#' @@ -513,9 +483,6 @@ parameters: # useless - '#Parameter \#1 \$suffix of method PHPUnit\\Framework\\Assert\:\:assertStringEndsWith\(\) expects non\-empty\-string, string given#' - # reported in configs - - '#Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\service not found#' - - message: '#Function "function_exists\(\)" cannot be used/left in the code#' path: src/functions/node_helper.php @@ -532,11 +499,6 @@ parameters: - '#Call to deprecated method getDirectClassNames\(\) of class PHPStan\\Type\\TypeUtils.*#' - '#Parameter 3 should use "PHPStan\\Reflection\\ParameterReflectionWithPhpDocs" type as the only type passed to this method#' - # actually used in global scope - - - message: '#Anonymous function has an unused use \$container#' - path: src/Autoloading/BootstrapFilesIncluder.php - # false positive on enums - '#Method Rector\\Core\\Console\\Command\\SetupCICommand\:\:resolveCurrentCI\(\) never returns (.*?) so it can be removed from the return type#' @@ -559,9 +521,6 @@ parameters: - '#Access to an undefined property PhpParser\\Node\\Stmt\\ClassLike\|PhpParser\\Node\\Stmt\\Declare_\|Rector\\Core\\Contract\\PhpParser\\Node\\StmtsAwareInterface\:\:\$stmts#' - '#Access to an undefined property \(PhpParser\\Node\\Stmt&Rector\\Core\\Contract\\PhpParser\\Node\\StmtsAwareInterface\)\|PhpParser\\Node\\Stmt\\ClassLike\|PhpParser\\Node\\Stmt\\Declare_\:\:\$stmts#' - # WIP - - '#Return type \(int\|PhpParser\\Node\\Expr\\FuncCall\|PhpParser\\Node\\Expr\\Ternary\|null\) of method Rector\\Php71\\Rector\\FuncCall\\CountOnNullRector\:\:refactorWithScope\(\) should be covariant with return type \(1\|2\|3\|4\|array\|PhpParser\\Node\|null\) of method Rector\\Core\\Contract\\Rector\\ScopeAwarePhpRectorInterface\:\:refactorWithScope\(\)#' - # looks like a bug in the PHPStan rule, see /~https://github.com/rectorphp/rector-src/pull/3645#issuecomment-1561294527 - message: '#Method name "(get|has|set)Attribute\(\)" is used in multiple traits\. Make it unique to avoid conflicts#' @@ -638,10 +597,6 @@ parameters: message: '#Fetching class constant class of deprecated class Rector\\Core\\Contract\\Rector\\NonPhpRectorInterface#' path: packages/Config/* - - - message: '#Make callable type explicit\. Here is how\: https\://phpstan\.org/writing\-php\-code/phpdoc\-types\#callables#' - path: packages/Config/RectorConfig.php - # method signature kept for symmetry of hasParentClassMethod() with getParentClassMethod() - message: '#Parameters should use "PhpParser\\Node\\Stmt\\ClassMethod" types as the only types passed to this method#'