Passed
Pull Request — master (#840)
by Maxim
07:32
created
src/Boot/src/BootloadManager/Initializer.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         protected readonly ContainerInterface $container,
24 24
         protected readonly BinderInterface $binder,
25 25
         protected readonly ClassesRegistry $bootloaders = new ClassesRegistry()
26
-    ) {
26
+    ){
27 27
     }
28 28
 
29 29
     /**
@@ -33,34 +33,34 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function init(array $classes): \Generator
35 35
     {
36
-        foreach ($classes as $bootloader => $options) {
36
+        foreach ($classes as $bootloader => $options){
37 37
             // default bootload syntax as simple array
38
-            if (\is_string($options) || $options instanceof BootloaderInterface) {
38
+            if (\is_string($options) || $options instanceof BootloaderInterface){
39 39
                 $bootloader = $options;
40 40
                 $options = [];
41 41
             }
42 42
 
43 43
             // Replace class aliases with source classes
44
-            try {
44
+            try{
45 45
                 $ref = (new \ReflectionClass($bootloader));
46 46
                 $className = $ref->getName();
47
-            } catch (\ReflectionException) {
47
+            }catch (\ReflectionException){
48 48
                 throw new ClassNotFoundException(
49 49
                     \sprintf('Bootloader class `%s` is not exist.', $bootloader)
50 50
                 );
51 51
             }
52 52
 
53
-            if ($this->bootloaders->isBooted($className) || $ref->isAbstract()) {
53
+            if ($this->bootloaders->isBooted($className) || $ref->isAbstract()){
54 54
                 continue;
55 55
             }
56 56
 
57 57
             $this->bootloaders->register($className);
58 58
 
59
-            if (!$bootloader instanceof BootloaderInterface) {
59
+            if (!$bootloader instanceof BootloaderInterface){
60 60
                 $bootloader = $this->container->get($bootloader);
61 61
             }
62 62
 
63
-            if (!$this->isBootloader($bootloader)) {
63
+            if (!$this->isBootloader($bootloader)){
64 64
                 continue;
65 65
             }
66 66
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     protected function initBootloader(BootloaderInterface $bootloader): iterable
82 82
     {
83
-        if ($bootloader instanceof DependedInterface) {
83
+        if ($bootloader instanceof DependedInterface){
84 84
             yield from $this->init($this->getDependencies($bootloader));
85 85
         }
86 86
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
      */
99 99
     protected function initBindings(array $bindings, array $singletons): void
