diff --git a/composer.json b/composer.json index ef7a801..ad95d0d 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "php": "^8.1", "illuminate/support": "^10.0 || ^11.0", "livewire/livewire": "^3.3", - "phpstan/phpstan": "^1.10" + "phpstan/phpstan": "^2.0" }, "require-dev": { "phpunit/phpunit": "^10.5" diff --git a/src/Properties/ComputedPropertyExtension.php b/src/Properties/ComputedPropertyExtension.php index 481b644..f4146df 100644 --- a/src/Properties/ComputedPropertyExtension.php +++ b/src/Properties/ComputedPropertyExtension.php @@ -8,7 +8,6 @@ use Livewire\Attributes\Computed; use Livewire\Component; use PHPStan\Reflection\ClassReflection; -use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Reflection\PropertiesClassReflectionExtension; use PHPStan\Reflection\PropertyReflection; @@ -51,9 +50,7 @@ public function getProperty( $methodReflection = $classReflection->getNativeMethod($methodName); - $returnType = ParametersAcceptorSelector::selectSingle( - $methodReflection->getVariants(), - )->getReturnType(); + $returnType = $methodReflection->getOnlyVariant()->getReturnType(); return new ComputedProperty( declaringClass: $classReflection, diff --git a/tests/Fixtures/TestComponentWithComputedProperties.php b/tests/Fixtures/TestComponentWithComputedProperties.php index 16e4a8d..0a97458 100644 --- a/tests/Fixtures/TestComponentWithComputedProperties.php +++ b/tests/Fixtures/TestComponentWithComputedProperties.php @@ -22,9 +22,7 @@ private function privateMethod(): bool #[Computed] protected function protectedMethod(): bool { - $this->privateMethod(); - - return true; + return $this->privateMethod(); } #[Computed]