Test Failed
Pull Request — master (#917)
by Maxim
07:57
created
src/Scaffolder/tests/BaseTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     public function setUp(): void
23 23
     {
24 24
         $this->app = TestApp::create([
25
-            'root' => __DIR__ . '/App',
25
+            'root' => __DIR__.'/App',
26 26
         ], false)->run();
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Scaffolder/src/Config/ScaffolderConfig.php 2 patches
Braces   +21 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,11 +47,13 @@  discard block
 block discarded – undo
47 47
         $localNamespace = \trim($this->getOption($element, 'namespace', ''), '\\');
48 48
         ['namespace' => $namespace] = $this->parseName($name);
49 49
 
50
-        if (!empty($namespace)) {
50
+        if (!empty($namespace))
51
+        {
51 52
             $localNamespace .= '\\' . $this->classify($namespace);
52 53
         }
53 54
 
54
-        if (empty($this->baseNamespace($element))) {
55
+        if (empty($this->baseNamespace($element)))
56
+        {
55 57
             return $localNamespace;
56 58
         }
57 59
 
@@ -77,7 +79,8 @@  discard block
 block discarded – undo
77 79
     {
78 80
         $class = $this->getOption($element, 'class');
79 81
 
80
-        if (empty($class)) {
82
+        if (empty($class))
83
+        {
81 84
             throw new ScaffolderException(
82 85
                 \sprintf("Unable to scaffold '%s', no declaration class found", $element)
83 86
             );
@@ -101,11 +104,13 @@  discard block
 block discarded – undo
101 104
 
102 105
     private function getOption(string $element, string $section, mixed $default = null): mixed
103 106
     {
104
-        if (!isset($this->config['declarations'][$element])) {
107
+        if (!isset($this->config['declarations'][$element]))
108
+        {
105 109
             throw new ScaffolderException(\sprintf("Undefined declaration '%s'.", $element));
106 110
         }
107 111
 
108
-        if (\array_key_exists($section, $this->config['declarations'][$element])) {
112
+        if (\array_key_exists($section, $this->config['declarations'][$element]))
113
+        {
109 114
             return $this->config['declarations'][$element][$section];
110 115
         }
111 116
 
@@ -121,7 +126,8 @@  discard block
 block discarded – undo
121 126
     {
122 127
         $name = \str_replace('/', '\\', $name);
123 128
 
124
-        if (str_contains($name, '\\')) {
129
+        if (str_contains($name, '\\'))
130
+        {
125 131
             $names = \explode('\\', $name);
126 132
             $class = \array_pop($names);
127 133
 
@@ -134,7 +140,8 @@  discard block
 block discarded – undo
134 140
 
135 141
     private function baseNamespace(string $element): string
136 142
     {
137
-        if (\array_key_exists('baseNamespace', $this->config['declarations'][$element])) {
143
+        if (\array_key_exists('baseNamespace', $this->config['declarations'][$element]))
144
+        {
138 145
             return \trim((string) $this->getOption($element, 'baseNamespace', ''), '\\');
139 146
         }
140 147
 
@@ -145,11 +152,15 @@  discard block
 block discarded – undo
145 152
     {
146 153
         $firstChunkIterated = false;
147 154
         $joinedPath = '';
148
-        foreach ($chunks as $chunk) {
149
-            if (!$firstChunkIterated) {
155
+        foreach ($chunks as $chunk)
156
+        {
157
+            if (!$firstChunkIterated)
158
+            {
150 159
                 $firstChunkIterated = true;
151 160
                 $joinedPath = $chunk;
152
-            } else {
161
+            }
162
+            else
163
+            {
153 164
                 $joinedPath = \rtrim($joinedPath, $joint) . $joint . \ltrim($chunk, $joint);
154 165
             }
155 166
         }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $class = $this->classify($name);
40 40
         $postfix = $this->elementPostfix($element);
41 41
 
42
-        return \str_ends_with($class, $postfix) ? $class : $class . $postfix;
42
+        return \str_ends_with($class, $postfix) ? $class : $class.$postfix;
43 43
     }
44 44
 
45 45
     public function classNamespace(string $element, string $name = ''): string
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
         $localNamespace = \trim($this->getOption($element, 'namespace', ''), '\\');
48 48
         ['namespace' => $namespace] = $this->parseName($name);
49 49
 
50
-        if (!empty($namespace)) {
51
-            $localNamespace .= '\\' . $this->classify($namespace);
50
+        if (!empty($namespace)){
51
+            $localNamespace .= '\\'.$this->classify($namespace);
52 52
         }
53 53
 
54
-        if (empty($this->baseNamespace($element))) {
54
+        if (empty($this->baseNamespace($element))){
55 55
             return $localNamespace;
56 56
         }
57 57
 
58
-        return \trim($this->baseNamespace($element) . '\\' . $localNamespace, '\\');
58
+        return \trim($this->baseNamespace($element).'\\'.$localNamespace, '\\');
59 59
     }
60 60
 
61 61
     public function classFilename(string $element, string $name, ?string $namespace = null): string
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         return $this->joinPathChunks([
67 67
             $this->baseDirectory(),
68 68
             \str_replace('\\', '/', $elementNamespace),
69
-            $this->className($element, $name) . '.php',
69
+            $this->className($element, $name).'.php',
70 70
         ], '/');
71 71
     }
72 72
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $class = $this->getOption($element, 'class');
79 79
 
80
-        if (empty($class)) {
80
+        if (empty($class)){
81 81
             throw new ScaffolderException(
82 82
                 \sprintf("Unable to scaffold '%s', no declaration class found", $element)
83 83
             );
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 
102 102
     private function getOption(string $element, string $section, mixed $default = null): mixed
103 103
     {
104
-        if (!isset($this->config['declarations'][$element])) {
104
+        if (!isset($this->config['declarations'][$element])){
105 105
             throw new ScaffolderException(\sprintf("Undefined declaration '%s'.", $element));
106 106
         }
107 107
 
108
-        if (\array_key_exists($section, $this->config['declarations'][$element])) {
108
+        if (\array_key_exists($section, $this->config['declarations'][$element])){
109 109
             return $this->config['declarations'][$element][$section];
110 110
         }
111 111
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $name = \str_replace('/', '\\', $name);
123 123
 
124
-        if (str_contains($name, '\\')) {
124
+        if (str_contains($name, '\\')){
125 125
             $names = \explode('\\', $name);
126 126
             $class = \array_pop($names);
127 127
 
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 
135 135
     private function baseNamespace(string $element): string
136 136
     {
137
-        if (\array_key_exists('baseNamespace', $this->config['declarations'][$element])) {
138
-            return \trim((string) $this->getOption($element, 'baseNamespace', ''), '\\');
137
+        if (\array_key_exists('baseNamespace', $this->config['declarations'][$element])){
138
+            return \trim((string)$this->getOption($element, 'baseNamespace', ''), '\\');
139 139
         }
140 140
 
141 141
         return \trim($this->config['namespace'], '\\');
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
     {
146 146
         $firstChunkIterated = false;
147 147
         $joinedPath = '';
148
-        foreach ($chunks as $chunk) {
149
-            if (!$firstChunkIterated) {
148
+        foreach ($chunks as $chunk){
149
+            if (!$firstChunkIterated){
150 150
                 $firstChunkIterated = true;
151 151
                 $joinedPath = $chunk;
152
-            } else {
153
-                $joinedPath = \rtrim($joinedPath, $joint) . $joint . \ltrim($chunk, $joint);
152
+            }else{
153
+                $joinedPath = \rtrim($joinedPath, $joint).$joint.\ltrim($chunk, $joint);
154 154
             }
155 155
         }
156 156
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
     private function classify(string $name): string
161 161
     {
162
-        return ( new InflectorFactory() )
162
+        return (new InflectorFactory())
163 163
             ->build()
164 164
             ->classify($name);
165 165
     }
Please login to merge, or discard this patch.
src/Scaffolder/src/Declaration/ConfigDeclaration/Defaults.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     public function get(array $values): array
27 27
     {
28 28
         $output = [];
29
-        foreach ($values as $key => $value) {
29
+        foreach ($values as $key => $value){
30 30
             $output[$key] = self::TYPE_DEFAULTS[\gettype($value)] ?? null;
31 31
         }
32 32
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@
 block discarded – undo
26 26
     public function get(array $values): array
27 27
     {
28 28
         $output = [];
29
-        foreach ($values as $key => $value) {
29
+        foreach ($values as $key => $value)
30
+        {
30 31
             $output[$key] = self::TYPE_DEFAULTS[\gettype($value)] ?? null;
31 32
         }
32 33
 
Please login to merge, or discard this patch.
src/Scaffolder/src/Declaration/ConfigDeclaration/TypeAnnotations.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function getAnnotation(mixed $value): string
28 28
     {
29
-        if (\is_array($value)) {
29
+        if (\is_array($value)){
30 30
             return $this->arrayAnnotationString($value);
31 31
         }
32 32
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     private function arrayAnnotationString(array $value): string
42 42
     {
43 43
         $types = [];
44
-        foreach ($value as $item) {
44
+        foreach ($value as $item){
45 45
             $types[] = \gettype($item);
46 46
         }
47 47
         $types = \array_unique($types);
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function getAnnotation(mixed $value): string
28 28
     {
29
-        if (\is_array($value)) {
29
+        if (\is_array($value))
30
+        {
30 31
             return $this->arrayAnnotationString($value);
31 32
         }
32 33
 
@@ -41,7 +42,8 @@  discard block
 block discarded – undo
41 42
     private function arrayAnnotationString(array $value): string
42 43
     {
43 44
         $types = [];
44
-        foreach ($value as $item) {
45
+        foreach ($value as $item)
46
+        {
45 47
             $types[] = \gettype($item);
46 48
         }
47 49
         $types = \array_unique($types);
Please login to merge, or discard this patch.
src/Bridge/Dotenv/src/Bootloader/DotenvBootloader.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,22 +23,22 @@
 block discarded – undo
23 23
 
24 24
     public function loadEnvVariables(DirectoriesInterface $dirs, EnvironmentInterface $env): void
25 25
     {
26
-        if ($this->init) {
26
+        if ($this->init){
27 27
             return;
28 28
         }
29 29
 
30 30
         $this->init = true;
31 31
 
32
-        $dotenvPath = $env->get('DOTENV_PATH', $dirs->get('root') . '.env');
32
+        $dotenvPath = $env->get('DOTENV_PATH', $dirs->get('root').'.env');
33 33
 
34
-        if (!\file_exists($dotenvPath)) {
34
+        if (!\file_exists($dotenvPath)){
35 35
             return;
36 36
         }
37 37
 
38 38
         $path = \dirname($dotenvPath);
39 39
         $file = \basename($dotenvPath);
40 40
 
41
-        foreach (Dotenv::createImmutable($path, $file)->load() as $key => $value) {
41
+        foreach (Dotenv::createImmutable($path, $file)->load() as $key => $value){
42 42
             $env->set($key, $value);
43 43
         }
44 44
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function loadEnvVariables(DirectoriesInterface $dirs, EnvironmentInterface $env): void
25 25
     {
26
-        if ($this->init) {
26
+        if ($this->init)
27
+        {
27 28
             return;
28 29
         }
29 30
 
@@ -31,14 +32,16 @@  discard block
 block discarded – undo
31 32
 
32 33
         $dotenvPath = $env->get('DOTENV_PATH', $dirs->get('root') . '.env');
33 34
 
34
-        if (!\file_exists($dotenvPath)) {
35
+        if (!\file_exists($dotenvPath))
36
+        {
35 37
             return;
36 38
         }
37 39
 
38 40
         $path = \dirname($dotenvPath);
39 41
         $file = \basename($dotenvPath);
40 42
 
41
-        foreach (Dotenv::createImmutable($path, $file)->load() as $key => $value) {
43
+        foreach (Dotenv::createImmutable($path, $file)->load() as $key => $value)
44
+        {
42 45
             $env->set($key, $value);
43 46
         }
44 47
     }
Please login to merge, or discard this patch.
src/Bridge/Stempler/src/Config/StemplerConfig.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
     public function getDirectives(): array
25 25
     {
26 26
         $directives = [];
27
-        foreach ($this->config['directives'] as $directive) {
28
-            if (\is_object($directive) && !$directive instanceof Autowire) {
27
+        foreach ($this->config['directives'] as $directive){
28
+            if (\is_object($directive) && !$directive instanceof Autowire){
29 29
                 $directives[] = $directive;
30 30
                 continue;
31 31
             }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     public function getProcessors(): array
43 43
     {
44 44
         $processors = [];
45
-        foreach ($this->config['processors'] as $processor) {
46
-            if (is_object($processor) && !$processor instanceof Autowire) {
45
+        foreach ($this->config['processors'] as $processor){
46
+            if (is_object($processor) && !$processor instanceof Autowire){
47 47
                 $processors[] = $processor;
48 48
                 continue;
49 49
             }
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
     public function getVisitors(int $stage): array
58 58
     {
59 59
         $visitors = [];
60
-        foreach ($this->config['visitors'][$stage] ?? [] as $visitor) {
61
-            if (\is_object($visitor) && !$visitor instanceof Autowire) {
60
+        foreach ($this->config['visitors'][$stage] ?? [] as $visitor){
61
+            if (\is_object($visitor) && !$visitor instanceof Autowire){
62 62
                 $visitors[] = $visitor;
63 63
                 continue;
64 64
             }
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
      */
75 75
     private function wire(mixed $item): Autowire
76 76
     {
77
-        if ($item instanceof Autowire) {
77
+        if ($item instanceof Autowire){
78 78
             return $item;
79 79
         }
80 80
 
81
-        if (\is_string($item)) {
81
+        if (\is_string($item)){
82 82
             return new Autowire($item);
83 83
         }
84 84
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,8 +24,10 @@  discard block
 block discarded – undo
24 24
     public function getDirectives(): array
25 25
     {
26 26
         $directives = [];
27
-        foreach ($this->config['directives'] as $directive) {
28
-            if (\is_object($directive) && !$directive instanceof Autowire) {
27
+        foreach ($this->config['directives'] as $directive)
28
+        {
29
+            if (\is_object($directive) && !$directive instanceof Autowire)
30
+            {
29 31
                 $directives[] = $directive;
30 32
                 continue;
31 33
             }
@@ -42,8 +44,10 @@  discard block
 block discarded – undo
42 44
     public function getProcessors(): array
43 45
     {
44 46
         $processors = [];
45
-        foreach ($this->config['processors'] as $processor) {
46
-            if (is_object($processor) && !$processor instanceof Autowire) {
47
+        foreach ($this->config['processors'] as $processor)
48
+        {
49
+            if (is_object($processor) && !$processor instanceof Autowire)
50
+            {
47 51
                 $processors[] = $processor;
48 52
                 continue;
49 53
             }
@@ -57,8 +61,10 @@  discard block
 block discarded – undo
57 61
     public function getVisitors(int $stage): array
58 62
     {
59 63
         $visitors = [];
60
-        foreach ($this->config['visitors'][$stage] ?? [] as $visitor) {
61
-            if (\is_object($visitor) && !$visitor instanceof Autowire) {
64
+        foreach ($this->config['visitors'][$stage] ?? [] as $visitor)
65
+        {
66
+            if (\is_object($visitor) && !$visitor instanceof Autowire)
67
+            {
62 68
                 $visitors[] = $visitor;
63 69
                 continue;
64 70
             }
@@ -74,11 +80,13 @@  discard block
 block discarded – undo
74 80
      */
75 81
     private function wire(mixed $item): Autowire
76 82
     {
77
-        if ($item instanceof Autowire) {
83
+        if ($item instanceof Autowire)
84
+        {
78 85
             return $item;
79 86
         }
80 87
 
81
-        if (\is_string($item)) {
88
+        if (\is_string($item))
89
+        {
82 90
             return new Autowire($item);
83 91
         }
84 92
 
Please login to merge, or discard this patch.
src/Bridge/Stempler/src/Directive/RouteDirective.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 {
17 17
     public function __construct(
18 18
         private readonly ContainerInterface $container
19
-    ) {
19
+    ){
20 20
         parent::__construct();
21 21
     }
22 22
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function renderRoute(Directive $directive): string
27 27
     {
28
-        if (\count($directive->values) < 1) {
28
+        if (\count($directive->values) < 1){
29 29
             throw new DirectiveException(
30 30
                 'Unable to call @route directive, at least 1 value is required',
31 31
                 $directive->getContext()
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $vars = [];
47 47
         $restore = [];
48
-        foreach ($params as $key => $value) {
49
-            if (\is_string($value) && \preg_match('#\{.*\}#', $value)) {
48
+        foreach ($params as $key => $value){
49
+            if (\is_string($value) && \preg_match('#\{.*\}#', $value)){
50 50
                 $restore[\sprintf('__%s__', $key)] = $value;
51 51
                 $value = \sprintf('__%s__', $key);
52 52
             }
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
             $vars[$key] = $value;
55 55
         }
56 56
 
57
-        try {
57
+        try{
58 58
             return \strtr(
59 59
                 $this->container->get(RouterInterface::class)->uri($route, $vars)->__toString(),
60 60
                 $restore
61 61
             );
62
-        } catch (UndefinedRouteException $e) {
62
+        }catch (UndefinedRouteException $e){
63 63
             throw new RouterException("No such route {$route}", $e->getCode(), $e);
64 64
         }
65 65
     }
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function renderRoute(Directive $directive): string
27 27
     {
28
-        if (\count($directive->values) < 1) {
28
+        if (\count($directive->values) < 1)
29
+        {
29 30
             throw new DirectiveException(
30 31
                 'Unable to call @route directive, at least 1 value is required',
31 32
                 $directive->getContext()
@@ -45,8 +46,10 @@  discard block
 block discarded – undo
45 46
     {
46 47
         $vars = [];
47 48
         $restore = [];
48
-        foreach ($params as $key => $value) {
49
-            if (\is_string($value) && \preg_match('#\{.*\}#', $value)) {
49
+        foreach ($params as $key => $value)
50
+        {
51
+            if (\is_string($value) && \preg_match('#\{.*\}#', $value))
52
+            {
50 53
                 $restore[\sprintf('__%s__', $key)] = $value;
51 54
                 $value = \sprintf('__%s__', $key);
52 55
             }
@@ -54,12 +57,15 @@  discard block
 block discarded – undo
54 57
             $vars[$key] = $value;
55 58
         }
56 59
 
57
-        try {
60
+        try
61
+        {
58 62
             return \strtr(
59 63
                 $this->container->get(RouterInterface::class)->uri($route, $vars)->__toString(),
60 64
                 $restore
61 65
             );
62
-        } catch (UndefinedRouteException $e) {
66
+        }
67
+        catch (UndefinedRouteException $e)
68
+        {
63 69
             throw new RouterException("No such route {$route}", $e->getCode(), $e);
64 70
         }
65 71
     }
Please login to merge, or discard this patch.
src/Bridge/Stempler/src/Directive/ContainerDirective.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@
 block discarded – undo
17 17
      */
18 18
     public function renderInject(Directive $directive): string
19 19
     {
20
-        if (\count($directive->values) < 2 || (string) $directive->values[0] === '') {
20
+        if (\count($directive->values) < 2 || (string)$directive->values[0] === ''){
21 21
             throw new DirectiveException(
22 22
                 'Unable to call @inject directive, 2 values required',
23 23
                 $directive->getContext()
24 24
             );
25 25
         }
26 26
 
27
-        if ($directive->values[0][0] === '$') {
27
+        if ($directive->values[0][0] === '$'){
28 28
             return \sprintf(
29 29
                 '<?php %s = $this->container->get(%s); ?>',
30 30
                 $directive->values[0],
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,14 +17,16 @@
 block discarded – undo
17 17
      */
18 18
     public function renderInject(Directive $directive): string
19 19
     {
20
-        if (\count($directive->values) < 2 || (string) $directive->values[0] === '') {
20
+        if (\count($directive->values) < 2 || (string) $directive->values[0] === '')
21
+        {
21 22
             throw new DirectiveException(
22 23
                 'Unable to call @inject directive, 2 values required',
23 24
                 $directive->getContext()
24 25
             );
25 26
         }
26 27
 
27
-        if ($directive->values[0][0] === '$') {
28
+        if ($directive->values[0][0] === '$')
29
+        {
28 30
             return \sprintf(
29 31
                 '<?php %s = $this->container->get(%s); ?>',
30 32
                 $directive->values[0],
Please login to merge, or discard this patch.
src/Bridge/Stempler/src/Visitor/FormatHTML.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function enterNode(mixed $node, VisitorContext $ctx): mixed
32 32
     {
33
-        if (!$node instanceof Template && !$node instanceof Block && !$node instanceof Tag) {
33
+        if (!$node instanceof Template && !$node instanceof Block && !$node instanceof Tag){
34 34
             return null;
35 35
         }
36 36
 
37
-        if ($node instanceof Tag && \in_array($node->name, self::EXCLUDE)) {
37
+        if ($node instanceof Tag && \in_array($node->name, self::EXCLUDE)){
38 38
             // raw nodes
39 39
             return null;
40 40
         }
41 41
 
42 42
         $level = $this->getLevel($ctx);
43
-        if ($level === null) {
43
+        if ($level === null){
44 44
             // not available in some contexts
45 45
             return null;
46 46
         }
47 47
 
48
-        foreach ($node->nodes as $i => $child) {
49
-            if (!$child instanceof Raw) {
48
+        foreach ($node->nodes as $i => $child){
49
+            if (!$child instanceof Raw){
50 50
                 continue;
51 51
             }
52 52
 
53 53
             $position = self::BETWEEN_TAGS;
54
-            if (!isset($node->nodes[$i + 1])) {
54
+            if (!isset($node->nodes[$i + 1])){
55 55
                 $position = self::BEFORE_CLOSE;
56
-            } elseif ($node->nodes[$i + 1] instanceof PHP) {
56
+            } elseif ($node->nodes[$i + 1] instanceof PHP){
57 57
                 $position = self::BEFORE_PHP;
58 58
             }
59 59
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     private function indentContent(string $content, int $level, int $position = self::BETWEEN_TAGS): string
76 76
     {
77
-        if (!\str_contains($content, "\n")) {
77
+        if (!\str_contains($content, "\n")){
78 78
             // no need to do anything
79 79
             return $content;
80 80
         }
@@ -82,40 +82,40 @@  discard block
 block discarded – undo
82 82
         // we have to apply special rules to the first and the last lines
83 83
         $lines = \explode("\n", $content);
84 84
 
85
-        foreach ($lines as $i => $line) {
86
-            if (\trim($line) === '' && $i !== 0) {
85
+        foreach ($lines as $i => $line){
86
+            if (\trim($line) === '' && $i !== 0){
87 87
                 unset($lines[$i]);
88 88
             }
89 89
         }
90 90
 
91 91
         $lines = \array_values($lines);
92
-        if ($lines === []) {
92
+        if ($lines === []){
93 93
             $lines[] = '';
94 94
         }
95 95
 
96 96
         $result = '';
97
-        foreach ($lines as $i => $line) {
98
-            if (\trim($line) !== '') {
97
+        foreach ($lines as $i => $line){
98
+            if (\trim($line) !== ''){
99 99
                 $line = $i === 0 ? \rtrim($line) : \trim($line);
100 100
             }
101 101
 
102
-            if ($i !== (\count($lines) - 1)) {
103
-                $result .= $line . "\n" . \str_repeat(self::INDENT, $level);
102
+            if ($i !== (\count($lines) - 1)){
103
+                $result .= $line."\n".\str_repeat(self::INDENT, $level);
104 104
                 continue;
105 105
             }
106 106
 
107 107
             // working with last line
108
-            if ($position === self::BEFORE_PHP) {
109
-                $result .= $line . "\n";
108
+            if ($position === self::BEFORE_PHP){
109
+                $result .= $line."\n";
110 110
                 break;
111 111
             }
112 112
 
113
-            if ($position === self::BEFORE_CLOSE) {
114
-                $result .= $line . "\n" . \str_repeat(self::INDENT, max($level - 1, 0));
113
+            if ($position === self::BEFORE_CLOSE){
114
+                $result .= $line."\n".\str_repeat(self::INDENT, max($level - 1, 0));
115 115
                 break;
116 116
             }
117 117
 
118
-            $result .= $line . "\n" . \str_repeat(self::INDENT, $level);
118
+            $result .= $line."\n".\str_repeat(self::INDENT, $level);
119 119
         }
120 120
 
121 121
         return $result;
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
     private function getLevel(VisitorContext $ctx): ?int
125 125
     {
126 126
         $level = 0;
127
-        foreach ($ctx->getScope() as $node) {
128
-            if ($node instanceof Attr) {
127
+        foreach ($ctx->getScope() as $node){
128
+            if ($node instanceof Attr){
129 129
                 return null;
130 130
             }
131 131
 
132
-            if ($node instanceof Block || $node instanceof Template) {
132
+            if ($node instanceof Block || $node instanceof Template){
133 133
                 continue;
134 134
             }
135 135
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     private function normalizeEndings(string $string, bool $joinMultiple = true): string
150 150
     {
151
-        if (!$joinMultiple) {
151
+        if (!$joinMultiple){
152 152
             return \str_replace("\r\n", "\n", $string);
153 153
         }
154 154
 
Please login to merge, or discard this patch.
Braces   +41 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,30 +30,38 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function enterNode(mixed $node, VisitorContext $ctx): mixed
32 32
     {
33
-        if (!$node instanceof Template && !$node instanceof Block && !$node instanceof Tag) {
33
+        if (!$node instanceof Template && !$node instanceof Block && !$node instanceof Tag)
34
+        {
34 35
             return null;
35 36
         }
36 37
 
37
-        if ($node instanceof Tag && \in_array($node->name, self::EXCLUDE)) {
38
+        if ($node instanceof Tag && \in_array($node->name, self::EXCLUDE))
39
+        {
38 40
             // raw nodes
39 41
             return null;
40 42
         }
41 43
 
42 44
         $level = $this->getLevel($ctx);
43
-        if ($level === null) {
45
+        if ($level === null)
46
+        {
44 47
             // not available in some contexts
45 48
             return null;
46 49
         }
47 50
 
48
-        foreach ($node->nodes as $i => $child) {
49
-            if (!$child instanceof Raw) {
51
+        foreach ($node->nodes as $i => $child)
52
+        {
53
+            if (!$child instanceof Raw)
54
+            {
50 55
                 continue;
51 56
             }
52 57
 
53 58
             $position = self::BETWEEN_TAGS;
54
-            if (!isset($node->nodes[$i + 1])) {
59
+            if (!isset($node->nodes[$i + 1]))
60
+            {
55 61
                 $position = self::BEFORE_CLOSE;
56
-            } elseif ($node->nodes[$i + 1] instanceof PHP) {
62
+            }
63
+            elseif ($node->nodes[$i + 1] instanceof PHP)
64
+            {
57 65
                 $position = self::BEFORE_PHP;
58 66
             }
59 67
 
@@ -74,7 +82,8 @@  discard block
 block discarded – undo
74 82
 
75 83
     private function indentContent(string $content, int $level, int $position = self::BETWEEN_TAGS): string
76 84
     {
77
-        if (!\str_contains($content, "\n")) {
85
+        if (!\str_contains($content, "\n"))
86
+        {
78 87
             // no need to do anything
79 88
             return $content;
80 89
         }
@@ -82,35 +91,43 @@  discard block
 block discarded – undo
82 91
         // we have to apply special rules to the first and the last lines
83 92
         $lines = \explode("\n", $content);
84 93
 
85
-        foreach ($lines as $i => $line) {
86
-            if (\trim($line) === '' && $i !== 0) {
94
+        foreach ($lines as $i => $line)
95
+        {
96
+            if (\trim($line) === '' && $i !== 0)
97
+            {
87 98
                 unset($lines[$i]);
88 99
             }
89 100
         }
90 101
 
91 102
         $lines = \array_values($lines);
92
-        if ($lines === []) {
103
+        if ($lines === [])
104
+        {
93 105
             $lines[] = '';
94 106
         }
95 107
 
96 108
         $result = '';
97
-        foreach ($lines as $i => $line) {
98
-            if (\trim($line) !== '') {
109
+        foreach ($lines as $i => $line)
110
+        {
111
+            if (\trim($line) !== '')
112
+            {
99 113
                 $line = $i === 0 ? \rtrim($line) : \trim($line);
100 114
             }
101 115
 
102
-            if ($i !== (\count($lines) - 1)) {
116
+            if ($i !== (\count($lines) - 1))
117
+            {
103 118
                 $result .= $line . "\n" . \str_repeat(self::INDENT, $level);
104 119
                 continue;
105 120
             }
106 121
 
107 122
             // working with last line
108
-            if ($position === self::BEFORE_PHP) {
123
+            if ($position === self::BEFORE_PHP)
124
+            {
109 125
                 $result .= $line . "\n";
110 126
                 break;
111 127
             }
112 128
 
113
-            if ($position === self::BEFORE_CLOSE) {
129
+            if ($position === self::BEFORE_CLOSE)
130
+            {
114 131
                 $result .= $line . "\n" . \str_repeat(self::INDENT, max($level - 1, 0));
115 132
                 break;
116 133
             }
@@ -124,12 +141,15 @@  discard block
 block discarded – undo
124 141
     private function getLevel(VisitorContext $ctx): ?int
125 142
     {
126 143
         $level = 0;
127
-        foreach ($ctx->getScope() as $node) {
128
-            if ($node instanceof Attr) {
144
+        foreach ($ctx->getScope() as $node)
145
+        {
146
+            if ($node instanceof Attr)
147
+            {
129 148
                 return null;
130 149
             }
131 150
 
132
-            if ($node instanceof Block || $node instanceof Template) {
151
+            if ($node instanceof Block || $node instanceof Template)
152
+            {
133 153
                 continue;
134 154
             }
135 155
 
@@ -148,7 +168,8 @@  discard block
 block discarded – undo
148 168
      */
149 169
     private function normalizeEndings(string $string, bool $joinMultiple = true): string
150 170
     {
151
-        if (!$joinMultiple) {
171
+        if (!$joinMultiple)
172
+        {
152 173
             return \str_replace("\r\n", "\n", $string);
153 174
         }
154 175
 
Please login to merge, or discard this patch.