diff --git a/docs/binding.md b/docs/binding.md index ccdf8f4..07905ef 100644 --- a/docs/binding.md +++ b/docs/binding.md @@ -42,7 +42,7 @@ enum Suit { Illuminate\Support\Facades\Route::get( '/card/{card?}', - function (Suit $card = null) { + function (Suit|null $card = null) { print $card->name ?? 'nothing'; } ); diff --git a/src/Helpers/EnumCheck.php b/src/Helpers/EnumCheck.php index adee3dc..b9d7bdb 100644 --- a/src/Helpers/EnumCheck.php +++ b/src/Helpers/EnumCheck.php @@ -12,7 +12,7 @@ */ final class EnumCheck { - public static function check(UnitEnum|string $enum, string $class = null): void + public static function check(UnitEnum|string $enum, string|null $class = null): void { if (!$enum instanceof UnitEnum && !enum_exists($enum, true)) { self::throwError($class); @@ -28,7 +28,7 @@ public static function matches(string $class, BackedEnum|UnitEnum|string|null .. } } - private static function throwError(string $class = null): never + private static function throwError(string|null $class = null): never { $method = 'This method'; diff --git a/src/Helpers/EnumProperties.php b/src/Helpers/EnumProperties.php index a649e87..2fabb1a 100644 --- a/src/Helpers/EnumProperties.php +++ b/src/Helpers/EnumProperties.php @@ -92,7 +92,7 @@ public static function global(string $property, mixed $value): mixed return self::$global[$property] = $value; } - public static function clear(string $class, string $property = null): void + public static function clear(string $class, string|null $property = null): void { EnumCheck::check($class); @@ -105,7 +105,7 @@ public static function clear(string $class, string $property = null): void } } - public static function clearGlobal(string $property = null): void + public static function clearGlobal(string|null $property = null): void { if (!empty($property)) { unset(self::$global[$property]); diff --git a/src/Helpers/EnumValue.php b/src/Helpers/EnumValue.php index 2f62e43..8fd2ab1 100644 --- a/src/Helpers/EnumValue.php +++ b/src/Helpers/EnumValue.php @@ -10,7 +10,7 @@ */ final class EnumValue { - public static function value(UnitEnum $enum, bool $keepCase = null): string|int + public static function value(UnitEnum $enum, bool|null $keepCase = null): string|int { if (is_null($keepCase)) { $keepCase = self::isStrict($enum); diff --git a/src/Laravel/Mixins/RulesMixin.php b/src/Laravel/Mixins/RulesMixin.php index 16e90b9..efb1982 100644 --- a/src/Laravel/Mixins/RulesMixin.php +++ b/src/Laravel/Mixins/RulesMixin.php @@ -28,7 +28,7 @@ public function enumBitmask(): Closure public function enumTransition(): Closure { - return function (UnitEnum $currentState, TransitionHook $hook = null): EnumTransition { + return function (UnitEnum $currentState, TransitionHook|null $hook = null): EnumTransition { return new EnumTransition($currentState, $hook); }; }