@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | public function isPossible(): bool |
| 17 | 17 | { |
| 18 | - if (str_starts_with($this->value, '*true')){ |
|
| 18 | + if (str_starts_with($this->value, '*true')) { |
|
| 19 | 19 | return true; |
| 20 | 20 | } |
| 21 | 21 | return strtolower($this->value) === 'true'; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | public function isPossible(): bool |
| 17 | 17 | { |
| 18 | - if (str_starts_with($this->value, '*false')){ |
|
| 18 | + if (str_starts_with($this->value, '*false')) { |
|
| 19 | 19 | return true; |
| 20 | 20 | } |
| 21 | 21 | return strtolower($this->value) === 'false'; |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function isPossible(): bool |
| 16 | 16 | { |
| 17 | - if (str_starts_with($this->value, '*bool')){ |
|
| 17 | + if (str_starts_with($this->value, '*bool')) { |
|
| 18 | 18 | $this->value = preg_replace('/^(\*bool\s*)/', '', $this->value); |
| 19 | 19 | return true; |
| 20 | 20 | } |
@@ -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 | } |
@@ -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'; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | $result = preg_replace_callback( |
| 31 | 31 | '/(\${(?<variable>.+?)(?<default_value>:[-=?][^}]*)?})/', |
| 32 | - function (array $matches): string { |
|
| 32 | + function(array $matches): string { |
|
| 33 | 33 | $env = getenv($matches['variable']) ?: null; |
| 34 | 34 | |
| 35 | 35 | /** @var string|bool|int|float|null $val */ |
@@ -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 | |