@@ -26,11 +26,11 @@ discard block |
||
| 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 | ]); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $bootloader = $this->getBootloadManager(); |
| 82 | 82 | |
| 83 | 83 | $bootloader->bootload([ |
| 84 | - new class () extends Bootloader { |
|
| 84 | + new class () extends Bootloader{ |
|
| 85 | 85 | public const BINDINGS = ['abc' => self::class]; |
| 86 | 86 | public const SINGLETONS = ['single' => self::class]; |
| 87 | 87 | |
@@ -26,11 +26,13 @@ discard block |
||
| 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 | ]); |
@@ -81,7 +83,8 @@ discard block |
||
| 81 | 83 | $bootloader = $this->getBootloadManager(); |
| 82 | 84 | |
| 83 | 85 | $bootloader->bootload([ |
| 84 | - new class () extends Bootloader { |
|
| 86 | + new class () extends Bootloader |
|
| 87 | + { |
|
| 85 | 88 | public const BINDINGS = ['abc' => self::class]; |
| 86 | 89 | public const SINGLETONS = ['single' => self::class]; |
| 87 | 90 | |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | #[\Attribute(\Attribute::TARGET_CLASS), NamedArgumentConstructor] |
| 11 | 11 | final class TargetWorker extends BootloadConfig |
| 12 | 12 | { |
| 13 | - public function __construct(array|string $workers) |
|
| 13 | + public function __construct(array | string $workers) |
|
| 14 | 14 | { |
| 15 | 15 | parent::__construct(allowEnv: ['RR_MODE' => $workers]); |
| 16 | 16 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | private readonly InitializerInterface $initializer, |
| 15 | 15 | private readonly InvokerInterface $invoker, |
| 16 | 16 | private readonly ResolverInterface $resolver |
| 17 | - ) { |
|
| 17 | + ){ |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function invokeBootloaders( |
@@ -26,13 +26,13 @@ discard block |
||
| 26 | 26 | /** @psalm-suppress TooManyArguments */ |
| 27 | 27 | $bootloaders = \iterator_to_array($this->initializer->init($classes, $useConfig)); |
| 28 | 28 | |
| 29 | - foreach ($bootloaders as $data) { |
|
| 29 | + foreach ($bootloaders as $data){ |
|
| 30 | 30 | $this->invokeBootloader($data['bootloader'], Methods::INIT, $data['options']); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $this->fireCallbacks($bootingCallbacks); |
| 34 | 34 | |
| 35 | - foreach ($bootloaders as $data) { |
|
| 35 | + foreach ($bootloaders as $data){ |
|
| 36 | 36 | $this->invokeBootloader($data['bootloader'], Methods::BOOT, $data['options']); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -42,14 +42,14 @@ discard block |
||
| 42 | 42 | private function invokeBootloader(BootloaderInterface $bootloader, Methods $method, array $options): void |
| 43 | 43 | { |
| 44 | 44 | $refl = new \ReflectionClass($bootloader); |
| 45 | - if (!$refl->hasMethod($method->value)) { |
|
| 45 | + if (!$refl->hasMethod($method->value)){ |
|
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $method = $refl->getMethod($method->value); |
| 50 | 50 | |
| 51 | 51 | $args = $this->resolver->resolveArguments($method); |
| 52 | - if (!isset($args['boot'])) { |
|
| 52 | + if (!isset($args['boot'])){ |
|
| 53 | 53 | $args['boot'] = $options; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | private function fireCallbacks(array $callbacks): void |
| 63 | 63 | { |
| 64 | - foreach ($callbacks as $callback) { |
|
| 64 | + foreach ($callbacks as $callback){ |
|
| 65 | 65 | $this->invoker->invoke($callback); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -26,13 +26,15 @@ discard block |
||
| 26 | 26 | /** @psalm-suppress TooManyArguments */ |
| 27 | 27 | $bootloaders = \iterator_to_array($this->initializer->init($classes, $useConfig)); |
| 28 | 28 | |
| 29 | - foreach ($bootloaders as $data) { |
|
| 29 | + foreach ($bootloaders as $data) |
|
| 30 | + { |
|
| 30 | 31 | $this->invokeBootloader($data['bootloader'], Methods::INIT, $data['options']); |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | 34 | $this->fireCallbacks($bootingCallbacks); |
| 34 | 35 | |
| 35 | - foreach ($bootloaders as $data) { |
|
| 36 | + foreach ($bootloaders as $data) |
|
| 37 | + { |
|
| 36 | 38 | $this->invokeBootloader($data['bootloader'], Methods::BOOT, $data['options']); |
| 37 | 39 | } |
| 38 | 40 | |
@@ -42,14 +44,16 @@ discard block |
||
| 42 | 44 | private function invokeBootloader(BootloaderInterface $bootloader, Methods $method, array $options): void |
| 43 | 45 | { |
| 44 | 46 | $refl = new \ReflectionClass($bootloader); |
| 45 | - if (!$refl->hasMethod($method->value)) { |
|
| 47 | + if (!$refl->hasMethod($method->value)) |
|
| 48 | + { |
|
| 46 | 49 | return; |
| 47 | 50 | } |
| 48 | 51 | |
| 49 | 52 | $method = $refl->getMethod($method->value); |
| 50 | 53 | |
| 51 | 54 | $args = $this->resolver->resolveArguments($method); |
| 52 | - if (!isset($args['boot'])) { |
|
| 55 | + if (!isset($args['boot'])) |
|
| 56 | + { |
|
| 53 | 57 | $args['boot'] = $options; |
| 54 | 58 | } |
| 55 | 59 | |
@@ -61,7 +65,8 @@ discard block |
||
| 61 | 65 | */ |
| 62 | 66 | private function fireCallbacks(array $callbacks): void |
| 63 | 67 | { |
| 64 | - foreach ($callbacks as $callback) { |
|
| 68 | + foreach ($callbacks as $callback) |
|
| 69 | + { |
|
| 65 | 70 | $this->invoker->invoke($callback); |
| 66 | 71 | } |
| 67 | 72 | } |
@@ -12,5 +12,5 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * @param class-string<BootloaderInterface>|BootloaderInterface $bootloader |
| 14 | 14 | */ |
| 15 | - public function canInitialize(string|BootloaderInterface $bootloader, ?BootloadConfig $config = null): bool; |
|
| 15 | + public function canInitialize(string | BootloaderInterface $bootloader, ?BootloadConfig $config = null): bool; |
|
| 16 | 16 | } |
@@ -13,13 +13,13 @@ |
||
| 13 | 13 | /** |
| 14 | 14 | * @throws ClassNotFoundException |
| 15 | 15 | */ |
| 16 | - public function canInitialize(BootloaderInterface|string $bootloader, ?BootloadConfig $config = null): bool |
|
| 16 | + public function canInitialize(BootloaderInterface | string $bootloader, ?BootloadConfig $config = null): bool |
|
| 17 | 17 | { |
| 18 | - if (!\is_string($bootloader)) { |
|
| 18 | + if (!\is_string($bootloader)){ |
|
| 19 | 19 | return true; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - if (!\class_exists($bootloader)) { |
|
| 22 | + if (!\class_exists($bootloader)){ |
|
| 23 | 23 | throw new ClassNotFoundException(\sprintf('Bootloader class `%s` is not exist.', $bootloader)); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -15,11 +15,13 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function canInitialize(BootloaderInterface|string $bootloader, ?BootloadConfig $config = null): bool |
| 17 | 17 | { |
| 18 | - if (!\is_string($bootloader)) { |
|
| 18 | + if (!\is_string($bootloader)) |
|
| 19 | + { |
|
| 19 | 20 | return true; |
| 20 | 21 | } |
| 21 | 22 | |
| 22 | - if (!\class_exists($bootloader)) { |
|
| 23 | + if (!\class_exists($bootloader)) |
|
| 24 | + { |
|
| 23 | 25 | throw new ClassNotFoundException(\sprintf('Bootloader class `%s` is not exist.', $bootloader)); |
| 24 | 26 | } |
| 25 | 27 | |
@@ -11,13 +11,13 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function __construct( |
| 13 | 13 | private readonly CheckerRegistryInterface $registry = new CheckerRegistry(), |
| 14 | - ) { |
|
| 14 | + ){ |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function canInitialize(BootloaderInterface|string $bootloader, ?BootloadConfig $config = null): bool |
|
| 17 | + public function canInitialize(BootloaderInterface | string $bootloader, ?BootloadConfig $config = null): bool |
|
| 18 | 18 | { |
| 19 | - foreach ($this->registry->getCheckers() as $checker) { |
|
| 20 | - if (!$checker->canInitialize($bootloader, $config)) { |
|
| 19 | + foreach ($this->registry->getCheckers() as $checker){ |
|
| 20 | + if (!$checker->canInitialize($bootloader, $config)){ |
|
| 21 | 21 | return false; |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -16,8 +16,10 @@ |
||
| 16 | 16 | |
| 17 | 17 | public function canInitialize(BootloaderInterface|string $bootloader, ?BootloadConfig $config = null): bool |
| 18 | 18 | { |
| 19 | - foreach ($this->registry->getCheckers() as $checker) { |
|
| 20 | - if (!$checker->canInitialize($bootloader, $config)) { |
|
| 19 | + foreach ($this->registry->getCheckers() as $checker) |
|
| 20 | + { |
|
| 21 | + if (!$checker->canInitialize($bootloader, $config)) |
|
| 22 | + { |
|
| 21 | 23 | return false; |
| 22 | 24 | } |
| 23 | 25 | } |
@@ -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 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | protected readonly BinderInterface $binder, |
| 34 | 34 | protected readonly ClassesRegistry $bootloaders = new ClassesRegistry(), |
| 35 | 35 | ?BootloaderCheckerInterface $checker = null, |
| 36 | - ) { |
|
| 36 | + ){ |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -45,21 +45,21 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $this->checker ??= $this->initDefaultChecker(); |
| 47 | 47 | |
| 48 | - foreach ($classes as $bootloader => $options) { |
|
| 48 | + foreach ($classes as $bootloader => $options){ |
|
| 49 | 49 | // default bootload syntax as simple array |
| 50 | - if (\is_string($options) || $options instanceof BootloaderInterface) { |
|
| 50 | + if (\is_string($options) || $options instanceof BootloaderInterface){ |
|
| 51 | 51 | $bootloader = $options; |
| 52 | 52 | $options = []; |
| 53 | 53 | } |
| 54 | 54 | $options = $useConfig ? $this->getBootloadConfig($bootloader, $options) : []; |
| 55 | 55 | |
| 56 | - if (!$this->checker->canInitialize($bootloader, $useConfig ? $options : null)) { |
|
| 56 | + if (!$this->checker->canInitialize($bootloader, $useConfig ? $options : null)){ |
|
| 57 | 57 | continue; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | $this->bootloaders->register($bootloader instanceof BootloaderInterface ? $bootloader::class : $bootloader); |
| 61 | 61 | |
| 62 | - if (!$bootloader instanceof BootloaderInterface) { |
|
| 62 | + if (!$bootloader instanceof BootloaderInterface){ |
|
| 63 | 63 | $bootloader = $this->container->get($bootloader); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | protected function initBootloader(BootloaderInterface $bootloader): iterable |
| 84 | 84 | { |
| 85 | - if ($bootloader instanceof DependedInterface) { |
|
| 85 | + if ($bootloader instanceof DependedInterface){ |
|
| 86 | 86 | yield from $this->init($this->getDependencies($bootloader)); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | protected function initBindings(array $bindings, array $singletons): void |
| 102 | 102 | { |
| 103 | - foreach ($bindings as $aliases => $resolver) { |
|
| 103 | + foreach ($bindings as $aliases => $resolver){ |
|
| 104 | 104 | $this->binder->bind($aliases, $resolver); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - foreach ($singletons as $aliases => $resolver) { |
|
| 107 | + foreach ($singletons as $aliases => $resolver){ |
|
| 108 | 108 | $this->binder->bindSingleton($aliases, $resolver); |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | $methodsDeps = []; |
| 119 | 119 | |
| 120 | - foreach (Methods::cases() as $method) { |
|
| 121 | - if ($reflectionClass->hasMethod($method->value)) { |
|
| 120 | + foreach (Methods::cases() as $method){ |
|
| 121 | + if ($reflectionClass->hasMethod($method->value)){ |
|
| 122 | 122 | $methodsDeps[] = $this->findBootloaderClassesInMethod( |
| 123 | 123 | $reflectionClass->getMethod($method->value) |
| 124 | 124 | ); |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | protected function findBootloaderClassesInMethod(\ReflectionMethod $method): array |
| 132 | 132 | { |
| 133 | 133 | $args = []; |
| 134 | - foreach ($method->getParameters() as $parameter) { |
|
| 134 | + foreach ($method->getParameters() as $parameter){ |
|
| 135 | 135 | $type = $parameter->getType(); |
| 136 | - if ($type instanceof \ReflectionNamedType && $this->shouldBeBooted($type)) { |
|
| 136 | + if ($type instanceof \ReflectionNamedType && $this->shouldBeBooted($type)){ |
|
| 137 | 137 | $args[] = $type->getName(); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @psalm-pure |
| 155 | 155 | * @psalm-assert-if-true TClass $class |
| 156 | 156 | */ |
| 157 | - protected function isBootloader(string|object $class): bool |
|
| 157 | + protected function isBootloader(string | object $class): bool |
|
| 158 | 158 | { |
| 159 | 159 | return \is_subclass_of($class, BootloaderInterface::class); |
| 160 | 160 | } |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | * @param class-string<BootloaderInterface>|BootloaderInterface $bootloader |
| 176 | 176 | */ |
| 177 | 177 | private function getBootloadConfig( |
| 178 | - string|BootloaderInterface $bootloader, |
|
| 179 | - array|callable|BootloadConfig $config |
|
| 178 | + string | BootloaderInterface $bootloader, |
|
| 179 | + array | callable | BootloadConfig $config |
|
| 180 | 180 | ): BootloadConfig { |
| 181 | - if ($config instanceof \Closure) { |
|
| 181 | + if ($config instanceof \Closure){ |
|
| 182 | 182 | $config = $this->container instanceof ResolverInterface |
| 183 | 183 | ? $config(...$this->container->resolveArguments(new \ReflectionFunction($config))) |
| 184 | 184 | : $config(); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | return match (true) { |
| 190 | 190 | $config instanceof BootloadConfig && $override => $config->{$key}, |
| 191 | 191 | $config instanceof BootloadConfig && !$override && \is_array($default) => |
| 192 | - $config->{$key} + ($attr->{$key} ?? []), |
|
| 192 | + $config->{$key} +($attr->{$key} ?? []), |
|
| 193 | 193 | $config instanceof BootloadConfig && !$override && \is_bool($default) => $config->{$key}, |
| 194 | 194 | \is_array($config) && $config !== [] && $key === 'args' => $config, |
| 195 | 195 | default => $attr->{$key} ?? $default, |
@@ -209,15 +209,15 @@ discard block |
||
| 209 | 209 | /** |
| 210 | 210 | * @param class-string<BootloaderInterface>|BootloaderInterface $bootloader |
| 211 | 211 | */ |
| 212 | - private function getBootloadConfigAttribute(string|BootloaderInterface $bootloader): ?BootloadConfig |
|
| 212 | + private function getBootloadConfigAttribute(string | BootloaderInterface $bootloader): ?BootloadConfig |
|
| 213 | 213 | { |
| 214 | 214 | $attribute = null; |
| 215 | - if ($bootloader instanceof BootloaderInterface || \class_exists($bootloader)) { |
|
| 215 | + if ($bootloader instanceof BootloaderInterface || \class_exists($bootloader)){ |
|
| 216 | 216 | $ref = new \ReflectionClass($bootloader); |
| 217 | 217 | $attribute = $ref->getAttributes(BootloadConfig::class)[0] ?? null; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - if ($attribute === null) { |
|
| 220 | + if ($attribute === null){ |
|
| 221 | 221 | return null; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -45,21 +45,25 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $this->checker ??= $this->initDefaultChecker(); |
| 47 | 47 | |
| 48 | - foreach ($classes as $bootloader => $options) { |
|
| 48 | + foreach ($classes as $bootloader => $options) |
|
| 49 | + { |
|
| 49 | 50 | // default bootload syntax as simple array |
| 50 | - if (\is_string($options) || $options instanceof BootloaderInterface) { |
|
| 51 | + if (\is_string($options) || $options instanceof BootloaderInterface) |
|
| 52 | + { |
|
| 51 | 53 | $bootloader = $options; |
| 52 | 54 | $options = []; |
| 53 | 55 | } |
| 54 | 56 | $options = $useConfig ? $this->getBootloadConfig($bootloader, $options) : []; |
| 55 | 57 | |
| 56 | - if (!$this->checker->canInitialize($bootloader, $useConfig ? $options : null)) { |
|
| 58 | + if (!$this->checker->canInitialize($bootloader, $useConfig ? $options : null)) |
|
| 59 | + { |
|
| 57 | 60 | continue; |
| 58 | 61 | } |
| 59 | 62 | |
| 60 | 63 | $this->bootloaders->register($bootloader instanceof BootloaderInterface ? $bootloader::class : $bootloader); |
| 61 | 64 | |
| 62 | - if (!$bootloader instanceof BootloaderInterface) { |
|
| 65 | + if (!$bootloader instanceof BootloaderInterface) |
|
| 66 | + { |
|
| 63 | 67 | $bootloader = $this->container->get($bootloader); |
| 64 | 68 | } |
| 65 | 69 | |
@@ -82,7 +86,8 @@ discard block |
||
| 82 | 86 | */ |
| 83 | 87 | protected function initBootloader(BootloaderInterface $bootloader): iterable |
| 84 | 88 | { |
| 85 | - if ($bootloader instanceof DependedInterface) { |
|
| 89 | + if ($bootloader instanceof DependedInterface) |
|
| 90 | + { |
|
| 86 | 91 | yield from $this->init($this->getDependencies($bootloader)); |
| 87 | 92 | } |
| 88 | 93 | |
@@ -100,11 +105,13 @@ discard block |
||
| 100 | 105 | */ |
| 101 | 106 | protected function initBindings(array $bindings, array $singletons): void |
| 102 | 107 | { |
| 103 | - foreach ($bindings as $aliases => $resolver) { |
|
| 108 | + foreach ($bindings as $aliases => $resolver) |
|
| 109 | + { |
|
| 104 | 110 | $this->binder->bind($aliases, $resolver); |
| 105 | 111 | } |
| 106 | 112 | |
| 107 | - foreach ($singletons as $aliases => $resolver) { |
|
| 113 | + foreach ($singletons as $aliases => $resolver) |
|
| 114 | + { |
|
| 108 | 115 | $this->binder->bindSingleton($aliases, $resolver); |
| 109 | 116 | } |
| 110 | 117 | } |
@@ -117,8 +124,10 @@ discard block |
||
| 117 | 124 | |
| 118 | 125 | $methodsDeps = []; |
| 119 | 126 | |
| 120 | - foreach (Methods::cases() as $method) { |
|
| 121 | - if ($reflectionClass->hasMethod($method->value)) { |
|
| 127 | + foreach (Methods::cases() as $method) |
|
| 128 | + { |
|
| 129 | + if ($reflectionClass->hasMethod($method->value)) |
|
| 130 | + { |
|
| 122 | 131 | $methodsDeps[] = $this->findBootloaderClassesInMethod( |
| 123 | 132 | $reflectionClass->getMethod($method->value) |
| 124 | 133 | ); |
@@ -131,9 +140,11 @@ discard block |
||
| 131 | 140 | protected function findBootloaderClassesInMethod(\ReflectionMethod $method): array |
| 132 | 141 | { |
| 133 | 142 | $args = []; |
| 134 | - foreach ($method->getParameters() as $parameter) { |
|
| 143 | + foreach ($method->getParameters() as $parameter) |
|
| 144 | + { |
|
| 135 | 145 | $type = $parameter->getType(); |
| 136 | - if ($type instanceof \ReflectionNamedType && $this->shouldBeBooted($type)) { |
|
| 146 | + if ($type instanceof \ReflectionNamedType && $this->shouldBeBooted($type)) |
|
| 147 | + { |
|
| 137 | 148 | $args[] = $type->getName(); |
| 138 | 149 | } |
| 139 | 150 | } |
@@ -178,7 +189,8 @@ discard block |
||
| 178 | 189 | string|BootloaderInterface $bootloader, |
| 179 | 190 | array|callable|BootloadConfig $config |
| 180 | 191 | ): BootloadConfig { |
| 181 | - if ($config instanceof \Closure) { |
|
| 192 | + if ($config instanceof \Closure) |
|
| 193 | + { |
|
| 182 | 194 | $config = $this->container instanceof ResolverInterface |
| 183 | 195 | ? $config(...$this->container->resolveArguments(new \ReflectionFunction($config))) |
| 184 | 196 | : $config(); |
@@ -212,12 +224,14 @@ discard block |
||
| 212 | 224 | private function getBootloadConfigAttribute(string|BootloaderInterface $bootloader): ?BootloadConfig |
| 213 | 225 | { |
| 214 | 226 | $attribute = null; |
| 215 | - if ($bootloader instanceof BootloaderInterface || \class_exists($bootloader)) { |
|
| 227 | + if ($bootloader instanceof BootloaderInterface || \class_exists($bootloader)) |
|
| 228 | + { |
|
| 216 | 229 | $ref = new \ReflectionClass($bootloader); |
| 217 | 230 | $attribute = $ref->getAttributes(BootloadConfig::class)[0] ?? null; |
| 218 | 231 | } |
| 219 | 232 | |
| 220 | - if ($attribute === null) { |
|
| 233 | + if ($attribute === null) |
|
| 234 | + { |
|
| 221 | 235 | return null; |
| 222 | 236 | } |
| 223 | 237 | |