| Total Complexity | 5 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 21 | final class SplReflectionEnumHelper |
||
| 22 | { |
||
| 23 | private static ?\ReflectionNamedType $rnts = null; |
||
| 24 | private static ?\ReflectionNamedType $rnti = null; |
||
| 25 | |||
| 26 | private function __construct() |
||
| 27 | { |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Only way to generate a string ReflectionNamedType (Internal use). |
||
| 32 | * |
||
| 33 | * @return \ReflectionNamedType |
||
| 34 | */ |
||
| 35 | public static function getStringReflectionNamedType(): \ReflectionNamedType |
||
| 36 | { |
||
| 37 | if (null === static::$rnts) { |
||
|
|
|||
| 38 | $func = new \ReflectionFunction(static fn(string $param): string => $param); |
||
| 39 | static::$rnts = ($func->getParameters()[0])->getType(); |
||
| 40 | } |
||
| 41 | |||
| 42 | return static::$rnts; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Only way to generate an int ReflectionNamedType (Internal use). |
||
| 47 | * |
||
| 48 | * @return \ReflectionNamedType |
||
| 49 | */ |
||
| 50 | public static function getIntReflectionNamedType(): \ReflectionNamedType |
||
| 58 | } |
||
| 59 | } |
||
| 60 |