Passed
Pull Request — master (#1017)
by Maxim
12:07
created
src/Boot/tests/BootloadManager/BootloadersTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Boot/tests/Fixtures/Attribute/TargetWorker.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/DefaultInvokerStrategy.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/Checker/BootloaderCheckerInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,5 +12,5 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/Checker/ClassExistsChecker.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/Checker/BootloaderChecker.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/Checker/CanBootedChecker.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/Initializer.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.