Updated the project for PHP 7.4+ compatibility.
This commit is contained in:
@@ -6,7 +6,7 @@ use Dabestaniha\AuthenticateBridge\App\Support\Collection;
|
||||
|
||||
abstract class BaseFormRequest
|
||||
{
|
||||
public static function make(): static
|
||||
public static function make(): self
|
||||
{
|
||||
return new static();
|
||||
}
|
||||
@@ -58,11 +58,14 @@ abstract class BaseFormRequest
|
||||
|
||||
protected function validateValue($value, $rule): bool
|
||||
{
|
||||
return match ($rule) {
|
||||
'required' => !empty($value),
|
||||
'nullable' => true,
|
||||
default => false,
|
||||
};
|
||||
switch ($rule) {
|
||||
case 'required':
|
||||
return !empty($value);
|
||||
case 'nullable':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,18 +4,20 @@ namespace Dabestaniha\AuthenticateBridge\App\Support;
|
||||
|
||||
class Collection
|
||||
{
|
||||
public static function make(array $items): static
|
||||
public static function make(array $items): self
|
||||
{
|
||||
return new static($items);
|
||||
}
|
||||
|
||||
public function __construct(private array $items)
|
||||
private array $items;
|
||||
|
||||
public function __construct(array $items)
|
||||
{
|
||||
//
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
public function get(string $key, $default = null)
|
||||
{
|
||||
return $this->items[$key] ?? $default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ final class JwtDecoder
|
||||
return self::objectToArray($decoded);
|
||||
}
|
||||
|
||||
private static function objectToArray(mixed $value): mixed
|
||||
private static function objectToArray($value)
|
||||
{
|
||||
if ($value instanceof stdClass) {
|
||||
$items = [];
|
||||
@@ -119,7 +119,7 @@ final class JwtDecoder
|
||||
}
|
||||
}
|
||||
|
||||
private static function numericDate(mixed $value, string $claim): int
|
||||
private static function numericDate($value, string $claim): int
|
||||
{
|
||||
if (is_int($value) || is_float($value)) {
|
||||
return (int) $value;
|
||||
|
||||
Reference in New Issue
Block a user