@@ -88,7 +88,7 @@ |
||
88 | 88 | * @return EnvironmentInterface |
89 | 89 | * @throws \Throwable |
90 | 90 | */ |
91 | - protected function getEnv(array $env, bool $overwite= true): EnvironmentInterface |
|
91 | + protected function getEnv(array $env, bool $overwite = true): EnvironmentInterface |
|
92 | 92 | { |
93 | 93 | $core = TestCore::create(['root' => __DIR__])->run(new Environment($env, $overwite)); |
94 | 94 |
@@ -34,7 +34,8 @@ |
||
34 | 34 | |
35 | 35 | public function testCreateInjectionNotForClass(): void |
36 | 36 | { |
37 | - $class = new #[ProvideFrom(method: 'test')] class { |
|
37 | + $class = new #[ProvideFrom(method: 'test')] class |
|
38 | + { |
|
38 | 39 | }; |
39 | 40 | |
40 | 41 | $ref = new \ReflectionClass($class); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | { |
15 | 15 | $core = TestCore::create([ |
16 | 16 | 'root' => __DIR__, |
17 | - 'config' => __DIR__ . '/config' |
|
17 | + 'config' => __DIR__.'/config' |
|
18 | 18 | ])->run(); |
19 | 19 | |
20 | 20 | /** @var TestConfig $config */ |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $core = TestCore::create([ |
29 | 29 | 'root' => __DIR__, |
30 | - 'config' => __DIR__ . '/config', |
|
30 | + 'config' => __DIR__.'/config', |
|
31 | 31 | ])->run(); |
32 | 32 | |
33 | 33 | /** @var ConfiguratorInterface $config */ |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function register(string $class): void |
24 | 24 | { |
25 | - if ($this->isBooted($class)) { |
|
25 | + if ($this->isBooted($class)){ |
|
26 | 26 | throw new BootloaderAlreadyBootedException($class); |
27 | 27 | } |
28 | 28 |
@@ -22,7 +22,8 @@ |
||
22 | 22 | */ |
23 | 23 | public function register(string $class): void |
24 | 24 | { |
25 | - if ($this->isBooted($class)) { |
|
25 | + if ($this->isBooted($class)) |
|
26 | + { |
|
26 | 27 | throw new BootloaderAlreadyBootedException($class); |
27 | 28 | } |
28 | 29 |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | { |
14 | 14 | public function __construct( |
15 | 15 | private array $directories = [] |
16 | - ) { |
|
17 | - foreach ($directories as $name => $directory) { |
|
16 | + ){ |
|
17 | + foreach ($directories as $name => $directory){ |
|
18 | 18 | $this->set($name, $directory); |
19 | 19 | } |
20 | 20 | } |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | public function set(string $name, string $path): DirectoriesInterface |
28 | 28 | { |
29 | 29 | $path = \str_replace(['\\', '//'], '/', $path); |
30 | - $this->directories[$name] = \rtrim($path, '/') . '/'; |
|
30 | + $this->directories[$name] = \rtrim($path, '/').'/'; |
|
31 | 31 | |
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function get(string $name): string |
36 | 36 | { |
37 | - if (!$this->has($name)) { |
|
37 | + if (!$this->has($name)){ |
|
38 | 38 | throw new DirectoryException("Undefined directory '{$name}'"); |
39 | 39 | } |
40 | 40 |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | public function __construct( |
15 | 15 | private array $directories = [] |
16 | 16 | ) { |
17 | - foreach ($directories as $name => $directory) { |
|
17 | + foreach ($directories as $name => $directory) |
|
18 | + { |
|
18 | 19 | $this->set($name, $directory); |
19 | 20 | } |
20 | 21 | } |
@@ -34,7 +35,8 @@ discard block |
||
34 | 35 | |
35 | 36 | public function get(string $name): string |
36 | 37 | { |
37 | - if (!$this->has($name)) { |
|
38 | + if (!$this->has($name)) |
|
39 | + { |
|
38 | 40 | throw new DirectoryException("Undefined directory '{$name}'"); |
39 | 41 | } |
40 | 42 |
@@ -13,6 +13,6 @@ |
||
13 | 13 | { |
14 | 14 | public function __construct( |
15 | 15 | public readonly FinalizerInterface $finalizer |
16 | - ) { |
|
16 | + ){ |
|
17 | 17 | } |
18 | 18 | } |
@@ -14,6 +14,6 @@ |
||
14 | 14 | { |
15 | 15 | public function __construct( |
16 | 16 | public readonly DispatcherInterface $dispatcher |
17 | - ) { |
|
17 | + ){ |
|
18 | 18 | } |
19 | 19 | } |
@@ -13,6 +13,6 @@ |
||
13 | 13 | { |
14 | 14 | public function __construct( |
15 | 15 | public readonly KernelInterface $kernel |
16 | - ) { |
|
16 | + ){ |
|
17 | 17 | } |
18 | 18 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use Spiral\Core\ContainerScope; |
10 | 10 | use Spiral\Core\Exception\ScopeException; |
11 | 11 | |
12 | -if (!function_exists('spiral')) { |
|
12 | +if (!function_exists('spiral')){ |
|
13 | 13 | /** |
14 | 14 | * Resolve given alias in current IoC scope. |
15 | 15 | * |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function spiral(string $alias): mixed |
24 | 24 | { |
25 | - if (ContainerScope::getContainer() === null) { |
|
25 | + if (ContainerScope::getContainer() === null){ |
|
26 | 26 | throw new ScopeException('Container scope was not set.'); |
27 | 27 | } |
28 | 28 | |
29 | - try { |
|
29 | + try{ |
|
30 | 30 | return ContainerScope::getContainer()->get($alias); |
31 | - } catch (ContainerExceptionInterface $e) { |
|
31 | + }catch (ContainerExceptionInterface $e){ |
|
32 | 32 | throw new ScopeException($e->getMessage(), $e->getCode(), $e); |
33 | 33 | } |
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | -if (!function_exists('directory')) { |
|
37 | +if (!function_exists('directory')){ |
|
38 | 38 | /** |
39 | 39 | * Get directory alias value. Uses application core from the current global scope. |
40 | 40 | * |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | -if (!function_exists('env')) { |
|
53 | +if (!function_exists('env')){ |
|
54 | 54 | /** |
55 | 55 | * Gets the value of an environment variable. Uses application core from the current global scope. |
56 | 56 | * |
@@ -9,7 +9,8 @@ discard block |
||
9 | 9 | use Spiral\Core\ContainerScope; |
10 | 10 | use Spiral\Core\Exception\ScopeException; |
11 | 11 | |
12 | -if (!function_exists('spiral')) { |
|
12 | +if (!function_exists('spiral')) |
|
13 | +{ |
|
13 | 14 | /** |
14 | 15 | * Resolve given alias in current IoC scope. |
15 | 16 | * |
@@ -22,19 +23,24 @@ discard block |
||
22 | 23 | */ |
23 | 24 | function spiral(string $alias): mixed |
24 | 25 | { |
25 | - if (ContainerScope::getContainer() === null) { |
|
26 | + if (ContainerScope::getContainer() === null) |
|
27 | + { |
|
26 | 28 | throw new ScopeException('Container scope was not set.'); |
27 | 29 | } |
28 | 30 | |
29 | - try { |
|
31 | + try |
|
32 | + { |
|
30 | 33 | return ContainerScope::getContainer()->get($alias); |
31 | - } catch (ContainerExceptionInterface $e) { |
|
34 | + } |
|
35 | + catch (ContainerExceptionInterface $e) |
|
36 | + { |
|
32 | 37 | throw new ScopeException($e->getMessage(), $e->getCode(), $e); |
33 | 38 | } |
34 | 39 | } |
35 | 40 | } |
36 | 41 | |
37 | -if (!function_exists('directory')) { |
|
42 | +if (!function_exists('directory')) |
|
43 | +{ |
|
38 | 44 | /** |
39 | 45 | * Get directory alias value. Uses application core from the current global scope. |
40 | 46 | * |
@@ -50,7 +56,8 @@ discard block |
||
50 | 56 | } |
51 | 57 | } |
52 | 58 | |
53 | -if (!function_exists('env')) { |
|
59 | +if (!function_exists('env')) |
|
60 | +{ |
|
54 | 61 | /** |
55 | 62 | * Gets the value of an environment variable. Uses application core from the current global scope. |
56 | 63 | * |