@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | $property = $this->property($name); |
| 98 | 98 | $property->setComment("@var {$this->variableType($type)}"); |
| 99 | - if ($accessibility) { |
|
| 99 | + if ($accessibility){ |
|
| 100 | 100 | $property->setAccess($accessibility); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if ($property->getAccess() !== self::ACCESS_PUBLIC) { |
|
| 103 | + if ($property->getAccess() !== self::ACCESS_PUBLIC){ |
|
| 104 | 104 | $this->declareAccessors($name, $type); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | private function variableType(string $type): string |
| 126 | 126 | { |
| 127 | - return $this->isNullableType($type) ? (substr($type, 1) . '|null') : $type; |
|
| 127 | + return $this->isNullableType($type) ? (substr($type, 1).'|null') : $type; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -133,12 +133,12 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | private function declareAccessors(string $field, string $type): void |
| 135 | 135 | { |
| 136 | - $setter = $this->method('set' . $this->classify($field)); |
|
| 136 | + $setter = $this->method('set'.$this->classify($field)); |
|
| 137 | 137 | $setter->setPublic(); |
| 138 | 138 | $setter->parameter('value')->setType($type); |
| 139 | 139 | $setter->setSource("\$this->$field = \$value;"); |
| 140 | 140 | |
| 141 | - $getter = $this->method('get' . $this->classify($field)); |
|
| 141 | + $getter = $this->method('get'.$this->classify($field)); |
|
| 142 | 142 | $getter->setPublic(); |
| 143 | 143 | $getter->setSource("return \$this->$field;"); |
| 144 | 144 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | private function classify(string $name): string |
| 151 | 151 | { |
| 152 | - return ( new InflectorFactory() ) |
|
| 152 | + return (new InflectorFactory()) |
|
| 153 | 153 | ->build() |
| 154 | 154 | ->classify($name); |
| 155 | 155 | } |
@@ -96,11 +96,13 @@ |
||
| 96 | 96 | { |
| 97 | 97 | $property = $this->property($name); |
| 98 | 98 | $property->setComment("@var {$this->variableType($type)}"); |
| 99 | - if ($accessibility) { |
|
| 99 | + if ($accessibility) |
|
| 100 | + { |
|
| 100 | 101 | $property->setAccess($accessibility); |
| 101 | 102 | } |
| 102 | 103 | |
| 103 | - if ($property->getAccess() !== self::ACCESS_PUBLIC) { |
|
| 104 | + if ($property->getAccess() !== self::ACCESS_PUBLIC) |
|
| 105 | + { |
|
| 104 | 106 | $this->declareAccessors($name, $type); |
| 105 | 107 | } |
| 106 | 108 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | string $name, |
| 76 | 76 | string $comment = '', |
| 77 | 77 | string $directory = '' |
| 78 | - ) { |
|
| 78 | + ){ |
|
| 79 | 79 | parent::__construct($name, 'InjectableConfig', [], $comment); |
| 80 | 80 | |
| 81 | 81 | $this->config = $config; |
@@ -102,16 +102,16 @@ 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 | + if (!$this->files->exists($filename)){ |
|
| 107 | 107 | throw new ScaffolderException("Config filename $filename doesn't exist"); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $defaultsFromFile = require $filename; |
| 111 | 111 | $this->declareGetters($defaultsFromFile); |
| 112 | 112 | $this->declareStructure($this->configName, $this->defaultValues->get($defaultsFromFile)); |
| 113 | - } else { |
|
| 114 | - if (!$this->files->exists($filename)) { |
|
| 113 | + }else{ |
|
| 114 | + if (!$this->files->exists($filename)){ |
|
| 115 | 115 | $this->touchConfigFile($filename); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $getters = []; |
| 170 | 170 | $gettersByKey = []; |
| 171 | 171 | |
| 172 | - foreach ($defaults as $key => $value) { |
|
| 172 | + foreach ($defaults as $key => $value){ |
|
| 173 | 173 | $key = (string)$key; |
| 174 | 174 | $getter = $this->makeGetterName($key); |
| 175 | 175 | $getters[] = $getter; |
@@ -178,19 +178,19 @@ discard block |
||
| 178 | 178 | $method->setSource("return \$this->config['$key'];"); |
| 179 | 179 | $method->setComment("@return {$this->typeAnnotations->getAnnotation($value)}"); |
| 180 | 180 | |
| 181 | - if (is_array($value)) { |
|
| 181 | + if (is_array($value)){ |
|
| 182 | 182 | $gettersByKey[] = compact('key', 'value'); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | $returnTypeHint = $this->typeHints->getHint(gettype($value)); |
| 186 | - if ($returnTypeHint !== null) { |
|
| 186 | + if ($returnTypeHint !== null){ |
|
| 187 | 187 | $method->setReturn($returnTypeHint); |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - foreach ($gettersByKey as $item) { |
|
| 191 | + foreach ($gettersByKey as $item){ |
|
| 192 | 192 | $method = $this->declareGettersByKey($getters, $item['key'], $item['value']); |
| 193 | - if ($method !== null) { |
|
| 193 | + if ($method !== null){ |
|
| 194 | 194 | $getters[] = $method->getName(); |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -207,30 +207,30 @@ discard block |
||
| 207 | 207 | private function declareGettersByKey(array $methodNames, string $key, array $value): ?Method |
| 208 | 208 | { |
| 209 | 209 | //Won't create if there's less than 2 sub-items |
| 210 | - if (count($value) < 2) { |
|
| 210 | + if (count($value) < 2){ |
|
| 211 | 211 | return null; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | $singularKey = $this->singularize($key); |
| 215 | 215 | $name = $this->makeGetterName($singularKey); |
| 216 | - if (in_array($name, $methodNames, true)) { |
|
| 216 | + if (in_array($name, $methodNames, true)){ |
|
| 217 | 217 | $name = $this->makeGetterName($singularKey, 'get', 'by'); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | //Name conflict, won't merge |
| 221 | - if (in_array($name, $methodNames, true)) { |
|
| 221 | + if (in_array($name, $methodNames, true)){ |
|
| 222 | 222 | return null; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | $keyType = defineArrayType(array_keys($value), '-mixed-'); |
| 226 | 226 | $valueType = defineArrayType(array_values($value), '-mixed-'); |
| 227 | 227 | //We need a fixed structure here |
| 228 | - if ($keyType === '-mixed-' || $valueType === '-mixed-') { |
|
| 228 | + if ($keyType === '-mixed-' || $valueType === '-mixed-'){ |
|
| 229 | 229 | return null; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | //Won't create for associated arrays |
| 233 | - if ($this->typeAnnotations->mapType($keyType) === 'int' && !isAssociativeArray($value)) { |
|
| 233 | + if ($this->typeAnnotations->mapType($keyType) === 'int' && !isAssociativeArray($value)){ |
|
| 234 | 234 | return null; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | $param = $method->parameter($singularKey); |
| 246 | 246 | $paramTypeHint = $this->typeHints->getHint($keyType); |
| 247 | - if ($paramTypeHint !== null) { |
|
| 247 | + if ($paramTypeHint !== null){ |
|
| 248 | 248 | $param->setType($paramTypeHint); |
| 249 | 249 | } |
| 250 | 250 | |
@@ -260,13 +260,13 @@ discard block |
||
| 260 | 260 | private function makeGetterName(string $name, string $prefix = 'get', string $postfix = ''): string |
| 261 | 261 | { |
| 262 | 262 | $chunks = []; |
| 263 | - if (!empty($prefix)) { |
|
| 263 | + if (!empty($prefix)){ |
|
| 264 | 264 | $chunks[] = $prefix; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | $name = $this->slugify->slugify($name, ['lowercase' => false]); |
| 268 | 268 | $chunks[] = count($chunks) !== 0 ? $this->classify($name) : $name; |
| 269 | - if (!empty($postfix)) { |
|
| 269 | + if (!empty($postfix)){ |
|
| 270 | 270 | $chunks[] = ucfirst($postfix); |
| 271 | 271 | } |
| 272 | 272 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | */ |
| 293 | 293 | private function classify(string $name): string |
| 294 | 294 | { |
| 295 | - return ( new InflectorFactory() ) |
|
| 295 | + return (new InflectorFactory()) |
|
| 296 | 296 | ->build() |
| 297 | 297 | ->classify($name); |
| 298 | 298 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | private function singularize(string $name): string |
| 305 | 305 | { |
| 306 | - return ( new InflectorFactory() ) |
|
| 306 | + return (new InflectorFactory()) |
|
| 307 | 307 | ->build() |
| 308 | 308 | ->singularize($name); |
| 309 | 309 | } |
@@ -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 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | $schema = $this->constant('SCHEMA')->getValue(); |
| 61 | 61 | $validates = $this->constant('VALIDATES')->getValue(); |
| 62 | 62 | |
| 63 | - if (!isset($this->mapping[$type])) { |
|
| 64 | - $schema[$field] = ($source ?? self::DEFAULT_SOURCE) . ':' . ($origin ?: $field); |
|
| 63 | + if (!isset($this->mapping[$type])){ |
|
| 64 | + $schema[$field] = ($source ?? self::DEFAULT_SOURCE).':'.($origin ?: $field); |
|
| 65 | 65 | |
| 66 | 66 | $this->constant('SCHEMA')->setValue($schema); |
| 67 | 67 | |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | //Source can depend on type |
| 74 | 74 | $source = $source ?? $definition['source']; |
| 75 | - $schema[$field] = $source . ':' . ($origin ?: $field); |
|
| 75 | + $schema[$field] = $source.':'.($origin ?: $field); |
|
| 76 | 76 | |
| 77 | - if (!empty($definition['validates'])) { |
|
| 77 | + if (!empty($definition['validates'])){ |
|
| 78 | 78 | //Pre-defined validation |
| 79 | 79 | $validates[$field] = $definition['validates']; |
| 80 | 80 | } |
@@ -60,7 +60,8 @@ discard block |
||
| 60 | 60 | $schema = $this->constant('SCHEMA')->getValue(); |
| 61 | 61 | $validates = $this->constant('VALIDATES')->getValue(); |
| 62 | 62 | |
| 63 | - if (!isset($this->mapping[$type])) { |
|
| 63 | + if (!isset($this->mapping[$type])) |
|
| 64 | + { |
|
| 64 | 65 | $schema[$field] = ($source ?? self::DEFAULT_SOURCE) . ':' . ($origin ?: $field); |
| 65 | 66 | |
| 66 | 67 | $this->constant('SCHEMA')->setValue($schema); |
@@ -74,7 +75,8 @@ discard block |
||
| 74 | 75 | $source = $source ?? $definition['source']; |
| 75 | 76 | $schema[$field] = $source . ':' . ($origin ?: $field); |
| 76 | 77 | |
| 77 | - if (!empty($definition['validates'])) { |
|
| 78 | + if (!empty($definition['validates'])) |
|
| 79 | + { |
|
| 78 | 80 | //Pre-defined validation |
| 79 | 81 | $validates[$field] = $definition['validates']; |
| 80 | 82 | } |
@@ -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 | |