@@ -14,12 +14,12 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | private array $collection = []; |
| 16 | 16 | |
| 17 | - public function add(string $key, string|bool|int|float|null $value): void |
|
| 17 | + public function add(string $key, string | bool | int | float | null $value): void |
|
| 18 | 18 | { |
| 19 | 19 | $this->collection[$key] = $value; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function get(string $key, float|bool|int|string|null $default = null): float|bool|int|string|null |
|
| 22 | + public function get(string $key, float | bool | int | string | null $default = null): float | bool | int | string | null |
|
| 23 | 23 | { |
| 24 | 24 | return $this->has($key) ? $this->collection[$key] : $default; |
| 25 | 25 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface StorageInterface |
| 6 | 6 | { |
| 7 | - public function getPath(): string|false; |
|
| 7 | + public function getPath(): string | false; |
|
| 8 | 8 | |
| 9 | 9 | public function isLoaded(string $path): bool; |
| 10 | 10 | |
@@ -6,5 +6,5 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function isPossible(): bool; |
| 8 | 8 | |
| 9 | - public function getCastedValue(): string|bool|int|float|null; |
|
| 9 | + public function getCastedValue(): string | bool | int | float | null; |
|
| 10 | 10 | } |
@@ -47,9 +47,9 @@ |
||
| 47 | 47 | |
| 48 | 48 | private function determine(): void |
| 49 | 49 | { |
| 50 | - foreach (self::DEFINABLE_TYPES_MAP as $typeClass) { |
|
| 51 | - /** @var TypeCastInterface $type */ |
|
| 52 | - $type = new $typeClass($this->originalValue); |
|
| 50 | + foreach (self::DEFINABLE_TYPES_MAP as $typeClass) { |
|
| 51 | + /** @var TypeCastInterface $type */ |
|
| 52 | + $type = new $typeClass($this->originalValue); |
|
| 53 | 53 | if ($type->isPossible()){ |
| 54 | 54 | $this->castedValue = $type->getCastedValue(); |
| 55 | 55 | break; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | Int16Type::class |
| 33 | 33 | ]; |
| 34 | 34 | |
| 35 | - private float|bool|int|string|null $castedValue; |
|
| 35 | + private float | bool | int | string | null $castedValue; |
|
| 36 | 36 | |
| 37 | 37 | public function __construct(private string $originalValue) |
| 38 | 38 | { |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $this->determine(); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public static function castType(string|bool|int|float|null $value): string|bool|int|float|null |
|
| 43 | + public static function castType(string | bool | int | float | null $value): string | bool | int | float | null |
|
| 44 | 44 | { |
| 45 | 45 | if (gettype($value) !== 'string') { |
| 46 | 46 | return $value; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | return (new self($value))->getCastValue(); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function getCastValue(): float|bool|int|string|null |
|
| 51 | + public function getCastValue(): float | bool | int | string | null |
|
| 52 | 52 | { |
| 53 | 53 | return $this->castedValue; |
| 54 | 54 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | foreach (self::DEFINABLE_TYPES_MAP as $typeClass) { |
| 59 | 59 | /** @var TypeCastInterface $type */ |
| 60 | 60 | $type = new $typeClass($this->originalValue); |
| 61 | - if ($type->isPossible()){ |
|
| 61 | + if ($type->isPossible()) { |
|
| 62 | 62 | $this->castedValue = $type->getCastedValue(); |
| 63 | 63 | break; |
| 64 | 64 | } |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function handleValue(string $key, ?string $value): float|bool|int|string|null |
|
| 89 | + public function handleValue(string $key, ?string $value): float | bool | int | string | null |
|
| 90 | 90 | { |
| 91 | 91 | if ($value !== null) { |
| 92 | 92 | $quoted = null; |
| 93 | - $value = preg_replace_callback('/^(?<quote>[\'"])?(?<value>.*)\1/', function ($matches) { |
|
| 93 | + $value = preg_replace_callback('/^(?<quote>[\'"])?(?<value>.*)\1/', function($matches) { |
|
| 94 | 94 | return match ($matches['quote']) { |
| 95 | 95 | "'" => $matches['value'], |
| 96 | 96 | "\"" => strtr($matches['value'], self::CHARACTER_MAP) |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | public function populate( |
| 112 | 112 | string $key, |
| 113 | - string|null $value, |
|
| 113 | + string | null $value, |
|
| 114 | 114 | ): void { |
| 115 | 115 | $value = $this->handleValue($key, $value); |
| 116 | 116 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | private array $paths = []; |
| 19 | 19 | |
| 20 | 20 | #[\Override] |
| 21 | - public function getPath(): string|false |
|
| 21 | + public function getPath(): string | false |
|
| 22 | 22 | { |
| 23 | 23 | $key = key($this->paths); |
| 24 | 24 | if ($key === null) { |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public static function scalarValueToString(string|bool|int|float|null $value): string |
|
| 17 | + public static function scalarValueToString(string | bool | int | float | null $value): string |
|
| 18 | 18 | { |
| 19 | 19 | if (gettype($value) === 'boolean') { |
| 20 | 20 | return $value ? 'true' : 'false'; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $result = preg_replace_callback( |
| 32 | 32 | '/(\${(?<variable>.+?)(?<default_value>:[-=?][^}]*)?})/', |
| 33 | - function (array $matches): string { |
|
| 33 | + function(array $matches): string { |
|
| 34 | 34 | $env = getenv($matches['variable']) !== false ? getenv($matches['variable']) : null; |
| 35 | 35 | |
| 36 | 36 | /** @var string|bool|int|float|null $val */ |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | #[\Override] |
| 17 | 17 | public function isPossible(): bool |
| 18 | 18 | { |
| 19 | - if (str_starts_with($this->value, '*false')){ |
|
| 19 | + if (str_starts_with($this->value, '*false')) { |
|
| 20 | 20 | return true; |
| 21 | 21 | } |
| 22 | 22 | return strtolower($this->value) === 'false'; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | #[\Override] |
| 16 | 16 | public function isPossible(): bool |
| 17 | 17 | { |
| 18 | - if (str_starts_with($this->value, '*string')){ |
|
| 18 | + if (str_starts_with($this->value, '*string')) { |
|
| 19 | 19 | $this->value = preg_replace('/^(\*string\s*)/', '', $this->value) ?? ''; |
| 20 | 20 | return true; |
| 21 | 21 | } |