From bcc1e8cdf81c3da1a2ba9188ee94cd7e2a62e865 Mon Sep 17 00:00:00 2001 From: Martin Herndl Date: Tue, 17 Jan 2023 15:24:15 +0100 Subject: [PATCH] Fix deprecations and require PHPStan ^1.10 --- composer.json | 2 +- src/Rules/Deprecations/AccessDeprecatedPropertyRule.php | 3 +-- src/Rules/Deprecations/CallToDeprecatedMethodRule.php | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 3b89e70..0c115d7 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ ], "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.9.3" + "phpstan/phpstan": "^1.10" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", diff --git a/src/Rules/Deprecations/AccessDeprecatedPropertyRule.php b/src/Rules/Deprecations/AccessDeprecatedPropertyRule.php index e8abc19..3e1f88b 100644 --- a/src/Rules/Deprecations/AccessDeprecatedPropertyRule.php +++ b/src/Rules/Deprecations/AccessDeprecatedPropertyRule.php @@ -10,7 +10,6 @@ use PHPStan\Reflection\MissingPropertyFromReflectionException; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Rules\Rule; -use PHPStan\Type\TypeUtils; use function sprintf; /** @@ -44,7 +43,7 @@ public function processNode(Node $node, Scope $scope): array $propertyName = $node->name->name; $propertyAccessedOnType = $scope->getType($node->var); - $referencedClasses = TypeUtils::getDirectClassNames($propertyAccessedOnType); + $referencedClasses = $propertyAccessedOnType->getObjectClassNames(); foreach ($referencedClasses as $referencedClass) { try { diff --git a/src/Rules/Deprecations/CallToDeprecatedMethodRule.php b/src/Rules/Deprecations/CallToDeprecatedMethodRule.php index 53e023f..6ec4e0c 100644 --- a/src/Rules/Deprecations/CallToDeprecatedMethodRule.php +++ b/src/Rules/Deprecations/CallToDeprecatedMethodRule.php @@ -10,7 +10,6 @@ use PHPStan\Reflection\MissingMethodFromReflectionException; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Rules\Rule; -use PHPStan\Type\TypeUtils; use function sprintf; /** @@ -44,7 +43,7 @@ public function processNode(Node $node, Scope $scope): array $methodName = $node->name->name; $methodCalledOnType = $scope->getType($node->var); - $referencedClasses = TypeUtils::getDirectClassNames($methodCalledOnType); + $referencedClasses = $methodCalledOnType->getObjectClassNames(); foreach ($referencedClasses as $referencedClass) { try {