diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 1b855cdb..32145249 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v4 - uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.5 coverage: none - run: composer install --no-progress --prefer-dist diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index dd03b4fa..057960bb 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,121 +1,295 @@ parameters: ignoreErrors: - - message: '#^Match expression does not handle remaining value\: true$#' + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Attribute \.\.\.\$attrs\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 path: src/PhpGenerator/ClassLike.php - - message: '#^Method Nette\\PhpGenerator\\ClassType\:\:addTrait\(\) has parameter \$deprecatedParam with no value type specified in iterable type array\.$#' + message: '#^Parameter \#1 \$class of method Nette\\PhpGenerator\\Printer\:\:printClass\(\) expects Nette\\PhpGenerator\\ClassType\|Nette\\PhpGenerator\\EnumType\|Nette\\PhpGenerator\\InterfaceType\|Nette\\PhpGenerator\\TraitType, \$this\(Nette\\PhpGenerator\\ClassLike\) given\.$#' + identifier: argument.type + count: 1 + path: src/PhpGenerator/ClassLike.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Constant \.\.\.\$consts\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/ClassType.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Method \.\.\.\$methods\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/ClassType.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Property \.\.\.\$props\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/ClassType.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\TraitUse \.\.\.\$traits\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 path: src/PhpGenerator/ClassType.php - - message: '#^Method Nette\\PhpGenerator\\EnumType\:\:addTrait\(\) has parameter \$deprecatedParam with no value type specified in iterable type array\.$#' + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Attribute \.\.\.\$attrs\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/Closure.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Parameter \.\.\.\$uses\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/Closure.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Parameter \.\.\.\$val\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/Closure.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Attribute \.\.\.\$attrs\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/Constant.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Attribute \.\.\.\$attrs\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/EnumCase.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Constant \.\.\.\$consts\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 path: src/PhpGenerator/EnumType.php - - message: '#^Access to an undefined property PhpParser\\Node\:\:\$attrGroups\.$#' + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\EnumCase \.\.\.\$cases\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 - path: src/PhpGenerator/Extractor.php + path: src/PhpGenerator/EnumType.php - - message: '#^Access to an undefined property PhpParser\\Node\\Expr\:\:\$value\.$#' + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Method \.\.\.\$methods\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 - path: src/PhpGenerator/Extractor.php + path: src/PhpGenerator/EnumType.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\TraitUse \.\.\.\$traits\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/EnumType.php - message: '#^Call to an undefined method Nette\\PhpGenerator\\ClassLike\:\:addConstant\(\)\.$#' + identifier: method.notFound count: 1 path: src/PhpGenerator/Extractor.php - message: '#^Call to an undefined method Nette\\PhpGenerator\\ClassLike\:\:addMethod\(\)\.$#' + identifier: method.notFound count: 1 path: src/PhpGenerator/Extractor.php - message: '#^Call to an undefined method Nette\\PhpGenerator\\ClassLike\:\:addProperty\(\)\.$#' + identifier: method.notFound count: 1 path: src/PhpGenerator/Extractor.php - message: '#^Call to an undefined method Nette\\PhpGenerator\\ClassLike\:\:addTrait\(\)\.$#' + identifier: method.notFound count: 1 path: src/PhpGenerator/Extractor.php - - message: '#^Method Nette\\PhpGenerator\\Extractor\:\:addCommentAndAttributes\(\) has parameter \$element with no type specified\.$#' + message: '#^Call to function method_exists\(\) with PhpParser\\Node\\Stmt\\ClassConst and ''isFinal'' will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType count: 1 path: src/PhpGenerator/Extractor.php - - message: '#^Property class@anonymous/PhpGenerator/Extractor\.php\:176\:\:\$callback has no type specified\.$#' + message: '#^Call to function method_exists\(\) with PhpParser\\Node\\Stmt\\Class_ and ''isReadonly'' will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType count: 1 path: src/PhpGenerator/Extractor.php - - message: '#^Variable \$trait might not be defined\.$#' - count: 2 + message: '#^Call to function method_exists\(\) with PhpParser\\Node\\Stmt\\Property and ''isReadonly'' will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 1 path: src/PhpGenerator/Extractor.php - - message: '#^Call to an undefined method ReflectionClass\\:\:hasCase\(\)\.$#' + message: '#^Parameter \#1 \$class of method Nette\\PhpGenerator\\Extractor\:\:addEnumCaseToClass\(\) expects Nette\\PhpGenerator\\EnumType, Nette\\PhpGenerator\\ClassLike given\.$#' + identifier: argument.type count: 1 - path: src/PhpGenerator/Factory.php + path: src/PhpGenerator/Extractor.php + + - + message: '#^Variable \$class might not be defined\.$#' + identifier: variable.undefined + count: 3 + path: src/PhpGenerator/Extractor.php - - message: '#^Elseif branch is unreachable because previous condition is always true\.$#' + message: '#^Variable \$trait might not be defined\.$#' + identifier: variable.undefined count: 1 - path: src/PhpGenerator/Factory.php + path: src/PhpGenerator/Extractor.php - message: '#^Method Nette\\PhpGenerator\\Factory\:\:getAttributes\(\) has parameter \$from with no type specified\.$#' + identifier: missingType.parameter count: 1 path: src/PhpGenerator/Factory.php - - message: '#^Method Nette\\PhpGenerator\\Factory\:\:getAttributes\(\) return type has no value type specified in iterable type array\.$#' + message: '#^Variable \$bodies on left side of \?\?\= always exists and is not nullable\.$#' + identifier: nullCoalesce.variable count: 1 path: src/PhpGenerator/Factory.php - - message: '#^Method Nette\\PhpGenerator\\Factory\:\:getExtractor\(\) has parameter \$from with no type specified\.$#' + message: '#^Variable \$cache on left side of \?\?\= always exists and is not nullable\.$#' + identifier: nullCoalesce.variable count: 1 path: src/PhpGenerator/Factory.php - - message: '#^Method Nette\\PhpGenerator\\Factory\:\:getVisibility\(\) has parameter \$from with no type specified\.$#' + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Attribute \.\.\.\$attrs\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 - path: src/PhpGenerator/Factory.php + path: src/PhpGenerator/GlobalFunction.php - - message: '#^Parameter \#1 \$name of method Nette\\PhpGenerator\\ClassType\:\:setExtends\(\) expects string\|null, array\ given\.$#' + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Parameter \.\.\.\$val\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 - path: src/PhpGenerator/Factory.php + path: src/PhpGenerator/GlobalFunction.php - - message: '#^Unreachable statement \- code above always terminates\.$#' + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Constant \.\.\.\$consts\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 - path: src/PhpGenerator/Factory.php + path: src/PhpGenerator/InterfaceType.php - - message: '#^Variable \$bodies on left side of \?\?\= always exists and is not nullable\.$#' + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Method \.\.\.\$methods\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 - path: src/PhpGenerator/Factory.php + path: src/PhpGenerator/InterfaceType.php - - message: '#^Method Nette\\PhpGenerator\\Helpers\:\:formatArgs\(\) has parameter \$args with no value type specified in iterable type array\.$#' + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Property \.\.\.\$props\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 - path: src/PhpGenerator/Helpers.php + path: src/PhpGenerator/InterfaceType.php - - message: '#^Method Nette\\PhpGenerator\\Method\:\:from\(\) has parameter \$method with no value type specified in iterable type array\.$#' + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Attribute \.\.\.\$attrs\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 path: src/PhpGenerator/Method.php - - message: '#^Method Nette\\PhpGenerator\\TraitType\:\:addTrait\(\) has parameter \$deprecatedParam with no value type specified in iterable type array\.$#' + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Parameter \.\.\.\$val\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/Method.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Attribute \.\.\.\$attrs\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/Parameter.php + + - + message: '#^Instanceof between Nette\\PhpGenerator\\EnumType and Nette\\PhpGenerator\\EnumType will always evaluate to true\.$#' + identifier: instanceof.alwaysTrue + count: 1 + path: src/PhpGenerator/Printer.php + + - + message: '#^Method Nette\\PhpGenerator\\Printer\:\:printDocComment\(\) has parameter \$commentable with no type specified\.$#' + identifier: missingType.parameter + count: 1 + path: src/PhpGenerator/Printer.php + + - + message: '#^Parameter \#2 \$array of function implode expects array\, array\ given\.$#' + identifier: argument.type + count: 2 + path: src/PhpGenerator/Printer.php + + - + message: '#^Result of \|\| is always true\.$#' + identifier: booleanOr.alwaysTrue + count: 1 + path: src/PhpGenerator/Printer.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\PropertyHook \.\.\.\$hooks\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/PromotedParameter.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Attribute \.\.\.\$attrs\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/Property.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\PropertyHook \.\.\.\$hooks\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/Property.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Attribute \.\.\.\$attrs\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/PropertyHook.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Parameter \.\.\.\$val\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/PropertyHook.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Constant \.\.\.\$consts\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/TraitType.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Method \.\.\.\$methods\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/TraitType.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\Property \.\.\.\$props\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: src/PhpGenerator/TraitType.php + + - + message: '#^Expression "\(function \(\\Nette\\PhpGenerator\\TraitUse \.\.\.\$traits\) \{…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused count: 1 path: src/PhpGenerator/TraitType.php