@@ -26,11 +26,11 @@ |
||
26 | 26 | SampleBootWithMethodBoot::class, |
27 | 27 | SampleBoot::class, |
28 | 28 | ], [ |
29 | - static function(Container $container, SampleBoot $boot) { |
|
29 | + static function (Container $container, SampleBoot $boot){ |
|
30 | 30 | $container->bind('efg', $boot); |
31 | 31 | } |
32 | 32 | ], [ |
33 | - static function(Container $container, SampleBoot $boot) { |
|
33 | + static function (Container $container, SampleBoot $boot){ |
|
34 | 34 | $container->bind('ghi', $boot); |
35 | 35 | } |
36 | 36 | ]); |
@@ -26,11 +26,13 @@ |
||
26 | 26 | SampleBootWithMethodBoot::class, |
27 | 27 | SampleBoot::class, |
28 | 28 | ], [ |
29 | - static function(Container $container, SampleBoot $boot) { |
|
29 | + static function(Container $container, SampleBoot $boot) |
|
30 | + { |
|
30 | 31 | $container->bind('efg', $boot); |
31 | 32 | } |
32 | 33 | ], [ |
33 | - static function(Container $container, SampleBoot $boot) { |
|
34 | + static function(Container $container, SampleBoot $boot) |
|
35 | + { |
|
34 | 36 | $container->bind('ghi', $boot); |
35 | 37 | } |
36 | 38 | ]); |
@@ -33,9 +33,9 @@ |
||
33 | 33 | |
34 | 34 | $this->assertSame($expected, $enum); |
35 | 35 | |
36 | - if ($enum === DebugMode::Enabled) { |
|
36 | + if ($enum === DebugMode::Enabled){ |
|
37 | 37 | $this->assertTrue($enum->isEnabled()); |
38 | - } else { |
|
38 | + }else{ |
|
39 | 39 | $this->assertFalse($enum->isEnabled()); |
40 | 40 | } |
41 | 41 | } |
@@ -33,9 +33,12 @@ |
||
33 | 33 | |
34 | 34 | $this->assertSame($expected, $enum); |
35 | 35 | |
36 | - if ($enum === DebugMode::Enabled) { |
|
36 | + if ($enum === DebugMode::Enabled) |
|
37 | + { |
|
37 | 38 | $this->assertTrue($enum->isEnabled()); |
38 | - } else { |
|
39 | + } |
|
40 | + else |
|
41 | + { |
|
39 | 42 | $this->assertFalse($enum->isEnabled()); |
40 | 43 | } |
41 | 44 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | { |
19 | 19 | $core = TestCore::create([ |
20 | 20 | 'root' => __DIR__, |
21 | - 'config' => __DIR__ . '/config', |
|
21 | + 'config' => __DIR__.'/config', |
|
22 | 22 | ])->run(); |
23 | 23 | |
24 | 24 | /** @var ContainerInterface $c */ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $core = TestCore::create([ |
35 | 35 | 'root' => __DIR__, |
36 | - 'config' => __DIR__ . '/config', |
|
36 | + 'config' => __DIR__.'/config', |
|
37 | 37 | ])->run(new Environment([ |
38 | 38 | 'key' => '(true)', |
39 | 39 | ])); |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | { |
51 | 51 | $core = TestCore::create([ |
52 | 52 | 'root' => __DIR__, |
53 | - 'config' => __DIR__ . '/config', |
|
53 | + 'config' => __DIR__.'/config', |
|
54 | 54 | ])->run(); |
55 | 55 | |
56 | 56 | /** @var ContainerInterface $c */ |
57 | 57 | $c = $core->getContainer(); |
58 | 58 | |
59 | 59 | ContainerScope::runScope($c, function (): void { |
60 | - $this->assertDir(__DIR__ . '/config', directory('config')); |
|
60 | + $this->assertDir(__DIR__.'/config', directory('config')); |
|
61 | 61 | }); |
62 | 62 | } |
63 | 63 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | $core = TestCore::create([ |
76 | 76 | 'root' => __DIR__, |
77 | - 'config' => __DIR__ . '/config', |
|
77 | + 'config' => __DIR__.'/config', |
|
78 | 78 | ])->run(); |
79 | 79 | |
80 | 80 | /** @var ContainerInterface $c */ |
@@ -102,6 +102,6 @@ discard block |
||
102 | 102 | private function assertDir($path, $value): void |
103 | 103 | { |
104 | 104 | $path = str_replace(['\\', '//'], '/', $path); |
105 | - $this->assertSame(rtrim($path, '/') . '/', $value); |
|
105 | + $this->assertSame(rtrim($path, '/').'/', $value); |
|
106 | 106 | } |
107 | 107 | } |
@@ -18,22 +18,27 @@ discard block |
||
18 | 18 | |
19 | 19 | public function init(Container $container, AbstractKernel $kernel): void |
20 | 20 | { |
21 | - $kernel->booting(static function (AbstractKernel $kernel) use ($container) { |
|
21 | + $kernel->booting(static function (AbstractKernel $kernel) use ($container) |
|
22 | + { |
|
22 | 23 | $container->bind('hij', 'foo'); |
23 | 24 | |
24 | - $kernel->booting(static function () use ($container) { |
|
25 | + $kernel->booting(static function () use ($container) |
|
26 | + { |
|
25 | 27 | $container->bind('ijk', 'foo'); |
26 | 28 | }); |
27 | 29 | }); |
28 | 30 | |
29 | - $kernel->booted(function (AbstractKernel $kernel) use ($container) { |
|
31 | + $kernel->booted(function (AbstractKernel $kernel) use ($container) |
|
32 | + { |
|
30 | 33 | $container->bind('jkl', 'foo'); |
31 | 34 | |
32 | - $kernel->booting(function () use ($container) { |
|
35 | + $kernel->booting(function () use ($container) |
|
36 | + { |
|
33 | 37 | $container->bind('klm', 'foo'); |
34 | 38 | }); |
35 | 39 | |
36 | - $kernel->booted(function () use ($container) { |
|
40 | + $kernel->booted(function () use ($container) |
|
41 | + { |
|
37 | 42 | $container->bind('lmn', 'foo'); |
38 | 43 | }); |
39 | 44 | }); |
@@ -44,11 +49,13 @@ discard block |
||
44 | 49 | public function boot(ConfigurationBootloader $configuration, AbstractKernel $kernel, Container $container): void |
45 | 50 | { |
46 | 51 | // won't be executed |
47 | - $kernel->booting(function (AbstractKernel $kernel) use ($container) { |
|
52 | + $kernel->booting(function (AbstractKernel $kernel) use ($container) |
|
53 | + { |
|
48 | 54 | $container->bind('ghi', 'foo'); |
49 | 55 | }); |
50 | 56 | |
51 | - $kernel->booted(function (AbstractKernel $kernel) use ($container) { |
|
57 | + $kernel->booted(function (AbstractKernel $kernel) use ($container) |
|
58 | + { |
|
52 | 59 | $container->bind('mno', 'foo'); |
53 | 60 | }); |
54 | 61 |
@@ -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 */ |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | private readonly InvokerInterface $invoker, |
24 | 24 | private readonly ResolverInterface $resolver, |
25 | 25 | private readonly Initializer $initializer |
26 | - ) { |
|
26 | + ){ |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function getClasses(): array |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | { |
53 | 53 | $bootloaders = \iterator_to_array($this->initializer->init($classes)); |
54 | 54 | |
55 | - foreach ($bootloaders as $data) { |
|
55 | + foreach ($bootloaders as $data){ |
|
56 | 56 | $this->invokeBootloader($data['bootloader'], Methods::INIT, $data['options']); |
57 | 57 | } |
58 | 58 | |
59 | 59 | $this->fireCallbacks($bootingCallbacks); |
60 | 60 | |
61 | - foreach ($bootloaders as $data) { |
|
61 | + foreach ($bootloaders as $data){ |
|
62 | 62 | $this->invokeBootloader($data['bootloader'], Methods::BOOT, $data['options']); |
63 | 63 | } |
64 | 64 | |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | private function invokeBootloader(BootloaderInterface $bootloader, Methods $method, array $options): void |
69 | 69 | { |
70 | 70 | $refl = new \ReflectionClass($bootloader); |
71 | - if (!$refl->hasMethod($method->value)) { |
|
71 | + if (!$refl->hasMethod($method->value)){ |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
75 | 75 | $method = $refl->getMethod($method->value); |
76 | 76 | |
77 | 77 | $args = $this->resolver->resolveArguments($method); |
78 | - if (!isset($args['boot'])) { |
|
78 | + if (!isset($args['boot'])){ |
|
79 | 79 | $args['boot'] = $options; |
80 | 80 | } |
81 | 81 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | private function fireCallbacks(array $callbacks): void |
89 | 89 | { |
90 | - foreach ($callbacks as $callback) { |
|
90 | + foreach ($callbacks as $callback){ |
|
91 | 91 | $this->invoker->invoke($callback); |
92 | 92 | } |
93 | 93 | } |
@@ -52,13 +52,15 @@ discard block |
||
52 | 52 | { |
53 | 53 | $bootloaders = \iterator_to_array($this->initializer->init($classes)); |
54 | 54 | |
55 | - foreach ($bootloaders as $data) { |
|
55 | + foreach ($bootloaders as $data) |
|
56 | + { |
|
56 | 57 | $this->invokeBootloader($data['bootloader'], Methods::INIT, $data['options']); |
57 | 58 | } |
58 | 59 | |
59 | 60 | $this->fireCallbacks($bootingCallbacks); |
60 | 61 | |
61 | - foreach ($bootloaders as $data) { |
|
62 | + foreach ($bootloaders as $data) |
|
63 | + { |
|
62 | 64 | $this->invokeBootloader($data['bootloader'], Methods::BOOT, $data['options']); |
63 | 65 | } |
64 | 66 | |
@@ -68,14 +70,16 @@ discard block |
||
68 | 70 | private function invokeBootloader(BootloaderInterface $bootloader, Methods $method, array $options): void |
69 | 71 | { |
70 | 72 | $refl = new \ReflectionClass($bootloader); |
71 | - if (!$refl->hasMethod($method->value)) { |
|
73 | + if (!$refl->hasMethod($method->value)) |
|
74 | + { |
|
72 | 75 | return; |
73 | 76 | } |
74 | 77 | |
75 | 78 | $method = $refl->getMethod($method->value); |
76 | 79 | |
77 | 80 | $args = $this->resolver->resolveArguments($method); |
78 | - if (!isset($args['boot'])) { |
|
81 | + if (!isset($args['boot'])) |
|
82 | + { |
|
79 | 83 | $args['boot'] = $options; |
80 | 84 | } |
81 | 85 | |
@@ -87,7 +91,8 @@ discard block |
||
87 | 91 | */ |
88 | 92 | private function fireCallbacks(array $callbacks): void |
89 | 93 | { |
90 | - foreach ($callbacks as $callback) { |
|
94 | + foreach ($callbacks as $callback) |
|
95 | + { |
|
91 | 96 | $this->invoker->invoke($callback); |
92 | 97 | } |
93 | 98 | } |
@@ -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 |