@@ -102,16 +102,21 @@ discard block |
||
| 102 | 102 | public function create(bool $reverse): void |
| 103 | 103 | { |
| 104 | 104 | $filename = $this->makeConfigFilename($this->configName); |
| 105 | - if ($reverse) { |
|
| 106 | - if (!$this->files->exists($filename)) { |
|
| 105 | + if ($reverse) |
|
| 106 | + { |
|
| 107 | + if (!$this->files->exists($filename)) |
|
| 108 | + { |
|
| 107 | 109 | throw new ScaffolderException("Config filename $filename doesn't exist"); |
| 108 | 110 | } |
| 109 | 111 | |
| 110 | 112 | $defaultsFromFile = require $filename; |
| 111 | 113 | $this->declareGetters($defaultsFromFile); |
| 112 | 114 | $this->declareStructure($this->configName, $this->defaultValues->get($defaultsFromFile)); |
| 113 | - } else { |
|
| 114 | - if (!$this->files->exists($filename)) { |
|
| 115 | + } |
|
| 116 | + else |
|
| 117 | + { |
|
| 118 | + if (!$this->files->exists($filename)) |
|
| 119 | + { |
|
| 115 | 120 | $this->touchConfigFile($filename); |
| 116 | 121 | } |
| 117 | 122 | |
@@ -169,7 +174,8 @@ discard block |
||
| 169 | 174 | $getters = []; |
| 170 | 175 | $gettersByKey = []; |
| 171 | 176 | |
| 172 | - foreach ($defaults as $key => $value) { |
|
| 177 | + foreach ($defaults as $key => $value) |
|
| 178 | + { |
|
| 173 | 179 | $key = (string)$key; |
| 174 | 180 | $getter = $this->makeGetterName($key); |
| 175 | 181 | $getters[] = $getter; |
@@ -178,19 +184,23 @@ discard block |
||
| 178 | 184 | $method->setSource("return \$this->config['$key'];"); |
| 179 | 185 | $method->setComment("@return {$this->typeAnnotations->getAnnotation($value)}"); |
| 180 | 186 | |
| 181 | - if (is_array($value)) { |
|
| 187 | + if (is_array($value)) |
|
| 188 | + { |
|
| 182 | 189 | $gettersByKey[] = compact('key', 'value'); |
| 183 | 190 | } |
| 184 | 191 | |
| 185 | 192 | $returnTypeHint = $this->typeHints->getHint(gettype($value)); |
| 186 | - if ($returnTypeHint !== null) { |
|
| 193 | + if ($returnTypeHint !== null) |
|
| 194 | + { |
|
| 187 | 195 | $method->setReturn($returnTypeHint); |
| 188 | 196 | } |
| 189 | 197 | } |
| 190 | 198 | |
| 191 | - foreach ($gettersByKey as $item) { |
|
| 199 | + foreach ($gettersByKey as $item) |
|
| 200 | + { |
|
| 192 | 201 | $method = $this->declareGettersByKey($getters, $item['key'], $item['value']); |
| 193 | - if ($method !== null) { |
|
| 202 | + if ($method !== null) |
|
| 203 | + { |
|
| 194 | 204 | $getters[] = $method->getName(); |
| 195 | 205 | } |
| 196 | 206 | } |
@@ -207,30 +217,35 @@ discard block |
||
| 207 | 217 | private function declareGettersByKey(array $methodNames, string $key, array $value): ?Method |
| 208 | 218 | { |
| 209 | 219 | //Won't create if there's less than 2 sub-items |
| 210 | - if (count($value) < 2) { |
|
| 220 | + if (count($value) < 2) |
|
| 221 | + { |
|
| 211 | 222 | return null; |
| 212 | 223 | } |
| 213 | 224 | |
| 214 | 225 | $singularKey = $this->singularize($key); |
| 215 | 226 | $name = $this->makeGetterName($singularKey); |
| 216 | - if (in_array($name, $methodNames, true)) { |
|
| 227 | + if (in_array($name, $methodNames, true)) |
|
| 228 | + { |
|
| 217 | 229 | $name = $this->makeGetterName($singularKey, 'get', 'by'); |
| 218 | 230 | } |
| 219 | 231 | |
| 220 | 232 | //Name conflict, won't merge |
| 221 | - if (in_array($name, $methodNames, true)) { |
|
| 233 | + if (in_array($name, $methodNames, true)) |
|
| 234 | + { |
|
| 222 | 235 | return null; |
| 223 | 236 | } |
| 224 | 237 | |
| 225 | 238 | $keyType = defineArrayType(array_keys($value), '-mixed-'); |
| 226 | 239 | $valueType = defineArrayType(array_values($value), '-mixed-'); |
| 227 | 240 | //We need a fixed structure here |
| 228 | - if ($keyType === '-mixed-' || $valueType === '-mixed-') { |
|
| 241 | + if ($keyType === '-mixed-' || $valueType === '-mixed-') |
|
| 242 | + { |
|
| 229 | 243 | return null; |
| 230 | 244 | } |
| 231 | 245 | |
| 232 | 246 | //Won't create for associated arrays |
| 233 | - if ($this->typeAnnotations->mapType($keyType) === 'int' && !isAssociativeArray($value)) { |
|
| 247 | + if ($this->typeAnnotations->mapType($keyType) === 'int' && !isAssociativeArray($value)) |
|
| 248 | + { |
|
| 234 | 249 | return null; |
| 235 | 250 | } |
| 236 | 251 | |
@@ -244,7 +259,8 @@ discard block |
||
| 244 | 259 | |
| 245 | 260 | $param = $method->parameter($singularKey); |
| 246 | 261 | $paramTypeHint = $this->typeHints->getHint($keyType); |
| 247 | - if ($paramTypeHint !== null) { |
|
| 262 | + if ($paramTypeHint !== null) |
|
| 263 | + { |
|
| 248 | 264 | $param->setType($paramTypeHint); |
| 249 | 265 | } |
| 250 | 266 | |
@@ -260,13 +276,15 @@ discard block |
||
| 260 | 276 | private function makeGetterName(string $name, string $prefix = 'get', string $postfix = ''): string |
| 261 | 277 | { |
| 262 | 278 | $chunks = []; |
| 263 | - if (!empty($prefix)) { |
|
| 279 | + if (!empty($prefix)) |
|
| 280 | + { |
|
| 264 | 281 | $chunks[] = $prefix; |
| 265 | 282 | } |
| 266 | 283 | |
| 267 | 284 | $name = $this->slugify->slugify($name, ['lowercase' => false]); |
| 268 | 285 | $chunks[] = count($chunks) !== 0 ? $this->classify($name) : $name; |
| 269 | - if (!empty($postfix)) { |
|
| 286 | + if (!empty($postfix)) |
|
| 287 | + { |
|
| 270 | 288 | $chunks[] = ucfirst($postfix); |
| 271 | 289 | } |
| 272 | 290 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | string $name, |
| 64 | 64 | string $comment = '', |
| 65 | 65 | string $directory = '' |
| 66 | - ) { |
|
| 66 | + ){ |
|
| 67 | 67 | parent::__construct($name, 'InjectableConfig', [], $comment); |
| 68 | 68 | |
| 69 | 69 | $this->config = $config; |
@@ -87,16 +87,16 @@ discard block |
||
| 87 | 87 | public function create(bool $reverse): void |
| 88 | 88 | { |
| 89 | 89 | $filename = $this->makeConfigFilename($this->configName); |
| 90 | - if ($reverse) { |
|
| 91 | - if (!$this->files->exists($filename)) { |
|
| 90 | + if ($reverse){ |
|
| 91 | + if (!$this->files->exists($filename)){ |
|
| 92 | 92 | throw new ScaffolderException("Config filename $filename doesn't exist"); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $defaultsFromFile = require $filename; |
| 96 | 96 | $this->declareGetters($defaultsFromFile); |
| 97 | 97 | $this->declareStructure($this->configName, $this->defaultValues->get($defaultsFromFile)); |
| 98 | - } else { |
|
| 99 | - if (!$this->files->exists($filename)) { |
|
| 98 | + }else{ |
|
| 99 | + if (!$this->files->exists($filename)){ |
|
| 100 | 100 | $this->touchConfigFile($filename); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $getters = []; |
| 144 | 144 | $gettersByKey = []; |
| 145 | 145 | |
| 146 | - foreach ($defaults as $key => $value) { |
|
| 146 | + foreach ($defaults as $key => $value){ |
|
| 147 | 147 | $key = (string)$key; |
| 148 | 148 | $getter = $this->makeGetterName($key); |
| 149 | 149 | $getters[] = $getter; |
@@ -152,19 +152,19 @@ discard block |
||
| 152 | 152 | $method->setSource("return \$this->config['$key'];"); |
| 153 | 153 | $method->setComment("@return {$this->typeAnnotations->getAnnotation($value)}"); |
| 154 | 154 | |
| 155 | - if (is_array($value)) { |
|
| 155 | + if (is_array($value)){ |
|
| 156 | 156 | $gettersByKey[] = compact('key', 'value'); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $returnTypeHint = $this->typeHints->getHint(gettype($value)); |
| 160 | - if ($returnTypeHint !== null) { |
|
| 160 | + if ($returnTypeHint !== null){ |
|
| 161 | 161 | $method->setReturn($returnTypeHint); |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - foreach ($gettersByKey as $item) { |
|
| 165 | + foreach ($gettersByKey as $item){ |
|
| 166 | 166 | $method = $this->declareGettersByKey($getters, $item['key'], $item['value']); |
| 167 | - if ($method !== null) { |
|
| 167 | + if ($method !== null){ |
|
| 168 | 168 | $getters[] = $method->getName(); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -175,30 +175,30 @@ discard block |
||
| 175 | 175 | private function declareGettersByKey(array $methodNames, string $key, array $value): ?Method |
| 176 | 176 | { |
| 177 | 177 | //Won't create if there's less than 2 sub-items |
| 178 | - if (count($value) < 2) { |
|
| 178 | + if (count($value) < 2){ |
|
| 179 | 179 | return null; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $singularKey = $this->singularize($key); |
| 183 | 183 | $name = $this->makeGetterName($singularKey); |
| 184 | - if (in_array($name, $methodNames, true)) { |
|
| 184 | + if (in_array($name, $methodNames, true)){ |
|
| 185 | 185 | $name = $this->makeGetterName($singularKey, 'get', 'by'); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | //Name conflict, won't merge |
| 189 | - if (in_array($name, $methodNames, true)) { |
|
| 189 | + if (in_array($name, $methodNames, true)){ |
|
| 190 | 190 | return null; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | $keyType = defineArrayType(array_keys($value), '-mixed-'); |
| 194 | 194 | $valueType = defineArrayType(array_values($value), '-mixed-'); |
| 195 | 195 | //We need a fixed structure here |
| 196 | - if ($keyType === '-mixed-' || $valueType === '-mixed-') { |
|
| 196 | + if ($keyType === '-mixed-' || $valueType === '-mixed-'){ |
|
| 197 | 197 | return null; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | //Won't create for associated arrays |
| 201 | - if ($this->typeAnnotations->mapType($keyType) === 'int' && !isAssociativeArray($value)) { |
|
| 201 | + if ($this->typeAnnotations->mapType($keyType) === 'int' && !isAssociativeArray($value)){ |
|
| 202 | 202 | return null; |
| 203 | 203 | } |
| 204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | $param = $method->parameter($singularKey); |
| 214 | 214 | $paramTypeHint = $this->typeHints->getHint($keyType); |
| 215 | - if ($paramTypeHint !== null) { |
|
| 215 | + if ($paramTypeHint !== null){ |
|
| 216 | 216 | $param->setType($paramTypeHint); |
| 217 | 217 | } |
| 218 | 218 | |
@@ -222,13 +222,13 @@ discard block |
||
| 222 | 222 | private function makeGetterName(string $name, string $prefix = 'get', string $postfix = ''): string |
| 223 | 223 | { |
| 224 | 224 | $chunks = []; |
| 225 | - if (!empty($prefix)) { |
|
| 225 | + if (!empty($prefix)){ |
|
| 226 | 226 | $chunks[] = $prefix; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | $name = $this->slugify->slugify($name, ['lowercase' => false]); |
| 230 | 230 | $chunks[] = count($chunks) !== 0 ? $this->classify($name) : $name; |
| 231 | - if (!empty($postfix)) { |
|
| 231 | + if (!empty($postfix)){ |
|
| 232 | 232 | $chunks[] = ucfirst($postfix); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -247,14 +247,14 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | private function classify(string $name): string |
| 249 | 249 | { |
| 250 | - return ( new InflectorFactory() ) |
|
| 250 | + return (new InflectorFactory()) |
|
| 251 | 251 | ->build() |
| 252 | 252 | ->classify($name); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | private function singularize(string $name): string |
| 256 | 256 | { |
| 257 | - return ( new InflectorFactory() ) |
|
| 257 | + return (new InflectorFactory()) |
|
| 258 | 258 | ->build() |
| 259 | 259 | ->singularize($name); |
| 260 | 260 | } |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | $this->files->write( |
| 123 | 123 | $filename, |
| 124 | 124 | $file->render(), |
| 125 | - FilesInterface::READONLY, |
|
| 125 | + FilesInterface::readonly, |
|
| 126 | 126 | true |
| 127 | 127 | ); |
| 128 | 128 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | $source = $this->method('up')->getSource(); |
| 52 | 52 | |
| 53 | 53 | $source->addLine("\$this->table('{$table}')"); |
| 54 | - foreach ($columns as $name => $type) { |
|
| 54 | + foreach ($columns as $name => $type){ |
|
| 55 | 55 | $source->addLine(" ->addColumn('{$name}', '{$type}')"); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -51,7 +51,8 @@ |
||
| 51 | 51 | $source = $this->method('up')->getSource(); |
| 52 | 52 | |
| 53 | 53 | $source->addLine("\$this->table('{$table}')"); |
| 54 | - foreach ($columns as $name => $type) { |
|
| 54 | + foreach ($columns as $name => $type) |
|
| 55 | + { |
|
| 55 | 56 | $source->addLine(" ->addColumn('{$name}', '{$type}')"); |
| 56 | 57 | } |
| 57 | 58 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function getAnnotation($value): string |
| 39 | 39 | { |
| 40 | - if (is_array($value)) { |
|
| 40 | + if (is_array($value)){ |
|
| 41 | 41 | return $this->arrayAnnotationString($value); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | private function arrayAnnotationString(array $value): string |
| 61 | 61 | { |
| 62 | 62 | $types = []; |
| 63 | - foreach ($value as $item) { |
|
| 63 | + foreach ($value as $item){ |
|
| 64 | 64 | $types[] = gettype($item); |
| 65 | 65 | } |
| 66 | 66 | $types = array_unique($types); |
@@ -37,7 +37,8 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function getAnnotation($value): string |
| 39 | 39 | { |
| 40 | - if (is_array($value)) { |
|
| 40 | + if (is_array($value)) |
|
| 41 | + { |
|
| 41 | 42 | return $this->arrayAnnotationString($value); |
| 42 | 43 | } |
| 43 | 44 | |
@@ -60,7 +61,8 @@ discard block |
||
| 60 | 61 | private function arrayAnnotationString(array $value): string |
| 61 | 62 | { |
| 62 | 63 | $types = []; |
| 63 | - foreach ($value as $item) { |
|
| 64 | + foreach ($value as $item) |
|
| 65 | + { |
|
| 64 | 66 | $types[] = gettype($item); |
| 65 | 67 | } |
| 66 | 68 | $types = array_unique($types); |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | public function get(array $values): array |
| 38 | 38 | { |
| 39 | 39 | $output = []; |
| 40 | - foreach ($values as $key => $value) { |
|
| 40 | + foreach ($values as $key => $value){ |
|
| 41 | 41 | $output[$key] = self::TYPE_DEFAULTS[gettype($value)] ?? null; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -37,7 +37,8 @@ |
||
| 37 | 37 | public function get(array $values): array |
| 38 | 38 | { |
| 39 | 39 | $output = []; |
| 40 | - foreach ($values as $key => $value) { |
|
| 40 | + foreach ($values as $key => $value) |
|
| 41 | + { |
|
| 41 | 42 | $output[$key] = self::TYPE_DEFAULTS[gettype($value)] ?? null; |
| 42 | 43 | } |
| 43 | 44 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | public function setUp(): void |
| 27 | 27 | { |
| 28 | 28 | $this->app = TestApp::init([ |
| 29 | - 'root' => __DIR__ . '/App', |
|
| 29 | + 'root' => __DIR__.'/App', |
|
| 30 | 30 | ], null, false); |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -115,17 +115,17 @@ discard block |
||
| 115 | 115 | ]; |
| 116 | 116 | |
| 117 | 117 | $reflectionMethods = []; |
| 118 | - foreach ($reflection->getMethods() as $method) { |
|
| 119 | - if ($method->getDeclaringClass()->name !== $reflection->name) { |
|
| 118 | + foreach ($reflection->getMethods() as $method){ |
|
| 119 | + if ($method->getDeclaringClass()->name !== $reflection->name){ |
|
| 120 | 120 | continue; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $reflectionMethods[$method->name] = $method; |
| 124 | 124 | $this->assertArrayHasKey($method->name, $methods); |
| 125 | 125 | |
| 126 | - if (!$method->hasReturnType()) { |
|
| 126 | + if (!$method->hasReturnType()){ |
|
| 127 | 127 | $this->assertNull($methods[$method->name]['hint']); |
| 128 | - } else { |
|
| 128 | + }else{ |
|
| 129 | 129 | $this->assertEquals($methods[$method->name]['hint'], $method->getReturnType()->getName()); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | ]; |
| 170 | 170 | |
| 171 | 171 | $reflectionMethods = []; |
| 172 | - foreach ($reflection->getMethods() as $method) { |
|
| 173 | - if ($method->getDeclaringClass()->name !== $reflection->name) { |
|
| 172 | + foreach ($reflection->getMethods() as $method){ |
|
| 173 | + if ($method->getDeclaringClass()->name !== $reflection->name){ |
|
| 174 | 174 | continue; |
| 175 | 175 | } |
| 176 | 176 | $reflectionMethods[$method->name] = $method; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | clearstatcache(); |
| 241 | 241 | |
| 242 | - $filename = $this->app->directory('config') . "$name.php"; |
|
| 242 | + $filename = $this->app->directory('config')."$name.php"; |
|
| 243 | 243 | $this->assertFileExists($filename); |
| 244 | 244 | |
| 245 | 245 | return $filename; |
@@ -115,17 +115,22 @@ discard block |
||
| 115 | 115 | ]; |
| 116 | 116 | |
| 117 | 117 | $reflectionMethods = []; |
| 118 | - foreach ($reflection->getMethods() as $method) { |
|
| 119 | - if ($method->getDeclaringClass()->name !== $reflection->name) { |
|
| 118 | + foreach ($reflection->getMethods() as $method) |
|
| 119 | + { |
|
| 120 | + if ($method->getDeclaringClass()->name !== $reflection->name) |
|
| 121 | + { |
|
| 120 | 122 | continue; |
| 121 | 123 | } |
| 122 | 124 | |
| 123 | 125 | $reflectionMethods[$method->name] = $method; |
| 124 | 126 | $this->assertArrayHasKey($method->name, $methods); |
| 125 | 127 | |
| 126 | - if (!$method->hasReturnType()) { |
|
| 128 | + if (!$method->hasReturnType()) |
|
| 129 | + { |
|
| 127 | 130 | $this->assertNull($methods[$method->name]['hint']); |
| 128 | - } else { |
|
| 131 | + } |
|
| 132 | + else |
|
| 133 | + { |
|
| 129 | 134 | $this->assertEquals($methods[$method->name]['hint'], $method->getReturnType()->getName()); |
| 130 | 135 | } |
| 131 | 136 | |
@@ -169,8 +174,10 @@ discard block |
||
| 169 | 174 | ]; |
| 170 | 175 | |
| 171 | 176 | $reflectionMethods = []; |
| 172 | - foreach ($reflection->getMethods() as $method) { |
|
| 173 | - if ($method->getDeclaringClass()->name !== $reflection->name) { |
|
| 177 | + foreach ($reflection->getMethods() as $method) |
|
| 178 | + { |
|
| 179 | + if ($method->getDeclaringClass()->name !== $reflection->name) |
|
| 180 | + { |
|
| 174 | 181 | continue; |
| 175 | 182 | } |
| 176 | 183 | $reflectionMethods[$method->name] = $method; |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | 'alias' => $alias, |
| 34 | 34 | '--description' => 'My sample command description', |
| 35 | 35 | ]; |
| 36 | - if ($alias === null) { |
|
| 36 | + if ($alias === null){ |
|
| 37 | 37 | unset($input['alias']); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -33,7 +33,8 @@ |
||
| 33 | 33 | 'alias' => $alias, |
| 34 | 34 | '--description' => 'My sample command description', |
| 35 | 35 | ]; |
| 36 | - if ($alias === null) { |
|
| 36 | + if ($alias === null) |
|
| 37 | + { |
|
| 37 | 38 | unset($input['alias']); |
| 38 | 39 | } |
| 39 | 40 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $line = __LINE__; |
| 92 | 92 | $className = "\\Spiral\\Tests\\Scaffolder\\App\\Request\\Sample{$line}Request"; |
| 93 | 93 | $output = $this->console()->run('create:filter', [ |
| 94 | - 'name' => 'sample' . $line, |
|
| 94 | + 'name' => 'sample'.$line, |
|
| 95 | 95 | '--entity' => SourceEntity::class |
| 96 | 96 | ]); |
| 97 | 97 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $reflection = new ReflectionClass($className); |
| 104 | 104 | |
| 105 | - try { |
|
| 105 | + try{ |
|
| 106 | 106 | $schema = $reflection->getConstant('SCHEMA'); |
| 107 | 107 | $this->assertSame('data:noTypeString', $schema['noTypeString']); |
| 108 | 108 | $this->assertSame('data:obj', $schema['obj']); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $this->assertSame(['notEmpty', 'string'], $validates['obj']); |
| 115 | 115 | $this->assertSame(['notEmpty', 'integer'], $validates['intFromPhpDoc']); |
| 116 | 116 | $this->assertSame(['notEmpty', 'float'], $validates['noTypeWithFloatDefault']); |
| 117 | - } finally { |
|
| 117 | + }finally{ |
|
| 118 | 118 | $this->deleteDeclaration($className); |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -102,7 +102,8 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $reflection = new ReflectionClass($className); |
| 104 | 104 | |
| 105 | - try { |
|
| 105 | + try |
|
| 106 | + { |
|
| 106 | 107 | $schema = $reflection->getConstant('SCHEMA'); |
| 107 | 108 | $this->assertSame('data:noTypeString', $schema['noTypeString']); |
| 108 | 109 | $this->assertSame('data:obj', $schema['obj']); |
@@ -114,7 +115,9 @@ discard block |
||
| 114 | 115 | $this->assertSame(['notEmpty', 'string'], $validates['obj']); |
| 115 | 116 | $this->assertSame(['notEmpty', 'integer'], $validates['intFromPhpDoc']); |
| 116 | 117 | $this->assertSame(['notEmpty', 'float'], $validates['noTypeWithFloatDefault']); |
| 117 | - } finally { |
|
| 118 | + } |
|
| 119 | + finally |
|
| 120 | + { |
|
| 118 | 121 | $this->deleteDeclaration($className); |
| 119 | 122 | } |
| 120 | 123 | } |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | public function testFromEntity(): void |
| 90 | 90 | { |
| 91 | 91 | $line = __LINE__; |
| 92 | - $className = "\\Spiral\\Tests\\Scaffolder\\App\\Request\\Sample{$line}Request"; |
|
| 92 | + $className = "\\Spiral\\Tests\\Scaffolder\\App\\Request\\Sample{$line}request"; |
|
| 93 | 93 | $output = $this->console()->run('create:filter', [ |
| 94 | 94 | 'name' => 'sample' . $line, |
| 95 | 95 | '--entity' => SourceEntity::class |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function tearDown(): void |
| 29 | 29 | { |
| 30 | - $this->files()->deleteDirectory($this->app->directory('app') . 'migrations', true); |
|
| 30 | + $this->files()->deleteDirectory($this->app->directory('app').'migrations', true); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | clearstatcache(); |
| 42 | 42 | |
| 43 | - foreach ($this->files()->getFiles($this->app->directory('app') . 'migrations') as $file) { |
|
| 43 | + foreach ($this->files()->getFiles($this->app->directory('app').'migrations') as $file){ |
|
| 44 | 44 | require_once $file; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | clearstatcache(); |
| 65 | 65 | |
| 66 | - foreach ($this->files()->getFiles($this->app->directory('app') . 'migrations') as $file) { |
|
| 66 | + foreach ($this->files()->getFiles($this->app->directory('app').'migrations') as $file){ |
|
| 67 | 67 | require_once $file; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $this->console()->run('create:migration', [ |
| 83 | 83 | 'name' => 'sample3', |
| 84 | 84 | '--table' => 'sample3_table', |
| 85 | - '--field' => ['id',] |
|
| 85 | + '--field' => ['id', ] |
|
| 86 | 86 | ]); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | ] |
| 97 | 97 | ]; |
| 98 | 98 | |
| 99 | - if ($withTable) { |
|
| 99 | + if ($withTable){ |
|
| 100 | 100 | $input['--table'] = 'sample_table'; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | clearstatcache(); |
| 115 | 115 | |
| 116 | - foreach ($this->files()->getFiles($this->app->directory('app') . 'migrations') as $file) { |
|
| 116 | + foreach ($this->files()->getFiles($this->app->directory('app').'migrations') as $file){ |
|
| 117 | 117 | require_once $file; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -40,7 +40,8 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | clearstatcache(); |
| 42 | 42 | |
| 43 | - foreach ($this->files()->getFiles($this->app->directory('app') . 'migrations') as $file) { |
|
| 43 | + foreach ($this->files()->getFiles($this->app->directory('app') . 'migrations') as $file) |
|
| 44 | + { |
|
| 44 | 45 | require_once $file; |
| 45 | 46 | } |
| 46 | 47 | |
@@ -63,7 +64,8 @@ discard block |
||
| 63 | 64 | |
| 64 | 65 | clearstatcache(); |
| 65 | 66 | |
| 66 | - foreach ($this->files()->getFiles($this->app->directory('app') . 'migrations') as $file) { |
|
| 67 | + foreach ($this->files()->getFiles($this->app->directory('app') . 'migrations') as $file) |
|
| 68 | + { |
|
| 67 | 69 | require_once $file; |
| 68 | 70 | } |
| 69 | 71 | |
@@ -96,7 +98,8 @@ discard block |
||
| 96 | 98 | ] |
| 97 | 99 | ]; |
| 98 | 100 | |
| 99 | - if ($withTable) { |
|
| 101 | + if ($withTable) |
|
| 102 | + { |
|
| 100 | 103 | $input['--table'] = 'sample_table'; |
| 101 | 104 | } |
| 102 | 105 | |
@@ -113,7 +116,8 @@ discard block |
||
| 113 | 116 | { |
| 114 | 117 | clearstatcache(); |
| 115 | 118 | |
| 116 | - foreach ($this->files()->getFiles($this->app->directory('app') . 'migrations') as $file) { |
|
| 119 | + foreach ($this->files()->getFiles($this->app->directory('app') . 'migrations') as $file) |
|
| 120 | + { |
|
| 117 | 121 | require_once $file; |
| 118 | 122 | } |
| 119 | 123 | |