diff --git a/composer.json b/composer.json index a8e0084..4e99645 100644 --- a/composer.json +++ b/composer.json @@ -11,18 +11,17 @@ ], "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^1.12.5" + "phpstan/phpstan": "^2.0" }, "require-dev": { "editorconfig-checker/editorconfig-checker": "^10.6.0", "ergebnis/composer-normalize": "^2.28", "nette/neon": "^3.3.1", - "phpstan/phpstan-deprecation-rules": "^1.2", - "phpstan/phpstan-phpunit": "^1.4.0", - "phpstan/phpstan-strict-rules": "^1.6.0", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", "phpunit/phpunit": "^9.5.20", "shipmonk/composer-dependency-analyser": "^1.3.0", - "shipmonk/dead-code-detector": "^0.2.1", "shipmonk/name-collision-detector": "^2.0.0", "slevomat/coding-standard": "^8.0.1" }, diff --git a/composer.lock b/composer.lock index abc40cb..714d098 100644 --- a/composer.lock +++ b/composer.lock @@ -4,24 +4,24 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c9c06c7268b4ea221c6db80af3e0e396", + "content-hash": "22c70b8d99b1f04b78e44c990dde364f", "packages": [ { "name": "phpstan/phpstan", - "version": "1.12.5", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17" + "reference": "72115ab2bf1e40af1f9b238938d493ba7f3221e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", - "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/72115ab2bf1e40af1f9b238938d493ba7f3221e7", + "reference": "72115ab2bf1e40af1f9b238938d493ba7f3221e7", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -62,7 +62,7 @@ "type": "github" } ], - "time": "2024-09-26T12:45:22+00:00" + "time": "2024-11-11T07:06:55+00:00" } ], "packages-dev": [ @@ -933,24 +933,24 @@ }, { "name": "nette/schema", - "version": "v1.3.0", + "version": "v1.3.2", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188" + "reference": "da801d52f0354f70a638673c4a0f04e16529431d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", - "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", + "url": "https://api.github.com/repos/nette/schema/zipball/da801d52f0354f70a638673c4a0f04e16529431d", + "reference": "da801d52f0354f70a638673c4a0f04e16529431d", "shasum": "" }, "require": { "nette/utils": "^4.0", - "php": "8.1 - 8.3" + "php": "8.1 - 8.4" }, "require-dev": { - "nette/tester": "^2.4", + "nette/tester": "^2.5.2", "phpstan/phpstan-nette": "^1.0", "tracy/tracy": "^2.8" }, @@ -989,26 +989,26 @@ ], "support": { "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.3.0" + "source": "https://github.com/nette/schema/tree/v1.3.2" }, - "time": "2023-12-11T11:54:22+00:00" + "time": "2024-10-06T23:10:23+00:00" }, { "name": "nette/utils", - "version": "v4.0.4", + "version": "v4.0.5", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "d3ad0aa3b9f934602cb3e3902ebccf10be34d218" + "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/d3ad0aa3b9f934602cb3e3902ebccf10be34d218", - "reference": "d3ad0aa3b9f934602cb3e3902ebccf10be34d218", + "url": "https://api.github.com/repos/nette/utils/zipball/736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", + "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", "shasum": "" }, "require": { - "php": ">=8.0 <8.4" + "php": "8.0 - 8.4" }, "conflict": { "nette/finder": "<3", @@ -1075,9 +1075,9 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v4.0.4" + "source": "https://github.com/nette/utils/tree/v4.0.5" }, - "time": "2024-01-17T16:50:36+00:00" + "time": "2024-08-07T15:39:19+00:00" }, { "name": "nikic/php-parser", @@ -1257,16 +1257,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.0", + "version": "1.33.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" + "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140", + "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140", "shasum": "" }, "require": { @@ -1298,32 +1298,32 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0" }, - "time": "2024-05-06T12:04:23+00:00" + "time": "2024-10-13T11:25:22+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", - "version": "1.2.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", - "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82" + "reference": "81833b5787e2e8f451b31218875e29e4ed600ab2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/f94d246cc143ec5a23da868f8f7e1393b50eaa82", - "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/81833b5787e2e8f451b31218875e29e4ed600ab2", + "reference": "81833b5787e2e8f451b31218875e29e4ed600ab2", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.12" + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5" + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.6" }, "type": "phpstan-extension", "extra": { @@ -1345,36 +1345,35 @@ "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", "support": { "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", - "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.1" + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/2.0.0" }, - "time": "2024-09-11T15:52:35+00:00" + "time": "2024-10-26T16:04:11+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "1.4.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "f3ea021866f4263f07ca3636bf22c64be9610c11" + "reference": "3cc855474263ad6220dfa49167cbea34ca1dd300" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/f3ea021866f4263f07ca3636bf22c64be9610c11", - "reference": "f3ea021866f4263f07ca3636bf22c64be9610c11", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/3cc855474263ad6220dfa49167cbea34ca1dd300", + "reference": "3cc855474263ad6220dfa49167cbea34ca1dd300", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.11" + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0" }, "conflict": { "phpunit/phpunit": "<7.0" }, "require-dev": { - "nikic/php-parser": "^4.13.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-strict-rules": "^1.5.1", - "phpunit/phpunit": "^9.5" + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6" }, "type": "phpstan-extension", "extra": { @@ -1397,34 +1396,33 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.4.0" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.0" }, - "time": "2024-04-20T06:39:00+00:00" + "time": "2024-10-14T03:16:27+00:00" }, { "name": "phpstan/phpstan-strict-rules", - "version": "1.6.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "daeec748b53de80a97498462513066834ec28f8b" + "reference": "a4a6a08bd4a461e516b9c3b8fdbf0f1883b34158" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/daeec748b53de80a97498462513066834ec28f8b", - "reference": "daeec748b53de80a97498462513066834ec28f8b", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/a4a6a08bd4a461e516b9c3b8fdbf0f1883b34158", + "reference": "a4a6a08bd4a461e516b9c3b8fdbf0f1883b34158", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.12.4" + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0" }, "require-dev": { - "nikic/php-parser": "^4.13.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-deprecation-rules": "^1.1", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5" + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.6" }, "type": "phpstan-extension", "extra": { @@ -1446,9 +1444,9 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.6.1" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.0" }, - "time": "2024-09-20T14:04:44+00:00" + "time": "2024-10-26T16:04:33+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2901,73 +2899,6 @@ }, "time": "2024-08-08T08:12:32+00:00" }, - { - "name": "shipmonk/dead-code-detector", - "version": "0.2.1", - "source": { - "type": "git", - "url": "https://github.com/shipmonk-rnd/dead-code-detector.git", - "reference": "780dc3f6d6a1551703c65bbf127dd63f94cc2166" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/shipmonk-rnd/dead-code-detector/zipball/780dc3f6d6a1551703c65bbf127dd63f94cc2166", - "reference": "780dc3f6d6a1551703c65bbf127dd63f94cc2166", - "shasum": "" - }, - "require": { - "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^1.11.0" - }, - "require-dev": { - "doctrine/orm": "^2.19 || ^3.0", - "editorconfig-checker/editorconfig-checker": "^10.3.0", - "ergebnis/composer-normalize": "^2.28", - "nette/application": "^3.1", - "nette/component-model": "^3.0", - "nette/utils": "^3.0 || ^4.0", - "phpstan/phpstan-phpunit": "^1.1.1", - "phpstan/phpstan-strict-rules": "^1.2.3", - "phpstan/phpstan-symfony": "^1.4", - "phpunit/phpunit": "^9.5.20", - "shipmonk/composer-dependency-analyser": "^1.6", - "shipmonk/name-collision-detector": "^2.0.0", - "shipmonk/phpstan-rules": "^3.1", - "slevomat/coding-standard": "^8.15.0", - "symfony/contracts": "^2.5 || ^3.0", - "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", - "symfony/routing": "^5.4 || ^6.0 || ^7.0" - }, - "type": "phpstan-extension", - "extra": { - "phpstan": { - "includes": [ - "rules.neon" - ] - } - }, - "autoload": { - "psr-4": { - "ShipMonk\\PHPStan\\DeadCode\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan rules and collectors to find dead and unused code", - "keywords": [ - "PHPStan", - "dead code", - "static analysis", - "unused code" - ], - "support": { - "issues": "https://github.com/shipmonk-rnd/dead-code-detector/issues", - "source": "https://github.com/shipmonk-rnd/dead-code-detector/tree/0.2.1" - }, - "time": "2024-09-05T11:28:14+00:00" - }, { "name": "shipmonk/name-collision-detector", "version": "2.1.1", @@ -3224,12 +3155,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": "^7.4 || ^8.0" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 4828ae6..21b64a9 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -5,7 +5,6 @@ includes: - ./vendor/phpstan/phpstan-phpunit/extension.neon - ./vendor/phpstan/phpstan-phpunit/rules.neon - ./vendor/phpstan/phpstan-deprecation-rules/rules.neon - - ./vendor/shipmonk/dead-code-detector/rules.neon - ./rules.neon parameters: diff --git a/rules.neon b/rules.neon index c1319b4..82b4acf 100644 --- a/rules.neon +++ b/rules.neon @@ -339,6 +339,8 @@ services: allowedCheckedExceptionCallables: %shipmonkRules.forbidCheckedExceptionInCallable.allowedCheckedExceptionCallables% - class: ShipMonk\PHPStan\Rule\ForbidCheckedExceptionInYieldingMethodRule + arguments: + exceptionTypeResolver: @PHPStan\Rules\Exceptions\DefaultExceptionTypeResolver - class: ShipMonk\PHPStan\Rule\ForbidCustomFunctionsRule arguments: diff --git a/src/Rule/EnforceListReturnRule.php b/src/Rule/EnforceListReturnRule.php index 24869e9..32f66b2 100644 --- a/src/Rule/EnforceListReturnRule.php +++ b/src/Rule/EnforceListReturnRule.php @@ -10,7 +10,6 @@ use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; -use PHPStan\Type\Accessory\AccessoryArrayListType; use PHPStan\Type\VerbosityLevel; use function count; @@ -31,10 +30,6 @@ public function getNodeType(): string */ public function processNode(Node $node, Scope $scope): array { - if (AccessoryArrayListType::isListTypeEnabled() === false) { - return []; - } - $methodReflection = $scope->getFunction(); if ($methodReflection === null || $node instanceof ClosureReturnStatementsNode) { diff --git a/src/Rule/EnforceNativeReturnTypehintRule.php b/src/Rule/EnforceNativeReturnTypehintRule.php index fab1dc6..7900372 100644 --- a/src/Rule/EnforceNativeReturnTypehintRule.php +++ b/src/Rule/EnforceNativeReturnTypehintRule.php @@ -4,7 +4,8 @@ use Generator; use PhpParser\Node; -use PhpParser\Node\Stmt\Throw_; +use PhpParser\Node\Expr\Throw_; +use PhpParser\Node\Stmt\Expression; use PHPStan\Analyser\Scope; use PHPStan\Node\ReturnStatementsNode; use PHPStan\Php\PhpVersion; @@ -328,7 +329,10 @@ private function alwaysThrowsException(ReturnStatementsNode $node): bool $exitPoints = $node->getStatementResult()->getExitPoints(); foreach ($exitPoints as $exitPoint) { - if (!$exitPoint->getStatement() instanceof Throw_) { + $statement = $exitPoint->getStatement(); + $isThrow = $statement instanceof Expression && $statement->expr instanceof Throw_; + + if (!$isThrow) { return false; } } diff --git a/src/Rule/ForbidCheckedExceptionInCallableRule.php b/src/Rule/ForbidCheckedExceptionInCallableRule.php index 4d54c98..620c1b3 100644 --- a/src/Rule/ForbidCheckedExceptionInCallableRule.php +++ b/src/Rule/ForbidCheckedExceptionInCallableRule.php @@ -26,10 +26,10 @@ use PHPStan\Node\FunctionCallableNode; use PHPStan\Node\MethodCallableNode; use PHPStan\Node\StaticMethodCallableNode; +use PHPStan\Reflection\ExtendedParameterReflection; use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\MethodReflection; use PHPStan\Reflection\ParameterReflection; -use PHPStan\Reflection\ParameterReflectionWithPhpDocs; use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Rules\Exceptions\DefaultExceptionTypeResolver; @@ -239,7 +239,7 @@ public function processArrowFunction( $result = $this->nodeScopeResolver->processExprNode( new Expression($node->expr), $node->expr, - $scope->enterArrowFunction($node), + $scope->enterArrowFunction($node, null), static function (): void { }, ExpressionContext::createDeep(), @@ -354,7 +354,7 @@ private function checkClassExistence( */ private function isImmediatelyInvokedCallable(object $reflection, ?ParameterReflection $parameter): bool { - if ($parameter instanceof ParameterReflectionWithPhpDocs) { + if ($parameter instanceof ExtendedParameterReflection) { $parameterCallImmediately = $parameter->isImmediatelyInvokedCallable(); if ($parameterCallImmediately->maybe()) { diff --git a/src/Rule/ForbidCheckedExceptionInYieldingMethodRule.php b/src/Rule/ForbidCheckedExceptionInYieldingMethodRule.php index 5bfd871..23b253a 100644 --- a/src/Rule/ForbidCheckedExceptionInYieldingMethodRule.php +++ b/src/Rule/ForbidCheckedExceptionInYieldingMethodRule.php @@ -5,7 +5,7 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; use PHPStan\Node\MethodReturnStatementsNode; -use PHPStan\Rules\Exceptions\DefaultExceptionTypeResolver; +use PHPStan\Rules\Exceptions\ExceptionTypeResolver; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; @@ -16,9 +16,9 @@ class ForbidCheckedExceptionInYieldingMethodRule implements Rule { - private DefaultExceptionTypeResolver $exceptionTypeResolver; + private ExceptionTypeResolver $exceptionTypeResolver; - public function __construct(DefaultExceptionTypeResolver $exceptionTypeResolver) + public function __construct(ExceptionTypeResolver $exceptionTypeResolver) { $this->exceptionTypeResolver = $exceptionTypeResolver; } diff --git a/src/Rule/ForbidFetchOnMixedRule.php b/src/Rule/ForbidFetchOnMixedRule.php index fb571a5..1518c32 100644 --- a/src/Rule/ForbidFetchOnMixedRule.php +++ b/src/Rule/ForbidFetchOnMixedRule.php @@ -9,8 +9,8 @@ use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\StaticPropertyFetch; use PhpParser\Node\Identifier; -use PhpParser\PrettyPrinter\Standard; use PHPStan\Analyser\Scope; +use PHPStan\Node\Printer\Printer; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; @@ -25,11 +25,11 @@ class ForbidFetchOnMixedRule implements Rule { - private Standard $printer; + private Printer $printer; private bool $checkExplicitMixed; - public function __construct(Standard $printer, bool $checkExplicitMixed) + public function __construct(Printer $printer, bool $checkExplicitMixed) { $this->printer = $printer; $this->checkExplicitMixed = $checkExplicitMixed; diff --git a/src/Rule/ForbidMethodCallOnMixedRule.php b/src/Rule/ForbidMethodCallOnMixedRule.php index bb61cab..fdc1576 100644 --- a/src/Rule/ForbidMethodCallOnMixedRule.php +++ b/src/Rule/ForbidMethodCallOnMixedRule.php @@ -9,8 +9,8 @@ use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Identifier; -use PhpParser\PrettyPrinter\Standard; use PHPStan\Analyser\Scope; +use PHPStan\Node\Printer\Printer; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; @@ -24,11 +24,11 @@ class ForbidMethodCallOnMixedRule implements Rule { - private Standard $printer; + private Printer $printer; private bool $checkExplicitMixed; - public function __construct(Standard $printer, bool $checkExplicitMixed) + public function __construct(Printer $printer, bool $checkExplicitMixed) { $this->printer = $printer; $this->checkExplicitMixed = $checkExplicitMixed; diff --git a/src/Rule/ForbidNotNormalizedTypeRule.php b/src/Rule/ForbidNotNormalizedTypeRule.php index b3105f7..5caeb1a 100644 --- a/src/Rule/ForbidNotNormalizedTypeRule.php +++ b/src/Rule/ForbidNotNormalizedTypeRule.php @@ -16,9 +16,9 @@ use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Property; use PhpParser\Node\UnionType; -use PhpParser\PrettyPrinter\Standard as PhpParserPrinter; use PHPStan\Analyser\NameScope; use PHPStan\Analyser\Scope; +use PHPStan\Node\Printer\Printer; use PHPStan\PhpDoc\ResolvedPhpDocBlock; use PHPStan\PhpDoc\TypeNodeResolver; use PHPStan\PhpDocParser\Ast\Node as PhpDocRootNode; @@ -57,7 +57,7 @@ class ForbidNotNormalizedTypeRule implements Rule private TypeNodeResolver $typeNodeResolver; - private PhpParserPrinter $phpParserPrinter; + private Printer $phpParserPrinter; private bool $checkDisjunctiveNormalForm; @@ -69,7 +69,7 @@ class ForbidNotNormalizedTypeRule implements Rule public function __construct( FileTypeMapper $fileTypeMapper, TypeNodeResolver $typeNodeResolver, - PhpParserPrinter $phpParserPrinter, + Printer $phpParserPrinter, bool $checkDisjunctiveNormalForm ) { diff --git a/src/Rule/ForbidNullInInterpolatedStringRule.php b/src/Rule/ForbidNullInInterpolatedStringRule.php index 0a13d65..9d9a17e 100644 --- a/src/Rule/ForbidNullInInterpolatedStringRule.php +++ b/src/Rule/ForbidNullInInterpolatedStringRule.php @@ -3,35 +3,35 @@ namespace ShipMonk\PHPStan\Rule; use PhpParser\Node; -use PhpParser\Node\Scalar\Encapsed; -use PhpParser\Node\Scalar\EncapsedStringPart; -use PhpParser\PrettyPrinter\Standard; +use PhpParser\Node\InterpolatedStringPart; +use PhpParser\Node\Scalar\InterpolatedString; use PHPStan\Analyser\Scope; +use PHPStan\Node\Printer\Printer; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; use PHPStan\Type\TypeCombinator; /** - * @implements Rule + * @implements Rule */ class ForbidNullInInterpolatedStringRule implements Rule { - private Standard $printer; + private Printer $printer; - public function __construct(Standard $printer) + public function __construct(Printer $printer) { $this->printer = $printer; } public function getNodeType(): string { - return Encapsed::class; + return InterpolatedString::class; } /** - * @param Encapsed $node + * @param InterpolatedString $node * @return list */ public function processNode(Node $node, Scope $scope): array @@ -39,7 +39,7 @@ public function processNode(Node $node, Scope $scope): array $errors = []; foreach ($node->parts as $part) { - if ($part instanceof EncapsedStringPart) { + if ($part instanceof InterpolatedStringPart) { continue; } diff --git a/src/Rule/ForbidProtectedEnumMethodRule.php b/src/Rule/ForbidProtectedEnumMethodRule.php index 5e50d06..d1855d0 100644 --- a/src/Rule/ForbidProtectedEnumMethodRule.php +++ b/src/Rule/ForbidProtectedEnumMethodRule.php @@ -34,11 +34,11 @@ public function processNode(Node $node, Scope $scope): array foreach ($node->getMethods() as $classMethod) { if ( - $classMethod->isProtected() + $classMethod->getNode()->isProtected() && !$classMethod->isDeclaredInTrait() ) { $errors[] = RuleErrorBuilder::message('Protected methods within enum makes no sense as you cannot extend them anyway.') - ->line($classMethod->getStartLine()) + ->line($classMethod->getNode()->getStartLine()) ->identifier('shipmonk.protectedEnumMethod') ->build(); } diff --git a/src/Rule/ForbidUnsafeArrayKeyRule.php b/src/Rule/ForbidUnsafeArrayKeyRule.php index 5edeb76..c9e80bd 100644 --- a/src/Rule/ForbidUnsafeArrayKeyRule.php +++ b/src/Rule/ForbidUnsafeArrayKeyRule.php @@ -3,8 +3,8 @@ namespace ShipMonk\PHPStan\Rule; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\ArrayDimFetch; -use PhpParser\Node\Expr\ArrayItem; use PHPStan\Analyser\Scope; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\Rule; diff --git a/src/Rule/ForbidUnusedExceptionRule.php b/src/Rule/ForbidUnusedExceptionRule.php index aebe1f7..e6d6a90 100644 --- a/src/Rule/ForbidUnusedExceptionRule.php +++ b/src/Rule/ForbidUnusedExceptionRule.php @@ -8,8 +8,8 @@ use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\New_; use PhpParser\Node\Expr\StaticCall; -use PhpParser\PrettyPrinter\Standard; use PHPStan\Analyser\Scope; +use PHPStan\Node\Printer\Printer; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; @@ -22,9 +22,9 @@ class ForbidUnusedExceptionRule implements Rule { - private Standard $printer; + private Printer $printer; - public function __construct(Standard $printer) + public function __construct(Printer $printer) { $this->printer = $printer; } diff --git a/src/Rule/RequirePreviousExceptionPassRule.php b/src/Rule/RequirePreviousExceptionPassRule.php index fa4de65..d7ebe28 100644 --- a/src/Rule/RequirePreviousExceptionPassRule.php +++ b/src/Rule/RequirePreviousExceptionPassRule.php @@ -8,13 +8,14 @@ use PhpParser\Node\Expr\New_; use PhpParser\Node\Expr\NullsafeMethodCall; use PhpParser\Node\Expr\StaticCall; +use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\Stmt\Throw_; +use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\TryCatch; -use PhpParser\PrettyPrinter\Standard; use PHPStan\Analyser\Scope; +use PHPStan\Node\Printer\Printer; use PHPStan\Reflection\ParameterReflection; use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Rules\IdentifierRuleError; @@ -35,11 +36,14 @@ class RequirePreviousExceptionPassRule implements Rule { - private Standard $printer; + private Printer $printer; private bool $reportEvenIfExceptionIsNotAcceptableByRethrownOne; - public function __construct(Standard $printer, bool $reportEvenIfExceptionIsNotAcceptableByRethrownOne = false) + public function __construct( + Printer $printer, + bool $reportEvenIfExceptionIsNotAcceptableByRethrownOne = false + ) { $this->printer = $printer; $this->reportEvenIfExceptionIsNotAcceptableByRethrownOne = $reportEvenIfExceptionIsNotAcceptableByRethrownOne; @@ -70,12 +74,12 @@ public function processNode(Node $node, Scope $scope): array } foreach ($catch->stmts as $statement) { - if (!$statement instanceof Throw_) { + if ($statement instanceof Expression && $statement->expr instanceof Throw_) { + $throwExpression = $statement->expr->expr; + } else { continue; } - $throwExpression = $statement->expr; - if ($throwExpression instanceof CallLike) { $errors = array_merge( $errors, @@ -152,7 +156,7 @@ private function processExceptionCreation( } /** - * @return ParameterReflection[] + * @return list */ private function getCallLikeParameters(CallLike $node, Scope $scope): array { diff --git a/src/Visitor/UnusedExceptionVisitor.php b/src/Visitor/UnusedExceptionVisitor.php index 2646ba7..b25e4db 100644 --- a/src/Visitor/UnusedExceptionVisitor.php +++ b/src/Visitor/UnusedExceptionVisitor.php @@ -4,7 +4,7 @@ use PhpParser\Node; use PhpParser\Node\Arg; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\BinaryOp\Coalesce; use PhpParser\Node\Expr\MethodCall; @@ -12,11 +12,10 @@ use PhpParser\Node\Expr\NullsafeMethodCall; use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Expr\Ternary; -use PhpParser\Node\Expr\Throw_ as ThrowExpr; +use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Expr\Yield_; use PhpParser\Node\MatchArm; use PhpParser\Node\Stmt\Return_; -use PhpParser\Node\Stmt\Throw_; use PhpParser\NodeVisitorAbstract; use function array_pop; use function end; @@ -85,8 +84,7 @@ private function shouldBuildStack(Node $node): bool */ private function isUsed(Node $parent): bool { - return $parent instanceof Throw_ - || $parent instanceof Assign + return $parent instanceof Assign || $parent instanceof MethodCall || $parent instanceof Return_ || $parent instanceof Arg @@ -95,7 +93,7 @@ private function isUsed(Node $parent): bool || $parent instanceof NullsafeMethodCall || $parent instanceof Ternary || $parent instanceof Yield_ - || $parent instanceof ThrowExpr + || $parent instanceof Throw_ || $parent instanceof MatchArm; } diff --git a/src/Visitor/UnusedMatchVisitor.php b/src/Visitor/UnusedMatchVisitor.php index 60d92a3..f30168d 100644 --- a/src/Visitor/UnusedMatchVisitor.php +++ b/src/Visitor/UnusedMatchVisitor.php @@ -4,7 +4,7 @@ use PhpParser\Node; use PhpParser\Node\Arg; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\BinaryOp\Coalesce; @@ -12,12 +12,11 @@ use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\NullsafeMethodCall; use PhpParser\Node\Expr\Ternary; -use PhpParser\Node\Expr\Throw_ as ThrowExpr; +use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Expr\Yield_; use PhpParser\Node\Expr\YieldFrom; use PhpParser\Node\MatchArm; use PhpParser\Node\Stmt\Return_; -use PhpParser\Node\Stmt\Throw_; use PhpParser\NodeVisitorAbstract; use function array_pop; use function end; @@ -87,8 +86,7 @@ private function isUsed(Node $parent): bool || $parent instanceof Ternary || $parent instanceof MatchArm || $parent instanceof Yield_ - || $parent instanceof YieldFrom - || $parent instanceof ThrowExpr; + || $parent instanceof YieldFrom; } } diff --git a/tests/Rule/ForbidCheckedExceptionInYieldingMethodRuleTest.php b/tests/Rule/ForbidCheckedExceptionInYieldingMethodRuleTest.php index 36f0803..4d98416 100644 --- a/tests/Rule/ForbidCheckedExceptionInYieldingMethodRuleTest.php +++ b/tests/Rule/ForbidCheckedExceptionInYieldingMethodRuleTest.php @@ -3,7 +3,7 @@ namespace ShipMonk\PHPStan\Rule; use ForbidCheckedExceptionInYieldingMethodRule\CheckedException; -use PHPStan\Rules\Exceptions\DefaultExceptionTypeResolver; +use PHPStan\Rules\Exceptions\ExceptionTypeResolver; use PHPStan\Rules\Rule; use ShipMonk\PHPStan\RuleTestCase; use Throwable; @@ -16,7 +16,7 @@ class ForbidCheckedExceptionInYieldingMethodRuleTest extends RuleTestCase protected function getRule(): Rule { - $exceptionTypeResolverMock = self::createMock(DefaultExceptionTypeResolver::class); + $exceptionTypeResolverMock = $this->createMock(ExceptionTypeResolver::class); $exceptionTypeResolverMock ->expects(self::any()) ->method('isCheckedException') diff --git a/tests/Rule/ForbidFetchOnMixedRuleTest.php b/tests/Rule/ForbidFetchOnMixedRuleTest.php index acfb360..75e11d0 100644 --- a/tests/Rule/ForbidFetchOnMixedRuleTest.php +++ b/tests/Rule/ForbidFetchOnMixedRuleTest.php @@ -2,7 +2,7 @@ namespace ShipMonk\PHPStan\Rule; -use PhpParser\PrettyPrinter\Standard; +use PHPStan\Node\Printer\Printer; use PHPStan\Rules\Rule; use ShipMonk\PHPStan\RuleTestCase; @@ -15,7 +15,7 @@ class ForbidFetchOnMixedRuleTest extends RuleTestCase protected function getRule(): Rule { return new ForbidFetchOnMixedRule( - self::getContainer()->getByType(Standard::class), + self::getContainer()->getByType(Printer::class), (bool) self::getContainer()->getParameter('checkExplicitMixed'), ); } diff --git a/tests/Rule/ForbidMethodCallOnMixedRuleTest.php b/tests/Rule/ForbidMethodCallOnMixedRuleTest.php index 493bf52..f522a65 100644 --- a/tests/Rule/ForbidMethodCallOnMixedRuleTest.php +++ b/tests/Rule/ForbidMethodCallOnMixedRuleTest.php @@ -2,7 +2,7 @@ namespace ShipMonk\PHPStan\Rule; -use PhpParser\PrettyPrinter\Standard; +use PHPStan\Node\Printer\Printer; use PHPStan\Rules\Rule; use ShipMonk\PHPStan\RuleTestCase; @@ -15,7 +15,7 @@ class ForbidMethodCallOnMixedRuleTest extends RuleTestCase protected function getRule(): Rule { return new ForbidMethodCallOnMixedRule( - self::getContainer()->getByType(Standard::class), + self::getContainer()->getByType(Printer::class), (bool) self::getContainer()->getParameter('checkExplicitMixed'), ); } diff --git a/tests/Rule/ForbidNotNormalizedTypeRuleTest.php b/tests/Rule/ForbidNotNormalizedTypeRuleTest.php index 561a5a8..2fcfcad 100644 --- a/tests/Rule/ForbidNotNormalizedTypeRuleTest.php +++ b/tests/Rule/ForbidNotNormalizedTypeRuleTest.php @@ -2,10 +2,11 @@ namespace ShipMonk\PHPStan\Rule; -use PhpParser\PrettyPrinter\Standard; +use PHPStan\Node\Printer\Printer; use PHPStan\PhpDoc\TypeNodeResolver; use PHPStan\Type\FileTypeMapper; use ShipMonk\PHPStan\RuleTestCase; +use const PHP_VERSION_ID; /** * @extends RuleTestCase @@ -18,13 +19,17 @@ protected function getRule(): ForbidNotNormalizedTypeRule return new ForbidNotNormalizedTypeRule( self::getContainer()->getByType(FileTypeMapper::class), self::getContainer()->getByType(TypeNodeResolver::class), - self::getContainer()->getByType(Standard::class), + self::getContainer()->getByType(Printer::class), true, ); } public function testRule(): void { + if (PHP_VERSION_ID < 8_02_00) { + self::markTestSkipped('Test is for PHP 8.2+, we are using native true type there'); + } + $this->analyseFile(__DIR__ . '/data/ForbidNotNormalizedTypeRule/code.php'); } diff --git a/tests/Rule/ForbidNullInInterpolatedStringRuleTest.php b/tests/Rule/ForbidNullInInterpolatedStringRuleTest.php index 4f63beb..3c9dffc 100644 --- a/tests/Rule/ForbidNullInInterpolatedStringRuleTest.php +++ b/tests/Rule/ForbidNullInInterpolatedStringRuleTest.php @@ -2,7 +2,7 @@ namespace ShipMonk\PHPStan\Rule; -use PhpParser\PrettyPrinter\Standard; +use PHPStan\Node\Printer\Printer; use PHPStan\Rules\Rule; use ShipMonk\PHPStan\RuleTestCase; @@ -15,7 +15,7 @@ class ForbidNullInInterpolatedStringRuleTest extends RuleTestCase protected function getRule(): Rule { return new ForbidNullInInterpolatedStringRule( - self::getContainer()->getByType(Standard::class), + self::getContainer()->getByType(Printer::class), ); } diff --git a/tests/Rule/ForbidUnsafeArrayKeyRuleTest.php b/tests/Rule/ForbidUnsafeArrayKeyRuleTest.php index 2f303c0..ca27bfb 100644 --- a/tests/Rule/ForbidUnsafeArrayKeyRuleTest.php +++ b/tests/Rule/ForbidUnsafeArrayKeyRuleTest.php @@ -6,6 +6,7 @@ use PHPStan\Rules\Rule; use ShipMonk\PHPStan\Rule\ForbidUnsafeArrayKeyRule; use ShipMonk\PHPStan\RuleTestCase; +use const PHP_VERSION_ID; /** * @extends RuleTestCase @@ -35,6 +36,10 @@ protected function getRule(): Rule public function testStrict(): void { + if (PHP_VERSION_ID < 8_00_00) { + self::markTestSkipped('Test is for PHP 8.0+, we are using native mixed type there'); + } + $this->checkMixed = true; $this->checkInsideIsset = true; $this->analyseFile(__DIR__ . '/data/ForbidUnsafeArrayKeyRule/default.php'); @@ -42,6 +47,10 @@ public function testStrict(): void public function testLessStrict(): void { + if (PHP_VERSION_ID < 8_00_00) { + self::markTestSkipped('Test is for PHP 8.0+, we are using native mixed type there'); + } + $this->checkMixed = false; $this->checkInsideIsset = false; $this->analyseFile(__DIR__ . '/data/ForbidUnsafeArrayKeyRule/less-strict.php'); diff --git a/tests/Rule/ForbidUnusedExceptionRuleTest.php b/tests/Rule/ForbidUnusedExceptionRuleTest.php index b7426cd..858e6fb 100644 --- a/tests/Rule/ForbidUnusedExceptionRuleTest.php +++ b/tests/Rule/ForbidUnusedExceptionRuleTest.php @@ -2,7 +2,7 @@ namespace ShipMonk\PHPStan\Rule; -use PhpParser\PrettyPrinter\Standard; +use PHPStan\Node\Printer\Printer; use PHPStan\Rules\Rule; use ShipMonk\PHPStan\RuleTestCase; use function array_merge; @@ -15,7 +15,9 @@ class ForbidUnusedExceptionRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ForbidUnusedExceptionRule(new Standard()); + return new ForbidUnusedExceptionRule( + self::getContainer()->getByType(Printer::class), + ); } /** diff --git a/tests/Rule/RequirePreviousExceptionPassRuleTest.php b/tests/Rule/RequirePreviousExceptionPassRuleTest.php index 7560374..7db15cf 100644 --- a/tests/Rule/RequirePreviousExceptionPassRuleTest.php +++ b/tests/Rule/RequirePreviousExceptionPassRuleTest.php @@ -3,7 +3,7 @@ namespace ShipMonk\PHPStan\Rule; use LogicException; -use PhpParser\PrettyPrinter\Standard; +use PHPStan\Node\Printer\Printer; use PHPStan\Rules\Rule; use ShipMonk\PHPStan\RuleTestCase; @@ -22,7 +22,7 @@ protected function getRule(): Rule } return new RequirePreviousExceptionPassRule( - self::getContainer()->getByType(Standard::class), + self::getContainer()->getByType(Printer::class), $this->reportEvenIfExceptionIsNotAcceptableByRethrownOne, ); } diff --git a/tests/Rule/data/AllowComparingOnlyComparableTypesRule/code.php b/tests/Rule/data/AllowComparingOnlyComparableTypesRule/code.php index 32148c0..8a560b0 100644 --- a/tests/Rule/data/AllowComparingOnlyComparableTypesRule/code.php +++ b/tests/Rule/data/AllowComparingOnlyComparableTypesRule/code.php @@ -25,7 +25,7 @@ interface Bar {} int|float $intOrFloat, float $float, bool $bool, - mixed $mixed, + $mixed, ) { $foos > $foo; // error: Comparison array > AllowComparingOnlyComparableTypesRule\Foo contains non-comparable type, only int|float|string|DateTimeInterface or comparable tuple is allowed. $nullableInt > $int; // error: Comparison int|null > int contains non-comparable type, only int|float|string|DateTimeInterface or comparable tuple is allowed. diff --git a/tests/Rule/data/ForbidCustomFunctionsRule/code.php b/tests/Rule/data/ForbidCustomFunctionsRule/code.php index 4ef4d3a..520ebdc 100644 --- a/tests/Rule/data/ForbidCustomFunctionsRule/code.php +++ b/tests/Rule/data/ForbidCustomFunctionsRule/code.php @@ -55,7 +55,7 @@ class Test * @param class-string $classString */ public function test( - mixed $classStringOrTheClass, + $classStringOrTheClass, string $classString, SomeClass $class, SomeClass|AnotherClass $union, diff --git a/tests/Rule/data/ForbidFetchOnMixedRuleTest/code.php b/tests/Rule/data/ForbidFetchOnMixedRuleTest/code.php index fcd9b5f..56153c6 100644 --- a/tests/Rule/data/ForbidFetchOnMixedRuleTest/code.php +++ b/tests/Rule/data/ForbidFetchOnMixedRuleTest/code.php @@ -11,7 +11,7 @@ class Foo { public static ?int $staticProperty = null; } -$fn = function (mixed $mixed, $unknown, string $string, array $array, ReflectionClass $reflection, ?Foo $fooOrNull, object $object) { +$fn = function ($mixed, $unknown, string $string, array $array, ReflectionClass $reflection, ?Foo $fooOrNull, object $object) { (new Foo)->property; Foo::$staticProperty; Foo::CONST; @@ -34,6 +34,7 @@ class Foo { $mixed::CONST; // error: Constant fetch ::CONST is prohibited on unknown type ($mixed) $mixed::class; // error: Constant fetch ::class is prohibited on unknown type ($mixed) $unknown->fetch2; // error: Property fetch ->fetch2 is prohibited on unknown type ($unknown) + $unknown?->fetch3; // error: Property fetch ->fetch3 is prohibited on unknown type ($unknown) $unknown::$fetch2; // error: Property fetch ::$fetch2 is prohibited on unknown type ($unknown) $array[0]->fetch3; // error: Property fetch ->fetch3 is prohibited on unknown type ($array[0]) diff --git a/tests/Rule/data/ForbidMethodCallOnMixedRule/code.php b/tests/Rule/data/ForbidMethodCallOnMixedRule/code.php index 7dc55b0..3573e5a 100644 --- a/tests/Rule/data/ForbidMethodCallOnMixedRule/code.php +++ b/tests/Rule/data/ForbidMethodCallOnMixedRule/code.php @@ -9,7 +9,7 @@ public function method() {} public static function staticMethod() {} } -$fn = function (mixed $mixed, $unknown, array $array, string $string, ?Foo $fooOrNull, ReflectionClass $reflection) { +$fn = function ($mixed, $unknown, array $array, string $string, ?Foo $fooOrNull, ReflectionClass $reflection) { $foo = new Foo(); $foo->method(); diff --git a/tests/Rule/data/ForbidVariableTypeOverwritingRule/code.php b/tests/Rule/data/ForbidVariableTypeOverwritingRule/code.php index 64fd193..9131f2b 100644 --- a/tests/Rule/data/ForbidVariableTypeOverwritingRule/code.php +++ b/tests/Rule/data/ForbidVariableTypeOverwritingRule/code.php @@ -74,10 +74,10 @@ function testBasics( } function testIgnoredTypes( - mixed $mixed1, - mixed $mixed2, - mixed $mixed3, - mixed $mixed4, + $mixed1, + $mixed2, + $mixed3, + $mixed4, ?ParentClass $parentClass1, ParentClass $parentClass2, ): void { @@ -103,7 +103,7 @@ function testIgnoredTypes( function testAdvancedTypesAreIgnored( array $nonEmptyArray, array $intList, - mixed $mixed, + $mixed, int $int, int $positiveInt, int $intMask, diff --git a/tests/Rule/data/UselessPrivatePropertyNullabilityRule/code.php b/tests/Rule/data/UselessPrivatePropertyNullabilityRule/code.php index 7192233..3499f1d 100644 --- a/tests/Rule/data/UselessPrivatePropertyNullabilityRule/code.php +++ b/tests/Rule/data/UselessPrivatePropertyNullabilityRule/code.php @@ -26,7 +26,7 @@ class ExampleClass private $isUninitializedWithoutTypehint; public function __construct( - mixed $mixed, + $mixed, int $isPublic, int $isProtected, int $isPrivate,