100 100
     {
101
-        foreach ($bindings as $aliases => $resolver) {
101
+        foreach ($bindings as $aliases => $resolver){
102 102
             $this->binder->bind($aliases, $resolver);
103 103
         }
104 104
 
105
-        foreach ($singletons as $aliases => $resolver) {
105
+        foreach ($singletons as $aliases => $resolver){
106 106
             $this->binder->bindSingleton($aliases, $resolver);
107 107
         }
108 108
     }
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 
116 116
         $methodsDeps = [];
117 117
 
118
-        foreach (Methods::cases() as $method) {
119
-            if ($reflectionClass->hasMethod($method->value)) {
118
+        foreach (Methods::cases() as $method){
119
+            if ($reflectionClass->hasMethod($method->value)){
120 120
                 $methodsDeps[] = $this->findBootloaderClassesInMethod(
121 121
                     $reflectionClass->getMethod($method->value)
122 122
                 );
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
     protected function findBootloaderClassesInMethod(\ReflectionMethod $method): array
130 130
     {
131 131
         $args = [];
132
-        foreach ($method->getParameters() as $parameter) {
132
+        foreach ($method->getParameters() as $parameter){
133 133
             $type = $parameter->getType();
134
-            if ($type instanceof \ReflectionNamedType && $this->shouldBeBooted($type)) {
134
+            if ($type instanceof \ReflectionNamedType && $this->shouldBeBooted($type)){
135 135
                 $args[] = $type->getName();
136 136
             }
137 137
         }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      * @psalm-pure
154 154
      * @psalm-assert-if-true TClass $class
155 155
      */
156
-    protected function isBootloader(string|object $class): bool
156
+    protected function isBootloader(string | object $class): bool
157 157
     {
158 158
         return \is_subclass_of($class, BootloaderInterface::class);
159 159
     }
Please login to merge, or discard this patch.
src/Boot/tests/BootloadManager/BootloadersTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
             SampleBootWithMethodBoot::class,
29 29
             SampleBoot::class,
30 30
         ], [
31
-            static function(Container $container, SampleBoot $boot) {
31
+            static function (Container $container, SampleBoot $boot){
32 32
                 $container->bind('efg', $boot);
33 33
             }
34 34
         ], [
35
-            static function(Container $container, SampleBoot $boot) {
35
+            static function (Container $container, SampleBoot $boot){
36 36
                 $container->bind('ghi', $boot);
37 37
             }
38 38
         ]);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $bootloader = $this->getBootloadManager($container);
88 88
 
89 89
         $bootloader->bootload([
90
-            new class () extends Bootloader {
90
+            new class () extends Bootloader{
91 91
                 public const BINDINGS = ['abc' => self::class];
92 92
                 public const SINGLETONS = ['single' => self::class];
93 93
 
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/CustomizableBootloadManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
         private readonly InvokerStrategyInterface $invoker,
13 13
         ScopeInterface $scope,
14 14
         InitializerInterface $initializer
15
-    ) {
15
+    ){
16 16
         parent::__construct($scope, $initializer);
17 17
     }
18 18
 
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/AbstractBootloadManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     public function __construct(
17 17
         private readonly ScopeInterface $scope,
18 18
         protected readonly InitializerInterface $initializer
19
-    ) {
19
+    ){
20 20
     }
21 21
 
22 22
     public function getClasses(): array
Please login to merge, or discard this patch.
src/Boot/src/AbstractKernel.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         protected readonly ExceptionHandlerInterface $exceptionHandler,
65 65
         protected readonly BootloadManagerInterface $bootloader,
66 66
         array $directories
67
-    ) {
67
+    ){
68 68
         $container->bindSingleton(ExceptionHandlerInterface::class, $exceptionHandler);
69 69
         $container->bindSingleton(ExceptionRendererInterface::class, $exceptionHandler);
70 70
         $container->bindSingleton(ExceptionReporterInterface::class, $exceptionHandler);
@@ -103,28 +103,28 @@  discard block
 block discarded – undo
103 103
     final public static function create(
104 104
         array $directories,
105 105
         bool $handleErrors = true,
106
-        ExceptionHandlerInterface|string|null $exceptionHandler = null,
106
+        ExceptionHandlerInterface | string | null $exceptionHandler = null,
107 107
         Container $container = new Container(),
108
-        BootloadManagerInterface|Autowire|null $bootloadManager = null
108
+        BootloadManagerInterface | Autowire | null $bootloadManager = null
109 109
     ): static {
110 110
         $exceptionHandler ??= ExceptionHandler::class;
111 111
 
112
-        if (\is_string($exceptionHandler)) {
112
+        if (\is_string($exceptionHandler)){
113 113
             $exceptionHandler = $container->make($exceptionHandler);
114 114
         }
115 115
 
116
-        if ($handleErrors) {
116
+        if ($handleErrors){
117 117
             $exceptionHandler->register();
118 118
         }
119 119
 
120
-        if (!$container->has(InitializerInterface::class)) {
120
+        if (!$container->has(InitializerInterface::class)){
121 121
             $container->bind(InitializerInterface::class, Initializer::class);
122 122
         }
123
-        if (!$container->has(InvokerStrategyInterface::class)) {
123
+        if (!$container->has(InvokerStrategyInterface::class)){
124 124
             $container->bind(InvokerStrategyInterface::class, DefaultInvokerStrategy::class);
125 125
         }
126 126
 
127
-        if ($bootloadManager instanceof Autowire) {
127
+        if ($bootloadManager instanceof Autowire){
128 128
             $bootloadManager = $bootloadManager->resolve($container);
129 129
         }
130 130
         $bootloadManager ??= $container->make(CustomizableBootloadManager::class);
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
         $this->fireCallbacks($this->runningCallbacks);
160 160
 
161
-        try {
161
+        try{
162 162
             // will protect any against env overwrite action
163 163
             $this->container->runScope(
164 164
                 [EnvironmentInterface::class => $environment],
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                     $this->fireCallbacks($this->bootstrappedCallbacks);
170 170
                 }
171 171
             );
172
-        } catch (\Throwable $e) {
172
+        }catch (\Throwable $e){
173 173
             $this->exceptionHandler->handleGlobalException($e);
174 174
 
175 175
             return null;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      */
191 191
     public function running(Closure ...$callbacks): void
192 192
     {
193
-        foreach ($callbacks as $callback) {
193
+        foreach ($callbacks as $callback){
194 194
             $this->runningCallbacks[] = $callback;
195 195
         }
196 196
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function booting(Closure ...$callbacks): void
207 207
     {
208
-        foreach ($callbacks as $callback) {
208
+        foreach ($callbacks as $callback){
209 209
             $this->bootingCallbacks[] = $callback;
210 210
         }
211 211
     }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      */
221 221
     public function booted(Closure ...$callbacks): void
222 222
     {
223
-        foreach ($callbacks as $callback) {
223
+        foreach ($callbacks as $callback){
224 224
             $this->bootedCallbacks[] = $callback;
225 225
         }
226 226
     }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     public function bootstrapped(Closure ...$callbacks): void
238 238
     {
239
-        foreach ($callbacks as $callback) {
239
+        foreach ($callbacks as $callback){
240 240
             $this->bootstrappedCallbacks[] = $callback;
241 241
         }
242 242
     }
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
         $eventDispatcher = $this->getEventDispatcher();
265 265
         $eventDispatcher?->dispatch(new Serving());
266 266
 
267
-        foreach ($this->dispatchers as $dispatcher) {
268
-            if ($dispatcher->canServe()) {
267
+        foreach ($this->dispatchers as $dispatcher){
268
+            if ($dispatcher->canServe()){
269 269
                 return $this->container->runScope(
270 270
                     [DispatcherInterface::class => $dispatcher],
271 271
                     static function () use ($dispatcher, $eventDispatcher): mixed {
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
      */
307 307
     protected function fireCallbacks(array &$callbacks): void
308 308
     {
309
-        if ($callbacks === []) {
309
+        if ($callbacks === []){
310 310
             return;
311 311
         }
312 312
 
313
-        do {
313
+        do{
314 314
             $this->container->invoke(\current($callbacks));
315
-        } while (\next($callbacks));
315
+        }while (\next($callbacks));
316 316
 
317 317
         $callbacks = [];
318 318
     }
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/BootloadManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         private readonly ResolverInterface $resolver,
22 22
         InitializerInterface $initializer,
23 23
         ?InvokerStrategyInterface $invokerStrategy = null
24
-    ) {
24
+    ){
25 25
         parent::__construct($scope, $initializer);
26 26
 
27 27
         $this->invokerStrategy = $invokerStrategy ?? new DefaultInvokerStrategy(...$this->resolver->resolveArguments(
Please login to merge, or discard this patch.