Passed
Pull Request — master (#806)
by Maxim
13:31 queued 06:35
created
src/Bridge/Stempler/src/StemplerEngine.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         private readonly ContainerInterface $container,
46 46
         private readonly StemplerConfig $config,
47 47
         private readonly ?StemplerCache $cache = null
48
-    ) {
48
+    ){
49 49
     }
50 50
 
51 51
     public function getContainer(): ContainerInterface
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
     public function getLoader(): LoaderInterface
66 66
     {
67
-        if ($this->loader === null) {
67
+        if ($this->loader === null){
68 68
             throw new EngineException('No associated loader found');
69 69
         }
70 70
 
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function getBuilder(ContextInterface $context): Builder
78 78
     {
79
-        if ($this->builder === null) {
79
+        if ($this->builder === null){
80 80
             throw new EngineException('No associated builder found');
81 81
         }
82 82
 
83 83
         // since view source support pre-processing we must ensure that context is always set
84 84
         $loader = $this->builder->getLoader();
85
-        if ($loader instanceof StemplerLoader) {
85
+        if ($loader instanceof StemplerLoader){
86 86
             $loader->setContext($context);
87 87
         }
88 88
 
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
         // cache key
101 101
         $key = $this->cacheKey($view, $context);
102 102
 
103
-        if ($this->cache !== null && $this->cache->isFresh($key)) {
103
+        if ($this->cache !== null && $this->cache->isFresh($key)){
104 104
             $this->cache->load($key);
105
-        } elseif (!\class_exists($class)) {
106
-            try {
105
+        } elseif (!\class_exists($class)){
106
+            try{
107 107
                 $builder = $this->getBuilder($context);
108 108
 
109 109
                 $result = $builder->compile($path);
110
-            } catch (Throwable $e) {
110
+            }catch (Throwable $e){
111 111
                 throw new CompileException($e);
112 112
             }
113 113
 
114 114
             $compiled = $this->compileClass($class, $result);
115 115
 
116
-            if ($this->cache !== null) {
116
+            if ($this->cache !== null){
117 117
                 $this->cache->write(
118 118
                     $key,
119 119
                     $compiled,
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
                 $this->cache->load($key);
127 127
             }
128 128
 
129
-            if (!\class_exists($class)) {
129
+            if (!\class_exists($class)){
130 130
                 // runtime initialization
131
-                eval('?>' . $compiled);
131
+                eval('?>'.$compiled);
132 132
             }
133 133
         }
134 134
 
135
-        if (!\class_exists($class) || !\is_subclass_of($class, ViewInterface::class)) {
135
+        if (!\class_exists($class) || !\is_subclass_of($class, ViewInterface::class)){
136 136
             throw new EngineException(\sprintf('Unable to load `%s`, cache might be corrupted.', $path));
137 137
         }
138 138
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
     public function reset(string $path, ContextInterface $context): void
143 143
     {
144
-        if ($this->cache === null) {
144
+        if ($this->cache === null){
145 145
             return;
146 146
         }
147 147
 
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function makeSourceMap(string $path, ContextInterface $context): ?SourceMap
162 162
     {
163
-        try {
163
+        try{
164 164
             $builder = $this->getBuilder($context);
165 165
 
166 166
             // there is no need to cache sourcemaps since they are used during the exception only
167 167
             return $builder->compile($path)->getSourceMap($builder->getLoader());
168
-        } catch (Throwable) {
168
+        }catch (Throwable){
169 169
             return null;
170 170
         }
171 171
     }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     private function className(ViewSource $source, ContextInterface $context): string
203 203
     {
204 204
         /** @psalm-suppress LessSpecificReturnStatement */
205
-        return $this->classPrefix . $this->cacheKey($source, $context);
205
+        return $this->classPrefix.$this->cacheKey($source, $context);
206 206
     }
207 207
 
208 208
     private function cacheKey(ViewSource $source, ContextInterface $context): string
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
         $builder = new Builder($loader);
223 223
 
224 224
         $directivesGroup = new DirectiveGroup();
225
-        foreach ($this->getDirectives() as $directive) {
225
+        foreach ($this->getDirectives() as $directive){
226 226
             $directivesGroup->addDirective($directive);
227 227
         }
228 228
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $builder->getCompiler()->addRenderer(new DynamicRenderer(new DirectiveGroup($this->getDirectives())));
254 254
 
255 255
         // ATS modifications
256
-        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor) {
256
+        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor){
257 257
             $builder->addVisitor($visitor, Builder::STAGE_PREPARE);
258 258
         }
259 259
 
@@ -266,15 +266,15 @@  discard block
 block discarded – undo
266 266
         $builder->addVisitor(new ResolveImports($builder), Builder::STAGE_TRANSFORM);
267 267
         $builder->addVisitor(new ExtendsParent($builder), Builder::STAGE_TRANSFORM);
268 268
 
269
-        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor) {
269
+        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor){
270 270
             $builder->addVisitor($visitor, Builder::STAGE_TRANSFORM);
271 271
         }
272 272
 
273
-        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor) {
273
+        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor){
274 274
             $builder->addVisitor($visitor, Builder::STAGE_FINALIZE);
275 275
         }
276 276
 
277
-        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor) {
277
+        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor){
278 278
             $builder->addVisitor($visitor, Builder::STAGE_COMPILE);
279 279
         }
280 280
 
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
     private function getVisitors(int $stage): iterable
288 288
     {
289 289
         $result = [];
290
-        foreach ($this->config->getVisitors($stage) as $visitor) {
291
-            if ($visitor instanceof Autowire) {
290
+        foreach ($this->config->getVisitors($stage) as $visitor){
291
+            if ($visitor instanceof Autowire){
292 292
                 $result[] = $visitor->resolve($this->container->get(FactoryInterface::class));
293 293
                 continue;
294 294
             }
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
     private function getProcessors(): iterable
306 306
     {
307 307
         $result = [];
308
-        foreach ($this->config->getProcessors() as $processor) {
309
-            if ($processor instanceof Autowire) {
308
+        foreach ($this->config->getProcessors() as $processor){
309
+            if ($processor instanceof Autowire){
310 310
                 $result[] = $processor->resolve($this->container->get(FactoryInterface::class));
311 311
                 continue;
312 312
             }
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
     private function getDirectives(): iterable
324 324
     {
325 325
         $result = [];
326
-        foreach ($this->config->getDirectives() as $directive) {
327
-            if ($directive instanceof Autowire) {
326
+        foreach ($this->config->getDirectives() as $directive){
327
+            if ($directive instanceof Autowire){
328 328
                 $result[] = $directive->resolve($this->container->get(FactoryInterface::class));
329 329
                 continue;
330 330
             }
Please login to merge, or discard this patch.
src/Boot/tests/Fixtures/TestCore.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,25 +43,25 @@
 block discarded – undo
43 43
      */
44 44
     protected function mapDirectories(array $directories): array
45 45
     {
46
-        if (!isset($directories['root'])) {
46
+        if (!isset($directories['root'])){
47 47
             throw new BootException('Missing required directory `root`.');
48 48
         }
49 49
 
50
-        if (!isset($directories['app'])) {
51
-            $directories['app'] = $directories['root'] . '/app/';
50
+        if (!isset($directories['app'])){
51
+            $directories['app'] = $directories['root'].'/app/';
52 52
         }
53 53
 
54 54
         return array_merge([
55 55
             // public root
56
-            'public'    => $directories['root'] . '/public/',
56
+            'public'    => $directories['root'].'/public/',
57 57
 
58 58
             // data directories
59
-            'runtime'   => $directories['root'] . '/runtime/',
60
-            'cache'     => $directories['root'] . '/runtime/cache/',
59
+            'runtime'   => $directories['root'].'/runtime/',
60
+            'cache'     => $directories['root'].'/runtime/cache/',
61 61
 
62 62
             // application directories
63
-            'config'    => $directories['app'] . '/config/',
64
-            'resources' => $directories['app'] . '/resources/',
63
+            'config'    => $directories['app'].'/config/',
64
+            'resources' => $directories['app'].'/resources/',
65 65
         ], $directories);
66 66
     }
67 67
 
Please login to merge, or discard this patch.
src/Boot/tests/KernelTest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             'root' => __DIR__,
43 43
         ])->run();
44 44
 
45
-        $d = new class() implements DispatcherInterface {
45
+        $d = new class() implements DispatcherInterface{
46 46
             public $fired = false;
47 47
 
48 48
             public function canServe(): bool
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             'root' => __DIR__,
72 72
         ])->run();
73 73
 
74
-        $d = new class() implements DispatcherInterface {
74
+        $d = new class() implements DispatcherInterface{
75 75
             public function canServe(): bool
76 76
             {
77 77
                 return true;
@@ -109,19 +109,19 @@  discard block
 block discarded – undo
109 109
             'root' => __DIR__,
110 110
         ]);
111 111
 
112
-        $kernel->booting(static function (TestCore $core) {
112
+        $kernel->booting(static function (TestCore $core){
113 113
             $core->getContainer()->bind('abc', 'foo');
114 114
         });
115 115
 
116
-        $kernel->booting(static function (TestCore $core) {
116
+        $kernel->booting(static function (TestCore $core){
117 117
             $core->getContainer()->bind('bcd', 'foo');
118 118
         });
119 119
 
120
-        $kernel->booted( static function (TestCore $core) {
120
+        $kernel->booted(static function (TestCore $core){
121 121
             $core->getContainer()->bind('cde', 'foo');
122 122
         });
123 123
 
124
-        $kernel->booted( static function (TestCore $core) {
124
+        $kernel->booted(static function (TestCore $core){
125 125
             $core->getContainer()->bind('def', 'foo');
126 126
         });
127 127
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
     public function testEventsShouldBeDispatched(): void
146 146
     {
147
-        $testDispatcher = new class implements DispatcherInterface {
147
+        $testDispatcher = new class implements DispatcherInterface{
148 148
             public function canServe(): bool
149 149
             {
150 150
                 return true;
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         };
157 157
 
158 158
         $container = new Container();
159
-        $kernel = TestCore::create(directories: ['root' => __DIR__,], container: $container)
159
+        $kernel = TestCore::create(directories: ['root' => __DIR__, ], container: $container)
160 160
             ->addDispatcher($testDispatcher);
161 161
 
162 162
         $dispatcher = $this->createMock(EventDispatcherInterface::class);
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     public function testDispatcherNotFoundEventShouldBeDispatched(): void
178 178
     {
179 179
         $container = new Container();
180
-        $kernel = TestCore::create(directories: ['root' => __DIR__,], container: $container);
180
+        $kernel = TestCore::create(directories: ['root' => __DIR__, ], container: $container);
181 181
 
182 182
         $dispatcher = $this->createMock(EventDispatcherInterface::class);
183 183
         $dispatcher
Please login to merge, or discard this patch.
src/Tokenizer/src/Bootloader/TokenizerListenerBootloader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     public function boot(AbstractKernel $kernel): void
35 35
     {
36 36
         $kernel->bootstrapped(function (ClassesInterface $classes): void {
37
-            foreach ($classes->getClasses() as $class) {
37
+            foreach ($classes->getClasses() as $class){
38 38
                 $this->invokeListeners($class);
39 39
             }
40 40
 
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
 
45 45
     private function invokeListeners(\ReflectionClass $class): void
46 46
     {
47
-        foreach ($this->listeners as $listener) {
47
+        foreach ($this->listeners as $listener){
48 48
             $listener->listen($class);
49 49
         }
50 50
     }
51 51
 
52 52
     private function finalize(): void
53 53
     {
54
-        foreach ($this->listeners as $listener) {
54
+        foreach ($this->listeners as $listener){
55 55
             $listener->finalize();
56 56
         }
57 57
 
Please login to merge, or discard this patch.
src/Validation/src/ValidationProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
     public function __construct(
17 17
         private readonly InvokerInterface $invoker
18
-    ) {
18
+    ){
19 19
     }
20 20
 
21 21
     /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function getValidation(string $name, array $params = []): ValidationInterface
33 33
     {
34
-        if (!isset($this->resolvers[$name])) {
34
+        if (!isset($this->resolvers[$name])){
35 35
             throw new ValidationException(\sprintf('Validation with name `%s` is not registered.', $name));
36 36
         }
37 37
 
Please login to merge, or discard this patch.
src/Framework/Filter/InputScope.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function __construct(
17 17
         private InputManager $input
18
-    ) {
18
+    ){
19 19
     }
20 20
 
21 21
     public function withPrefix(string $prefix, bool $add = true): InputInterface
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function getValue(string $source, mixed $name = null): mixed
30 30
     {
31
-        if ($source !== 'input' && !$this->input->hasBag($source)) {
31
+        if ($source !== 'input' && !$this->input->hasBag($source)){
32 32
             throw new InputException(\sprintf('Undefined input source %s', $source));
33 33
         }
34 34
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function hasValue(string $source, string $name): bool
39 39
     {
40
-        if (!$this->input->hasBag($source)) {
40
+        if (!$this->input->hasBag($source)){
41 41
             return false;
42 42
         }
43 43
 
Please login to merge, or discard this patch.
src/Stempler/src/Transform/Import/Bundle.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,25 +23,25 @@
 block discarded – undo
23 23
         private string $path,
24 24
         private ?string $prefix = null,
25 25
         Context $context = null
26
-    ) {
26
+    ){
27 27
         $this->context = $context;
28 28
     }
29 29
 
30 30
     public function resolve(Builder $builder, string $name): ?Template
31 31
     {
32
-        if ($this->template === null) {
32
+        if ($this->template === null){
33 33
             $this->template = $builder->load($this->path);
34 34
         }
35 35
 
36 36
         $path = $name;
37
-        if ($this->prefix !== null) {
37
+        if ($this->prefix !== null){
38 38
             $path = \substr($path, \strlen($this->prefix) + 1);
39 39
         }
40 40
 
41 41
         /** @var ImportInterface $import */
42
-        foreach ($this->template->getAttribute(ImportContext::class, []) as $import) {
42
+        foreach ($this->template->getAttribute(ImportContext::class, []) as $import){
43 43
             $tpl = $import->resolve($builder, $path);
44
-            if ($tpl !== null) {
44
+            if ($tpl !== null){
45 45
                 return $tpl;
46 46
             }
47 47
         }
Please login to merge, or discard this patch.