Skip to content

Commit 79c0583

Browse files
author
Patrick
committed
convert to PHP 8 syntax
1 parent 8df8207 commit 79c0583

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Helpers/Reflection.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
class Reflection
1212
{
13-
public static function firstParameterType(callable $callable): string
13+
/**
14+
* @psalm-suppress UndefinedMethod
15+
*/
16+
public static function firstParameterType(callable|object $callable): string
1417
{
1518
$reflection = is_object($callable)
1619
? (new ReflectionObject($callable))->getMethod('__invoke')
@@ -19,11 +22,11 @@ public static function firstParameterType(callable $callable): string
1922
$parameters = $reflection->getParameters();
2023

2124
$parameterTypes = array_map(function (ReflectionParameter $parameter) {
22-
$class = $parameter->getType() && ! $parameter->getType()->isBuiltin()
25+
$class = $parameter->getType()
2326
? new ReflectionClass($parameter->getType()->getName())
2427
: null;
2528

26-
return $class ? $class->name : null;
29+
return $class?->name;
2730
}, $parameters);
2831

2932
return $parameterTypes[0] ?? '';

0 commit comments

Comments
 (0)