diff --git a/src/Subscribers/AttributeResolverTrait.php b/src/Subscribers/AttributeResolverTrait.php index 1dd1097..556f7a4 100644 --- a/src/Subscribers/AttributeResolverTrait.php +++ b/src/Subscribers/AttributeResolverTrait.php @@ -25,7 +25,12 @@ private function getAttribute(string $test): ?UseCassette $test = $this->parseMethod($test); try { - $method = new ReflectionMethod($test); + if (PHP_VERSION_ID < 80300) { + $method = new ReflectionMethod($test); + } else { + // @phpstan-ignore-next-line + $method = ReflectionMethod::createFromMethodName($test); + } } catch (Exception) { return null; } @@ -48,7 +53,12 @@ private function parseMethod(string $test): string private function getAttributeFromClass(string $test): ?UseCassette { - $method = new ReflectionMethod($test); + if (PHP_VERSION_ID < 80300) { + $method = new ReflectionMethod($test); + } else { + // @phpstan-ignore-next-line + $method = ReflectionMethod::createFromMethodName($test); + } $class = $method->getDeclaringClass(); $attributes = $class->getAttributes(UseCassette::class);