@@ -12,10 +12,10 @@ |
||
12 | 12 | { |
13 | 13 | public function __construct( |
14 | 14 | private readonly ClassesRegistry $bootloaders, |
15 | - ) { |
|
15 | + ){ |
|
16 | 16 | } |
17 | 17 | |
18 | - public function canInitialize(BootloaderInterface|string $bootloader, ?BootloadConfig $config = null): bool |
|
18 | + public function canInitialize(BootloaderInterface | string $bootloader, ?BootloadConfig $config = null): bool |
|
19 | 19 | { |
20 | 20 | $ref = new \ReflectionClass($bootloader); |
21 | 21 |
@@ -12,29 +12,29 @@ |
||
12 | 12 | { |
13 | 13 | public function __construct( |
14 | 14 | private readonly EnvironmentInterface $environment, |
15 | - ) { |
|
15 | + ){ |
|
16 | 16 | } |
17 | 17 | |
18 | - public function canInitialize(BootloaderInterface|string $bootloader, ?BootloadConfig $config = null): bool |
|
18 | + public function canInitialize(BootloaderInterface | string $bootloader, ?BootloadConfig $config = null): bool |
|
19 | 19 | { |
20 | - if ($config === null) { |
|
20 | + if ($config === null){ |
|
21 | 21 | return true; |
22 | 22 | } |
23 | 23 | |
24 | - if (!$config->enabled) { |
|
24 | + if (!$config->enabled){ |
|
25 | 25 | return false; |
26 | 26 | } |
27 | 27 | |
28 | - foreach ($config->denyEnv as $env => $denyValues) { |
|
28 | + foreach ($config->denyEnv as $env => $denyValues){ |
|
29 | 29 | $value = $this->environment->get($env); |
30 | - if ($value !== null && \in_array($value, (array) $denyValues, true)) { |
|
30 | + if ($value !== null && \in_array($value, (array)$denyValues, true)){ |
|
31 | 31 | return false; |
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | - foreach ($config->allowEnv as $env => $allowValues) { |
|
35 | + foreach ($config->allowEnv as $env => $allowValues){ |
|
36 | 36 | $value = $this->environment->get($env); |
37 | - if ($value === null || !\in_array($value, (array) $allowValues, true)) { |
|
37 | + if ($value === null || !\in_array($value, (array)$allowValues, true)){ |
|
38 | 38 | return false; |
39 | 39 | } |
40 | 40 | } |
@@ -17,24 +17,30 @@ |
||
17 | 17 | |
18 | 18 | public function canInitialize(BootloaderInterface|string $bootloader, ?BootloadConfig $config = null): bool |
19 | 19 | { |
20 | - if ($config === null) { |
|
20 | + if ($config === null) |
|
21 | + { |
|
21 | 22 | return true; |
22 | 23 | } |
23 | 24 | |
24 | - if (!$config->enabled) { |
|
25 | + if (!$config->enabled) |
|
26 | + { |
|
25 | 27 | return false; |
26 | 28 | } |
27 | 29 | |
28 | - foreach ($config->denyEnv as $env => $denyValues) { |
|
30 | + foreach ($config->denyEnv as $env => $denyValues) |
|
31 | + { |
|
29 | 32 | $value = $this->environment->get($env); |
30 | - if ($value !== null && \in_array($value, (array) $denyValues, true)) { |
|
33 | + if ($value !== null && \in_array($value, (array) $denyValues, true)) |
|
34 | + { |
|
31 | 35 | return false; |
32 | 36 | } |
33 | 37 | } |
34 | 38 | |
35 | - foreach ($config->allowEnv as $env => $allowValues) { |
|
39 | + foreach ($config->allowEnv as $env => $allowValues) |
|
40 | + { |
|
36 | 41 | $value = $this->environment->get($env); |
37 | - if ($value === null || !\in_array($value, (array) $allowValues, true)) { |
|
42 | + if ($value === null || !\in_array($value, (array) $allowValues, true)) |
|
43 | + { |
|
38 | 44 | return false; |
39 | 45 | } |
40 | 46 | } |
@@ -10,6 +10,6 @@ |
||
10 | 10 | public function __construct( |
11 | 11 | private string $foo, |
12 | 12 | private string $bar, |
13 | - ) { |
|
13 | + ){ |
|
14 | 14 | } |
15 | 15 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | public function supports(\ReflectionNamedType $type): bool |
17 | 17 | { |
18 | - if ($this->interfaceExists === null) { |
|
18 | + if ($this->interfaceExists === null){ |
|
19 | 19 | $this->interfaceExists = \interface_exists(UuidInterface::class); |
20 | 20 | } |
21 | 21 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | |
25 | 25 | public function setValue(FilterInterface $filter, \ReflectionProperty $property, mixed $value): void |
26 | 26 | { |
27 | - try { |
|
27 | + try{ |
|
28 | 28 | $property->setValue($filter, $value instanceof UuidInterface ? $value : Uuid::fromString($value)); |
29 | - } catch (\Throwable $e) { |
|
29 | + }catch (\Throwable $e){ |
|
30 | 30 | throw new SetterException( |
31 | 31 | previous: $e, |
32 | 32 | message: \sprintf('Unable to set UUID value. %s', $e->getMessage()), |
@@ -36,20 +36,20 @@ discard block |
||
36 | 36 | |
37 | 37 | private function implements(string $haystack, string $interface): bool |
38 | 38 | { |
39 | - if ($haystack === $interface) { |
|
39 | + if ($haystack === $interface){ |
|
40 | 40 | return true; |
41 | 41 | } |
42 | 42 | |
43 | - if (!\class_exists($haystack)) { |
|
43 | + if (!\class_exists($haystack)){ |
|
44 | 44 | return false; |
45 | 45 | } |
46 | 46 | |
47 | - foreach ((array)\class_implements($haystack) as $implements) { |
|
48 | - if ($implements === $interface) { |
|
47 | + foreach ((array)\class_implements($haystack) as $implements){ |
|
48 | + if ($implements === $interface){ |
|
49 | 49 | return true; |
50 | 50 | } |
51 | 51 | |
52 | - if (self::implements($implements, $interface)) { |
|
52 | + if (self::implements($implements, $interface)){ |
|
53 | 53 | return true; |
54 | 54 | } |
55 | 55 | } |
@@ -15,7 +15,8 @@ discard block |
||
15 | 15 | |
16 | 16 | public function supports(\ReflectionNamedType $type): bool |
17 | 17 | { |
18 | - if ($this->interfaceExists === null) { |
|
18 | + if ($this->interfaceExists === null) |
|
19 | + { |
|
19 | 20 | $this->interfaceExists = \interface_exists(UuidInterface::class); |
20 | 21 | } |
21 | 22 | |
@@ -24,9 +25,12 @@ discard block |
||
24 | 25 | |
25 | 26 | public function setValue(FilterInterface $filter, \ReflectionProperty $property, mixed $value): void |
26 | 27 | { |
27 | - try { |
|
28 | + try |
|
29 | + { |
|
28 | 30 | $property->setValue($filter, $value instanceof UuidInterface ? $value : Uuid::fromString($value)); |
29 | - } catch (\Throwable $e) { |
|
31 | + } |
|
32 | + catch (\Throwable $e) |
|
33 | + { |
|
30 | 34 | throw new SetterException( |
31 | 35 | previous: $e, |
32 | 36 | message: \sprintf('Unable to set UUID value. %s', $e->getMessage()), |
@@ -36,20 +40,25 @@ discard block |
||
36 | 40 | |
37 | 41 | private function implements(string $haystack, string $interface): bool |
38 | 42 | { |
39 | - if ($haystack === $interface) { |
|
43 | + if ($haystack === $interface) |
|
44 | + { |
|
40 | 45 | return true; |
41 | 46 | } |
42 | 47 | |
43 | - if (!\class_exists($haystack)) { |
|
48 | + if (!\class_exists($haystack)) |
|
49 | + { |
|
44 | 50 | return false; |
45 | 51 | } |
46 | 52 | |
47 | - foreach ((array)\class_implements($haystack) as $implements) { |
|
48 | - if ($implements === $interface) { |
|
53 | + foreach ((array)\class_implements($haystack) as $implements) |
|
54 | + { |
|
55 | + if ($implements === $interface) |
|
56 | + { |
|
49 | 57 | return true; |
50 | 58 | } |
51 | 59 | |
52 | - if (self::implements($implements, $interface)) { |
|
60 | + if (self::implements($implements, $interface)) |
|
61 | + { |
|
53 | 62 | return true; |
54 | 63 | } |
55 | 64 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public function __construct( |
16 | 16 | private readonly InputInterface $input, |
17 | 17 | private readonly array $overwrite |
18 | - ) { |
|
18 | + ){ |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function __toString(): string |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | return $this->overwrite['firstArgument'] ?? $this->input->getFirstArgument(); |
29 | 29 | } |
30 | 30 | |
31 | - public function hasParameterOption(string|array $values, bool $onlyParams = false): bool |
|
31 | + public function hasParameterOption(string | array $values, bool $onlyParams = false): bool |
|
32 | 32 | { |
33 | 33 | return $this->input->hasParameterOption($values, $onlyParams); |
34 | 34 | } |
35 | 35 | |
36 | 36 | public function getParameterOption( |
37 | - string|array $values, |
|
38 | - string|bool|int|float|array|null $default = false, |
|
37 | + string | array $values, |
|
38 | + string | bool | int | float | array | null $default = false, |
|
39 | 39 | bool $onlyParams = false |
40 | 40 | ): mixed { |
41 | 41 | return $this->input->getParameterOption($values, $default, $onlyParams); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | declare(strict_types=1); |
4 | 4 | |
5 | -if (!\function_exists('inject')) { |
|
5 | +if (!\function_exists('inject')){ |
|
6 | 6 | /** |
7 | 7 | * Macro function to be replaced by the injected value. |
8 | 8 | */ |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | } |
13 | 13 | } |
14 | 14 | |
15 | -if (!\function_exists('injected')) { |
|
15 | +if (!\function_exists('injected')){ |
|
16 | 16 | /** |
17 | 17 | * Return true if block value has been defined. |
18 | 18 | * |
@@ -2,7 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | declare(strict_types=1); |
4 | 4 | |
5 | -if (!\function_exists('inject')) { |
|
5 | +if (!\function_exists('inject')) |
|
6 | +{ |
|
6 | 7 | /** |
7 | 8 | * Macro function to be replaced by the injected value. |
8 | 9 | */ |
@@ -12,7 +13,8 @@ discard block |
||
12 | 13 | } |
13 | 14 | } |
14 | 15 | |
15 | -if (!\function_exists('injected')) { |
|
16 | +if (!\function_exists('injected')) |
|
17 | +{ |
|
16 | 18 | /** |
17 | 19 | * Return true if block value has been defined. |
18 | 20 | * |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | public function testListenWithJobTypeFromConfig(): void |
24 | 24 | { |
25 | - $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler {}; |
|
25 | + $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler{}; |
|
26 | 26 | |
27 | 27 | $container = new Container(); |
28 | 28 | $container->bind('test', new PhpSerializer()); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public function testListenWithJobTypeFromAttribute(): void |
60 | 60 | { |
61 | - $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler {}; |
|
61 | + $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler{}; |
|
62 | 62 | |
63 | 63 | $container = new Container(); |
64 | 64 | $container->bind('test', new PhpSerializer()); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | public function testListenWithJobTypeFromClass(): void |
96 | 96 | { |
97 | - $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler {}; |
|
97 | + $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler{}; |
|
98 | 98 | |
99 | 99 | $container = new Container(); |
100 | 100 | $container->bind('test', new PhpSerializer()); |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | { |
23 | 23 | public function testListenWithJobTypeFromConfig(): void |
24 | 24 | { |
25 | - $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler {}; |
|
25 | + $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler |
|
26 | + { |
|
27 | +}; |
|
26 | 28 | |
27 | 29 | $container = new Container(); |
28 | 30 | $container->bind('test', new PhpSerializer()); |
@@ -58,7 +60,9 @@ discard block |
||
58 | 60 | |
59 | 61 | public function testListenWithJobTypeFromAttribute(): void |
60 | 62 | { |
61 | - $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler {}; |
|
63 | + $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler |
|
64 | + { |
|
65 | +}; |
|
62 | 66 | |
63 | 67 | $container = new Container(); |
64 | 68 | $container->bind('test', new PhpSerializer()); |
@@ -94,7 +98,9 @@ discard block |
||
94 | 98 | |
95 | 99 | public function testListenWithJobTypeFromClass(): void |
96 | 100 | { |
97 | - $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler {}; |
|
101 | + $handler = new class($this->createMock(InvokerInterface::class)) extends JobHandler |
|
102 | + { |
|
103 | +}; |
|
98 | 104 | |
99 | 105 | $container = new Container(); |
100 | 106 | $container->bind('test', new PhpSerializer()); |
@@ -20,28 +20,28 @@ discard block |
||
20 | 20 | public function __construct( |
21 | 21 | private readonly ReaderInterface $reader, |
22 | 22 | private readonly HandlerRegistryInterface $registry, |
23 | - ) { |
|
23 | + ){ |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function process(string $controller, string $action, array $parameters, CoreInterface $core): mixed |
27 | 27 | { |
28 | - try { |
|
28 | + try{ |
|
29 | 29 | return $core->callAction($controller, $action, $parameters); |
30 | - } catch (\Throwable $e) { |
|
31 | - if (!\class_exists($controller)) { |
|
30 | + }catch (\Throwable $e){ |
|
31 | + if (!\class_exists($controller)){ |
|
32 | 32 | $controller = $this->registry->getHandler($controller)::class; |
33 | 33 | } |
34 | 34 | |
35 | 35 | $policy = $this->getRetryPolicy($e, new \ReflectionClass($controller)); |
36 | 36 | |
37 | - if ($policy === null) { |
|
37 | + if ($policy === null){ |
|
38 | 38 | throw $e; |
39 | 39 | } |
40 | 40 | |
41 | 41 | $headers = $parameters['headers'] ?? []; |
42 | 42 | $attempts = (int)($headers['attempts'][0] ?? 0); |
43 | 43 | |
44 | - if ($policy->isRetryable($e, $attempts) === false) { |
|
44 | + if ($policy->isRetryable($e, $attempts) === false){ |
|
45 | 45 | throw $e; |
46 | 46 | } |
47 | 47 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $attribute = $this->reader->firstClassMetadata($handler, Attribute::class); |
60 | 60 | |
61 | - if ($exception instanceof JobException && $exception->getPrevious() !== null) { |
|
61 | + if ($exception instanceof JobException && $exception->getPrevious() !== null){ |
|
62 | 62 | $exception = $exception->getPrevious(); |
63 | 63 | } |
64 | 64 |
@@ -25,23 +25,29 @@ discard block |
||
25 | 25 | |
26 | 26 | public function process(string $controller, string $action, array $parameters, CoreInterface $core): mixed |
27 | 27 | { |
28 | - try { |
|
28 | + try |
|
29 | + { |
|
29 | 30 | return $core->callAction($controller, $action, $parameters); |
30 | - } catch (\Throwable $e) { |
|
31 | - if (!\class_exists($controller)) { |
|
31 | + } |
|
32 | + catch (\Throwable $e) |
|
33 | + { |
|
34 | + if (!\class_exists($controller)) |
|
35 | + { |
|
32 | 36 | $controller = $this->registry->getHandler($controller)::class; |
33 | 37 | } |
34 | 38 | |
35 | 39 | $policy = $this->getRetryPolicy($e, new \ReflectionClass($controller)); |
36 | 40 | |
37 | - if ($policy === null) { |
|
41 | + if ($policy === null) |
|
42 | + { |
|
38 | 43 | throw $e; |
39 | 44 | } |
40 | 45 | |
41 | 46 | $headers = $parameters['headers'] ?? []; |
42 | 47 | $attempts = (int)($headers['attempts'][0] ?? 0); |
43 | 48 | |
44 | - if ($policy->isRetryable($e, $attempts) === false) { |
|
49 | + if ($policy->isRetryable($e, $attempts) === false) |
|
50 | + { |
|
45 | 51 | throw $e; |
46 | 52 | } |
47 | 53 | |
@@ -58,7 +64,8 @@ discard block |
||
58 | 64 | { |
59 | 65 | $attribute = $this->reader->firstClassMetadata($handler, Attribute::class); |
60 | 66 | |
61 | - if ($exception instanceof JobException && $exception->getPrevious() !== null) { |
|
67 | + if ($exception instanceof JobException && $exception->getPrevious() !== null) |
|
68 | + { |
|
62 | 69 | $exception = $exception->getPrevious(); |
63 | 70 | } |
64 | 71 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | $this->container = new Container(); |
25 | 25 | $this->container->bind(Tokenizer::class, $this->getTokenizer(['scopes' => [ |
26 | - 'foo' => ['directories' => [__DIR__ . '/Classes/Inner'], 'exclude' => []], |
|
26 | + 'foo' => ['directories' => [__DIR__.'/Classes/Inner'], 'exclude' => []], |
|
27 | 27 | ]])); |
28 | 28 | $this->container->bindSingleton(ScopedClassesInterface::class, ScopedClassLocator::class); |
29 | 29 | } |