Passed
Pull Request — master (#1017)
by Maxim
22:34
created
src/Boot/tests/BootloadManager/BootloadersTest.php 2 patches
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.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,11 +26,13 @@  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 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
 block discarded – undo
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
 
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 BootloaderRules
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/Attribute/BootloaderRules.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
         public array $allowEnv = [],
16 16
         public array $denyEnv = [],
17 17
         public bool $override = true,
18
-    ) {
18
+    ){
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/DefaultInvokerStrategy.php 2 patches
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, $useRules));
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.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,13 +26,15 @@  discard block
 block discarded – undo
26 26
         /** @psalm-suppress TooManyArguments */
27 27
         $bootloaders = \iterator_to_array($this->initializer->init($classes, $useRules));
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
 block discarded – undo
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
 block discarded – undo
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
     }
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, ?BootloaderRules $rules = null): bool;
15
+    public function canInitialize(string | BootloaderInterface $bootloader, ?BootloaderRules $rules = null): bool;
16 16
 }
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/Checker/RulesChecker.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,29 +12,29 @@
 block discarded – undo
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, ?BootloaderRules $rules = null): bool
18
+    public function canInitialize(BootloaderInterface | string $bootloader, ?BootloaderRules $rules = null): bool
19 19
     {
20
-        if ($rules === null) {
20
+        if ($rules === null){
21 21
             return true;
22 22
         }
23 23
 
24
-        if (!$rules->enabled) {
24
+        if (!$rules->enabled){
25 25
             return false;
26 26
         }
27 27
 
28
-        foreach ($rules->denyEnv as $env => $denyValues) {
28
+        foreach ($rules->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 ($rules->allowEnv as $env => $allowValues) {
35
+        foreach ($rules->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
         }
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,24 +17,30 @@
 block discarded – undo
17 17
 
18 18
     public function canInitialize(BootloaderInterface|string $bootloader, ?BootloaderRules $rules = null): bool
19 19
     {
20
-        if ($rules === null) {
20
+        if ($rules === null)
21
+        {
21 22
             return true;
22 23
         }
23 24
 
24
-        if (!$rules->enabled) {
25
+        if (!$rules->enabled)
26
+        {
25 27
             return false;
26 28
         }
27 29
 
28
-        foreach ($rules->denyEnv as $env => $denyValues) {
30
+        foreach ($rules->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 ($rules->allowEnv as $env => $allowValues) {
39
+        foreach ($rules->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
         }
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/Checker/ClassExistsChecker.php 2 patches
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, ?BootloaderRules $rules = null): bool
16
+    public function canInitialize(BootloaderInterface | string $bootloader, ?BootloaderRules $rules = 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.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,11 +15,13 @@
 block discarded – undo
15 15
      */
16 16
     public function canInitialize(BootloaderInterface|string $bootloader, ?BootloaderRules $rules = 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
 
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/Checker/BootloaderChecker.php 2 patches
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, ?BootloaderRules $rules = null): bool
17
+    public function canInitialize(BootloaderInterface | string $bootloader, ?BootloaderRules $rules = null): bool
18 18
     {
19
-        foreach ($this->registry->getCheckers() as $checker) {
20
-            if (!$checker->canInitialize($bootloader, $rules)) {
19
+        foreach ($this->registry->getCheckers() as $checker){
20
+            if (!$checker->canInitialize($bootloader, $rules)){
21 21
                 return false;
22 22
             }
23 23
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,10 @@
 block discarded – undo
16 16
 
17 17
     public function canInitialize(BootloaderInterface|string $bootloader, ?BootloaderRules $rules = null): bool
18 18
     {
19
-        foreach ($this->registry->getCheckers() as $checker) {
20
-            if (!$checker->canInitialize($bootloader, $rules)) {
19
+        foreach ($this->registry->getCheckers() as $checker)
20
+        {
21
+            if (!$checker->canInitialize($bootloader, $rules))
22
+            {
21 23
                 return false;
22 24
             }
23 25
         }
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, ?BootloaderRules $rules = null): bool
18
+    public function canInitialize(BootloaderInterface | string $bootloader, ?BootloaderRules $rules = null): bool
19 19
     {
20 20
         $ref = new \ReflectionClass($bootloader);
21 21
 
Please login to merge, or discard this patch.