File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,10 @@ private function getAttribute(string $test): ?UseCassette
2525 $ test = $ this ->parseMethod ($ test );
2626
2727 try {
28- if (PHP_VERSION_ID < 80300 ) {
29- $ method = new ReflectionMethod ($ test );
30- } else {
31- // @phpstan-ignore-next-line
28+ if (method_exists (ReflectionMethod::class, 'createFromMethodName ' )) {
3229 $ method = ReflectionMethod::createFromMethodName ($ test );
30+ } else {
31+ $ method = new ReflectionMethod ($ test );
3332 }
3433 } catch (Exception ) {
3534 return null ;
@@ -53,12 +52,12 @@ private function parseMethod(string $test): string
5352
5453 private function getAttributeFromClass (string $ test ): ?UseCassette
5554 {
56- if (PHP_VERSION_ID < 80300 ) {
57- $ method = new ReflectionMethod ($ test );
58- } else {
59- // @phpstan-ignore-next-line
55+ if (method_exists (ReflectionMethod::class, 'createFromMethodName ' )) {
6056 $ method = ReflectionMethod::createFromMethodName ($ test );
57+ } else {
58+ $ method = new ReflectionMethod ($ test );
6159 }
60+
6261 $ class = $ method ->getDeclaringClass ();
6362 $ attributes = $ class ->getAttributes (UseCassette::class);
6463
You can’t perform that action at this time.
0 commit comments