@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | // Decline static file requests back to the PHP built-in webserver |
| 13 | 13 | if (php_sapi_name() === 'cli-server') { |
| 14 | - $path = realpath(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); |
|
| 14 | + $path = realpath(__DIR__ . parse_url($_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH)); |
|
| 15 | 15 | if (__FILE__ !== $path && is_file($path)) { |
| 16 | 16 | return false; |
| 17 | 17 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | // Composer autoloading |
| 22 | 22 | include __DIR__ . '/../vendor/autoload.php'; |
| 23 | 23 | |
| 24 | -if (! class_exists(Application::class)) { |
|
| 24 | +if (!class_exists(Application::class)) { |
|
| 25 | 25 | throw new RuntimeException( |
| 26 | 26 | "Unable to load application.\n" |
| 27 | 27 | . "- Type `composer install` if you are developing locally.\n" |
@@ -1,2 +1,2 @@ |
||
| 1 | 1 | <?php |
| 2 | -return []; |
|
| 2 | +return [ ]; |
|
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | public function execute(InputInterface $input, OutputInterface $output) |
| 100 | 100 | { |
| 101 | 101 | /** @var string $traitName */ |
| 102 | - $traitName = (string)$input->getOption('className'); |
|
| 102 | + $traitName = (string) $input->getOption('className'); |
|
| 103 | 103 | |
| 104 | 104 | /** @var string $destination */ |
| 105 | - $destination = (string)$input->getOption('output'); |
|
| 105 | + $destination = (string) $input->getOption('output'); |
|
| 106 | 106 | |
| 107 | 107 | $outputFileName = sprintf( |
| 108 | 108 | '%s/%s.php', |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | private function generateTrait(InputInterface $input): TraitGenerator |
| 196 | 196 | { |
| 197 | 197 | /** @var string $entityManagerGetter */ |
| 198 | - $entityManagerGetter = (string)$input->getOption('em-getter'); |
|
| 198 | + $entityManagerGetter = (string) $input->getOption('em-getter'); |
|
| 199 | 199 | /** @var string $traitName */ |
| 200 | - $traitName = (string)$input->getOption('className'); |
|
| 200 | + $traitName = (string) $input->getOption('className'); |
|
| 201 | 201 | /** @var string $traitNameSpace */ |
| 202 | - $traitNameSpace = (string)$input->getOption('namespace'); |
|
| 202 | + $traitNameSpace = (string) $input->getOption('namespace'); |
|
| 203 | 203 | |
| 204 | 204 | $trait = new TraitGenerator( |
| 205 | 205 | $traitName, |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | 'get%sRepository', |
| 258 | 258 | $reflection->getShortName() |
| 259 | 259 | ), |
| 260 | - [], |
|
| 260 | + [ ], |
|
| 261 | 261 | MethodGenerator::FLAG_PUBLIC, |
| 262 | 262 | sprintf( |
| 263 | 263 | 'return $this->%s->getRepository(\\%s::class);', |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $events->attach( |
| 29 | 29 | 'doctrine', |
| 30 | 30 | 'loadCli.post', |
| 31 | - function (EventInterface $e) { |
|
| 31 | + function(EventInterface $e) { |
|
| 32 | 32 | /* @var $cli Application */ |
| 33 | 33 | $cli = $e->getTarget(); |
| 34 | 34 | |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | ConsoleRunner::addCommands($cli); |
| 41 | 41 | |
| 42 | - $cli->addCommands([new GenerateTraitCommand($em)]); |
|
| 43 | - $cli->addCommands([new GenerateDataFactoryCommand($em)]); |
|
| 42 | + $cli->addCommands([ new GenerateTraitCommand($em) ]); |
|
| 43 | + $cli->addCommands([ new GenerateDataFactoryCommand($em) ]); |
|
| 44 | 44 | } |
| 45 | 45 | ); |
| 46 | 46 | } |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | { |
| 183 | 183 | $data = array_map( |
| 184 | 184 | function(array $associationMapping) { |
| 185 | - if ($associationMapping['type'] > 0 && $associationMapping['type'] < 4) { |
|
| 185 | + if ($associationMapping[ 'type' ] > 0 && $associationMapping[ 'type' ] < 4) { |
|
| 186 | 186 | return sprintf( |
| 187 | 187 | " '%s' => 'entity|' . \\%s::class,\n", |
| 188 | - $associationMapping['fieldName'], |
|
| 189 | - $associationMapping['targetEntity'] |
|
| 188 | + $associationMapping[ 'fieldName' ], |
|
| 189 | + $associationMapping[ 'targetEntity' ] |
|
| 190 | 190 | ); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -204,50 +204,50 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | private function buildFieldMappings(ClassMetadata $metaData): array |
| 206 | 206 | { |
| 207 | - $data = []; |
|
| 207 | + $data = [ ]; |
|
| 208 | 208 | |
| 209 | 209 | foreach ($metaData->fieldMappings as $fieldMapping) { |
| 210 | - switch ($fieldMapping['type']) { |
|
| 210 | + switch ($fieldMapping[ 'type' ]) { |
|
| 211 | 211 | case 'smallint': |
| 212 | 212 | case 'integer': |
| 213 | 213 | case 'bigint': |
| 214 | - $data[] = sprintf( |
|
| 214 | + $data[ ] = sprintf( |
|
| 215 | 215 | " '%s' => random_int(0, 65000),\n", |
| 216 | - $fieldMapping['fieldName'] |
|
| 216 | + $fieldMapping[ 'fieldName' ] |
|
| 217 | 217 | ); |
| 218 | 218 | break; |
| 219 | 219 | case 'decimal': |
| 220 | 220 | case 'float': |
| 221 | - $data[] = sprintf( |
|
| 221 | + $data[ ] = sprintf( |
|
| 222 | 222 | " '%s' => Faker::randomFloat(2),\n", |
| 223 | - $fieldMapping['fieldName'] |
|
| 223 | + $fieldMapping[ 'fieldName' ] |
|
| 224 | 224 | ); |
| 225 | 225 | break; |
| 226 | 226 | case 'string': |
| 227 | - $data[] = sprintf( |
|
| 227 | + $data[ ] = sprintf( |
|
| 228 | 228 | " '%s' => Faker::sentence(),\n", |
| 229 | - $fieldMapping['fieldName'] |
|
| 229 | + $fieldMapping[ 'fieldName' ] |
|
| 230 | 230 | ); |
| 231 | 231 | break; |
| 232 | 232 | case 'text': |
| 233 | - $data[] = sprintf( |
|
| 233 | + $data[ ] = sprintf( |
|
| 234 | 234 | " '%s' => Faker::paragraph(),\n", |
| 235 | - $fieldMapping['fieldName'] |
|
| 235 | + $fieldMapping[ 'fieldName' ] |
|
| 236 | 236 | ); |
| 237 | 237 | break; |
| 238 | 238 | case 'guid': |
| 239 | - $data[] = sprintf( |
|
| 239 | + $data[ ] = sprintf( |
|
| 240 | 240 | " '%s' => uniqid('', true)", |
| 241 | - $fieldMapping['fieldName'] |
|
| 241 | + $fieldMapping[ 'fieldName' ] |
|
| 242 | 242 | ); |
| 243 | 243 | break; |
| 244 | 244 | case 'binary': |
| 245 | 245 | case 'blob': |
| 246 | 246 | break; |
| 247 | 247 | case 'boolean': |
| 248 | - $data[] = sprintf( |
|
| 248 | + $data[ ] = sprintf( |
|
| 249 | 249 | " '%s' => (bool)random_int(0, 1),\n", |
| 250 | - $fieldMapping['fieldName'] |
|
| 250 | + $fieldMapping[ 'fieldName' ] |
|
| 251 | 251 | ); |
| 252 | 252 | break; |
| 253 | 253 | case 'date': |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | case 'datetimetz_immutable': |
| 259 | 259 | case 'time': |
| 260 | 260 | case 'time_immutable': |
| 261 | - $data[] = sprintf( |
|
| 261 | + $data[ ] = sprintf( |
|
| 262 | 262 | " '%s' => Faker::dateTime(),\n", |
| 263 | - $fieldMapping['fieldName'] |
|
| 263 | + $fieldMapping[ 'fieldName' ] |
|
| 264 | 264 | ); |
| 265 | 265 | break; |
| 266 | 266 | case 'dateinterval': |
@@ -271,9 +271,9 @@ discard block |
||
| 271 | 271 | case 'object': |
| 272 | 272 | break; |
| 273 | 273 | default: |
| 274 | - $data[] = sprintf( |
|
| 274 | + $data[ ] = sprintf( |
|
| 275 | 275 | " '%s' => Faker::word(),\n", |
| 276 | - $fieldMapping['fieldName'] |
|
| 276 | + $fieldMapping[ 'fieldName' ] |
|
| 277 | 277 | ); |
| 278 | 278 | break; |
| 279 | 279 | } |