From c7586b64663ef08dcf2895168fa7615adcbaf070 Mon Sep 17 00:00:00 2001 From: Martin Herndl Date: Sun, 29 May 2022 12:11:51 +0200 Subject: [PATCH] try a simply class_exists fix --- .../Properties/MissingReadOnlyPropertyAssignRuleTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/PHPStan/Rules/Properties/MissingReadOnlyPropertyAssignRuleTest.php b/tests/PHPStan/Rules/Properties/MissingReadOnlyPropertyAssignRuleTest.php index 76dd51df593..15b9aab14bd 100644 --- a/tests/PHPStan/Rules/Properties/MissingReadOnlyPropertyAssignRuleTest.php +++ b/tests/PHPStan/Rules/Properties/MissingReadOnlyPropertyAssignRuleTest.php @@ -6,6 +6,7 @@ use PHPStan\Reflection\PropertyReflection; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; +use function class_exists; use function in_array; use const PHP_VERSION_ID; @@ -41,8 +42,8 @@ public function isInitialized(PropertyReflection $property, string $propertyName private function isEntityId(PropertyReflection $property, string $propertyName): bool { - return PHP_VERSION_ID >= 80100 - &&$property->getDeclaringClass()->getName() === 'MissingReadOnlyPropertyAssign\\Entity' + return class_exists('MissingReadOnlyPropertyAssign\\Entity') + && $property->getDeclaringClass()->getName() === 'MissingReadOnlyPropertyAssign\\Entity' && in_array($propertyName, ['id'], true); }