Test Failed
Pull Request — master (#902)
by butschster
08:55
created
src/Scaffolder/src/Declaration/BootloaderDeclaration.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
         ?string $comment = null,
22 22
         ?string $namespace = null,
23 23
         private readonly bool $isDomain = false,
24
-    ) {
24
+    ){
25 25
         parent::__construct($config, $name, $comment, $namespace);
26 26
     }
27 27
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         $this->class->addConstant('SINGLETONS', [])->setProtected();
42 42
         $this->class->addConstant('DEPENDENCIES', [])->setProtected();
43 43
 
44
-        if ($this->isDomain) {
44
+        if ($this->isDomain){
45 45
             $this->class->addConstant('INTERCEPTORS', [])->setProtected();
46 46
             $this->namespace->addUse(CoreInterface::class);
47 47
             $this->class->getConstant('SINGLETONS')->setValue([
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@
 block discarded – undo
41 41
         $this->class->addConstant('SINGLETONS', [])->setProtected();
42 42
         $this->class->addConstant('DEPENDENCIES', [])->setProtected();
43 43
 
44
-        if ($this->isDomain) {
44
+        if ($this->isDomain)
45
+        {
45 46
             $this->class->addConstant('INTERCEPTORS', [])->setProtected();
46 47
             $this->namespace->addUse(CoreInterface::class);
47 48
             $this->class->getConstant('SINGLETONS')->setValue([
Please login to merge, or discard this patch.
src/Scaffolder/tests/Command/CommandTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
             'alias' => $alias,
25 25
             '--description' => 'My sample command description',
26 26
         ];
27
-        if ($alias === null) {
27
+        if ($alias === null){
28 28
             unset($input['alias']);
29 29
         }
30 30
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,8 @@
 block discarded – undo
24 24
             'alias' => $alias,
25 25
             '--description' => 'My sample command description',
26 26
         ];
27
-        if ($alias === null) {
27
+        if ($alias === null)
28
+        {
28 29
             unset($input['alias']);
29 30
         }
30 31
 
Please login to merge, or discard this patch.
src/Scaffolder/src/Command/CommandCommand.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@
 block discarded – undo
48 48
             'alias' => $this->alias ?? \strtolower(\preg_replace('/(?<!^)[A-Z]/', ':$0', $this->name)),
49 49
         ]);
50 50
 
51
-        foreach ($this->arguments as $argument) {
51
+        foreach ($this->arguments as $argument){
52 52
             $declaration->addArgument($argument);
53 53
         }
54 54
 
55
-        foreach ($this->options as $option) {
55
+        foreach ($this->options as $option){
56 56
             $declaration->addOption($option);
57 57
         }
58 58
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,11 +48,13 @@
 block discarded – undo
48 48
             'alias' => $this->alias ?? \strtolower(\preg_replace('/(?<!^)[A-Z]/', ':$0', $this->name)),
49 49
         ]);
50 50
 
51
-        foreach ($this->arguments as $argument) {
51
+        foreach ($this->arguments as $argument)
52
+        {
52 53
             $declaration->addArgument($argument);
53 54
         }
54 55
 
55
-        foreach ($this->options as $option) {
56
+        foreach ($this->options as $option)
57
+        {
56 58
             $declaration->addOption($option);
57 59
         }
58 60
 
Please login to merge, or discard this patch.
src/Scaffolder/src/Declaration/CommandDeclaration.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         ?string $namespace = null,
23 23
         private readonly ?string $alias = null,
24 24
         private readonly ?string $description = null,
25
-    ) {
25
+    ){
26 26
         parent::__construct($config, $name, $comment, $namespace);
27 27
     }
28 28
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             'name' => $this->alias,
70 70
         ];
71 71
 
72
-        if ($this->description) {
72
+        if ($this->description){
73 73
             $commandDefinition['description'] = $this->description;
74 74
         }
75 75
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,8 @@
 block discarded – undo
69 69
             'name' => $this->alias,
70 70
         ];
71 71
 
72
-        if ($this->description) {
72
+        if ($this->description)
73
+        {
73 74
             $commandDefinition['description'] = $this->description;
74 75
         }
75 76
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 $this->info('Command logic is not implemented yet');
85 85
 
86 86
 return self::SUCCESS;
87
-PHP,
87
+php,
88 88
             );
89 89
     }
90 90
 }
Please login to merge, or discard this patch.
src/Scaffolder/src/Declaration/ConfigDeclaration.php 3 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         protected ?string $comment = null,
33 33
         private readonly string $directory = '',
34 34
         ?string $namespace = null,
35
-    ) {
35
+    ){
36 36
         parent::__construct($config, $name, $comment, $namespace);
37 37
     }
38 38
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
         $this->class->addConstant('CONFIG', $configName)->setPublic();
42 42
 
43 43
         $filename = $this->makeConfigFilename($configName);
44
-        if ($reverse) {
45
-            if (!$this->files->exists($filename)) {
44
+        if ($reverse){
45
+            if (!$this->files->exists($filename)){
46 46
                 throw new ScaffolderException(\sprintf("Config filename %s doesn't exist", $filename));
47 47
             }
48 48
 
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
             $this->declareGetters($defaultsFromFile);
51 51
 
52 52
             $this->class->getProperty('config')->setValue($this->defaultValues->get($defaultsFromFile));
53
-        } else {
54
-            if (!$this->files->exists($filename)) {
53
+        }else{
54
+            if (!$this->files->exists($filename)){
55 55
                 $this->touchConfigFile($filename);
56 56
             }
57 57
         }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
         $this->files->write(
96 96
             $filename,
97
-            $file->render() . PHP_EOL . (new Dumper())->dump(new Literal('return [];')),
97
+            $file->render().PHP_EOL.(new Dumper())->dump(new Literal('return [];')),
98 98
             FilesInterface::READONLY,
99 99
             true,
100 100
         );
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $getters = [];
113 113
         $gettersByKey = [];
114 114
 
115
-        foreach ($defaults as $key => $value) {
115
+        foreach ($defaults as $key => $value){
116 116
             $key = (string)$key;
117 117
             $getter = $this->makeGetterName($key);
118 118
             $getters[] = $getter;
@@ -120,19 +120,19 @@  discard block
 block discarded – undo
120 120
             $method = $this->class->addMethod($getter)->setPublic();
121 121
             $method->setBody(\sprintf('return $this->config[\'%s\'];', $key));
122 122
 
123
-            if (\is_array($value)) {
123
+            if (\is_array($value)){
124 124
                 $gettersByKey[] = ['key' => $key, 'value' => $value];
125 125
             }
126 126
 
127 127
             $returnTypeHint = $this->typeHints->getHint(\gettype($value));
128
-            if ($returnTypeHint !== null) {
128
+            if ($returnTypeHint !== null){
129 129
                 $method->setReturnType($returnTypeHint);
130 130
             }
131 131
         }
132 132
 
133
-        foreach ($gettersByKey as $item) {
133
+        foreach ($gettersByKey as $item){
134 134
             $method = $this->declareGettersByKey($getters, $item['key'], $item['value']);
135
-            if ($method !== null) {
135
+            if ($method !== null){
136 136
                 $getters[] = $method->getName();
137 137
             }
138 138
         }
@@ -141,30 +141,30 @@  discard block
 block discarded – undo
141 141
     private function declareGettersByKey(array $methodNames, string $key, array $value): ?Method
142 142
     {
143 143
         //Won't create if there's less than 2 sub-items
144
-        if (\count($value) < 2) {
144
+        if (\count($value) < 2){
145 145
             return null;
146 146
         }
147 147
 
148 148
         $singularKey = $this->singularize($key);
149 149
         $name = $this->makeGetterName($singularKey);
150
-        if (\in_array($name, $methodNames, true)) {
150
+        if (\in_array($name, $methodNames, true)){
151 151
             $name = $this->makeGetterName($singularKey, 'get', 'by');
152 152
         }
153 153
 
154 154
         //Name conflict, won't merge
155
-        if (\in_array($name, $methodNames, true)) {
155
+        if (\in_array($name, $methodNames, true)){
156 156
             return null;
157 157
         }
158 158
 
159 159
         $keyType = defineArrayType(\array_keys($value), '-mixed-');
160 160
         $valueType = defineArrayType(\array_values($value), '-mixed-');
161 161
         //We need a fixed structure here
162
-        if ($keyType === '-mixed-' || $valueType === '-mixed-') {
162
+        if ($keyType === '-mixed-' || $valueType === '-mixed-'){
163 163
             return null;
164 164
         }
165 165
 
166 166
         //Won't create for associated arrays
167
-        if ($this->typeAnnotations->mapType($keyType) === 'int' && \array_is_list($value)) {
167
+        if ($this->typeAnnotations->mapType($keyType) === 'int' && \array_is_list($value)){
168 168
             return null;
169 169
         }
170 170
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
         $param = $method->addParameter($singularKey);
176 176
         $paramTypeHint = $this->typeHints->getHint($keyType);
177
-        if ($paramTypeHint !== null) {
177
+        if ($paramTypeHint !== null){
178 178
             $param->setType($paramTypeHint);
179 179
         }
180 180
 
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
     private function makeGetterName(string $name, string $prefix = 'get', string $postfix = ''): string
185 185
     {
186 186
         $chunks = [];
187
-        if (!empty($prefix)) {
187
+        if (!empty($prefix)){
188 188
             $chunks[] = $prefix;
189 189
         }
190 190
 
191 191
         $name = $this->slugify->slugify($name, ['lowercase' => false]);
192 192
         $chunks[] = \count($chunks) !== 0 ? $this->classify($name) : $name;
193
-        if (!empty($postfix)) {
193
+        if (!empty($postfix)){
194 194
             $chunks[] = \ucfirst($postfix);
195 195
         }
196 196
 
Please login to merge, or discard this patch.
Braces   +35 added lines, -17 removed lines patch added patch discarded remove patch
@@ -41,8 +41,10 @@  discard block
 block discarded – undo
41 41
         $this->class->addConstant('CONFIG', $configName)->setPublic();
42 42
 
43 43
         $filename = $this->makeConfigFilename($configName);
44
-        if ($reverse) {
45
-            if (!$this->files->exists($filename)) {
44
+        if ($reverse)
45
+        {
46
+            if (!$this->files->exists($filename))
47
+            {
46 48
                 throw new ScaffolderException(\sprintf("Config filename %s doesn't exist", $filename));
47 49
             }
48 50
 
@@ -50,8 +52,11 @@  discard block
 block discarded – undo
50 52
             $this->declareGetters($defaultsFromFile);
51 53
 
52 54
             $this->class->getProperty('config')->setValue($this->defaultValues->get($defaultsFromFile));
53
-        } else {
54
-            if (!$this->files->exists($filename)) {
55
+        }
56
+        else
57
+        {
58
+            if (!$this->files->exists($filename))
59
+            {
55 60
                 $this->touchConfigFile($filename);
56 61
             }
57 62
         }
@@ -112,7 +117,8 @@  discard block
 block discarded – undo
112 117
         $getters = [];
113 118
         $gettersByKey = [];
114 119
 
115
-        foreach ($defaults as $key => $value) {
120
+        foreach ($defaults as $key => $value)
121
+        {
116 122
             $key = (string)$key;
117 123
             $getter = $this->makeGetterName($key);
118 124
             $getters[] = $getter;
@@ -120,19 +126,23 @@  discard block
 block discarded – undo
120 126
             $method = $this->class->addMethod($getter)->setPublic();
121 127
             $method->setBody(\sprintf('return $this->config[\'%s\'];', $key));
122 128
 
123
-            if (\is_array($value)) {
129
+            if (\is_array($value))
130
+            {
124 131
                 $gettersByKey[] = ['key' => $key, 'value' => $value];
125 132
             }
126 133
 
127 134
             $returnTypeHint = $this->typeHints->getHint(\gettype($value));
128
-            if ($returnTypeHint !== null) {
135
+            if ($returnTypeHint !== null)
136
+            {
129 137
                 $method->setReturnType($returnTypeHint);
130 138
             }
131 139
         }
132 140
 
133
-        foreach ($gettersByKey as $item) {
141
+        foreach ($gettersByKey as $item)
142
+        {
134 143
             $method = $this->declareGettersByKey($getters, $item['key'], $item['value']);
135
-            if ($method !== null) {
144
+            if ($method !== null)
145
+            {
136 146
                 $getters[] = $method->getName();
137 147
             }
138 148
         }
@@ -141,30 +151,35 @@  discard block
 block discarded – undo
141 151
     private function declareGettersByKey(array $methodNames, string $key, array $value): ?Method
142 152
     {
143 153
         //Won't create if there's less than 2 sub-items
144
-        if (\count($value) < 2) {
154
+        if (\count($value) < 2)
155
+        {
145 156
             return null;
146 157
         }
147 158
 
148 159
         $singularKey = $this->singularize($key);
149 160
         $name = $this->makeGetterName($singularKey);
150
-        if (\in_array($name, $methodNames, true)) {
161
+        if (\in_array($name, $methodNames, true))
162
+        {
151 163
             $name = $this->makeGetterName($singularKey, 'get', 'by');
152 164
         }
153 165
 
154 166
         //Name conflict, won't merge
155
-        if (\in_array($name, $methodNames, true)) {
167
+        if (\in_array($name, $methodNames, true))
168
+        {
156 169
             return null;
157 170
         }
158 171
 
159 172
         $keyType = defineArrayType(\array_keys($value), '-mixed-');
160 173
         $valueType = defineArrayType(\array_values($value), '-mixed-');
161 174
         //We need a fixed structure here
162
-        if ($keyType === '-mixed-' || $valueType === '-mixed-') {
175
+        if ($keyType === '-mixed-' || $valueType === '-mixed-')
176
+        {
163 177
             return null;
164 178
         }
165 179
 
166 180
         //Won't create for associated arrays
167
-        if ($this->typeAnnotations->mapType($keyType) === 'int' && \array_is_list($value)) {
181
+        if ($this->typeAnnotations->mapType($keyType) === 'int' && \array_is_list($value))
182
+        {
168 183
             return null;
169 184
         }
170 185
 
@@ -174,7 +189,8 @@  discard block
 block discarded – undo
174 189
 
175 190
         $param = $method->addParameter($singularKey);
176 191
         $paramTypeHint = $this->typeHints->getHint($keyType);
177
-        if ($paramTypeHint !== null) {
192
+        if ($paramTypeHint !== null)
193
+        {
178 194
             $param->setType($paramTypeHint);
179 195
         }
180 196
 
@@ -184,13 +200,15 @@  discard block
 block discarded – undo
184 200
     private function makeGetterName(string $name, string $prefix = 'get', string $postfix = ''): string
185 201
     {
186 202
         $chunks = [];
187
-        if (!empty($prefix)) {
203
+        if (!empty($prefix))
204
+        {
188 205
             $chunks[] = $prefix;
189 206
         }
190 207
 
191 208
         $name = $this->slugify->slugify($name, ['lowercase' => false]);
192 209
         $chunks[] = \count($chunks) !== 0 ? $this->classify($name) : $name;
193
-        if (!empty($postfix)) {
210
+        if (!empty($postfix))
211
+        {
194 212
             $chunks[] = \ucfirst($postfix);
195 213
         }
196 214
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                 <<<'DOC'
77 77
 Default values for the config. 
78 78
 Will be merged with application config in runtime.
79
-DOC,
79
+doc,
80 80
             );
81 81
     }
82 82
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $this->files->write(
96 96
             $filename,
97 97
             $file->render() . PHP_EOL . (new Dumper())->dump(new Literal('return [];')),
98
-            FilesInterface::READONLY,
98
+            FilesInterface::readonly,
99 99
             true,
100 100
         );
101 101
     }
Please login to merge, or discard this patch.
src/Scaffolder/tests/Command/ConfigTest.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -137,17 +137,17 @@  discard block
 block discarded – undo
137 137
         ];
138 138
 
139 139
         $reflectionMethods = [];
140
-        foreach ($reflection->getMethods() as $method) {
141
-            if ($method->getDeclaringClass()->name !== $reflection->name) {
140
+        foreach ($reflection->getMethods() as $method){
141
+            if ($method->getDeclaringClass()->name !== $reflection->name){
142 142
                 continue;
143 143
             }
144 144
 
145 145
             $reflectionMethods[$method->name] = $method;
146 146
             $this->assertArrayHasKey($method->name, $methods);
147 147
 
148
-            if (!$method->hasReturnType()) {
148
+            if (!$method->hasReturnType()){
149 149
                 $this->assertNull($methods[$method->name]['hint']);
150
-            } else {
150
+            }else{
151 151
                 $this->assertEquals($methods[$method->name]['hint'], $method->getReturnType()->getName());
152 152
             }
153 153
         }
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
         ];
190 190
 
191 191
         $reflectionMethods = [];
192
-        foreach ($reflection->getMethods() as $method) {
193
-            if ($method->getDeclaringClass()->name !== $reflection->name) {
192
+        foreach ($reflection->getMethods() as $method){
193
+            if ($method->getDeclaringClass()->name !== $reflection->name){
194 194
                 continue;
195 195
             }
196 196
             $reflectionMethods[$method->name] = $method;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
         clearstatcache();
264 264
 
265
-        $filename = $this->app->directory('config') . "$name.php";
265
+        $filename = $this->app->directory('config')."$name.php";
266 266
         $this->assertFileExists($filename);
267 267
 
268 268
         return $filename;
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -137,17 +137,22 @@  discard block
 block discarded – undo
137 137
         ];
138 138
 
139 139
         $reflectionMethods = [];
140
-        foreach ($reflection->getMethods() as $method) {
141
-            if ($method->getDeclaringClass()->name !== $reflection->name) {
140
+        foreach ($reflection->getMethods() as $method)
141
+        {
142
+            if ($method->getDeclaringClass()->name !== $reflection->name)
143
+            {
142 144
                 continue;
143 145
             }
144 146
 
145 147
             $reflectionMethods[$method->name] = $method;
146 148
             $this->assertArrayHasKey($method->name, $methods);
147 149
 
148
-            if (!$method->hasReturnType()) {
150
+            if (!$method->hasReturnType())
151
+            {
149 152
                 $this->assertNull($methods[$method->name]['hint']);
150
-            } else {
153
+            }
154
+            else
155
+            {
151 156
                 $this->assertEquals($methods[$method->name]['hint'], $method->getReturnType()->getName());
152 157
             }
153 158
         }
@@ -189,8 +194,10 @@  discard block
 block discarded – undo
189 194
         ];
190 195
 
191 196
         $reflectionMethods = [];
192
-        foreach ($reflection->getMethods() as $method) {
193
-            if ($method->getDeclaringClass()->name !== $reflection->name) {
197
+        foreach ($reflection->getMethods() as $method)
198
+        {
199
+            if ($method->getDeclaringClass()->name !== $reflection->name)
200
+            {
194 201
                 continue;
195 202
             }
196 203
             $reflectionMethods[$method->name] = $method;
Please login to merge, or discard this patch.