@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | $metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE); |
| 11 | 11 | $metadata->setPrimaryTable( |
| 12 | 12 | [ |
| 13 | - 'name' => 'cms_users', |
|
| 14 | - 'options' => ['engine' => 'MyISAM', 'foo' => ['bar' => 'baz']], |
|
| 13 | + 'name' => 'cms_users', |
|
| 14 | + 'options' => ['engine' => 'MyISAM', 'foo' => ['bar' => 'baz']], |
|
| 15 | 15 | ] |
| 16 | 16 | ); |
| 17 | 17 | $metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT); |
@@ -20,35 +20,35 @@ discard block |
||
| 20 | 20 | $metadata->addLifecycleCallback('doStuffOnPostPersist', Events::postPersist); |
| 21 | 21 | $metadata->mapField( |
| 22 | 22 | [ |
| 23 | - 'id' => true, |
|
| 24 | - 'fieldName' => 'id', |
|
| 25 | - 'type' => 'integer', |
|
| 26 | - 'columnName' => 'id', |
|
| 23 | + 'id' => true, |
|
| 24 | + 'fieldName' => 'id', |
|
| 25 | + 'type' => 'integer', |
|
| 26 | + 'columnName' => 'id', |
|
| 27 | 27 | ] |
| 28 | 28 | ); |
| 29 | 29 | $metadata->mapField( |
| 30 | 30 | [ |
| 31 | - 'fieldName' => 'name', |
|
| 32 | - 'type' => 'string', |
|
| 33 | - 'length' => 50, |
|
| 34 | - 'unique' => true, |
|
| 35 | - 'nullable' => true, |
|
| 36 | - 'columnName' => 'name', |
|
| 31 | + 'fieldName' => 'name', |
|
| 32 | + 'type' => 'string', |
|
| 33 | + 'length' => 50, |
|
| 34 | + 'unique' => true, |
|
| 35 | + 'nullable' => true, |
|
| 36 | + 'columnName' => 'name', |
|
| 37 | 37 | ] |
| 38 | 38 | ); |
| 39 | 39 | $metadata->mapField( |
| 40 | 40 | [ |
| 41 | - 'fieldName' => 'email', |
|
| 42 | - 'type' => 'string', |
|
| 43 | - 'columnName' => 'user_email', |
|
| 44 | - 'columnDefinition' => 'CHAR(32) NOT NULL', |
|
| 41 | + 'fieldName' => 'email', |
|
| 42 | + 'type' => 'string', |
|
| 43 | + 'columnName' => 'user_email', |
|
| 44 | + 'columnDefinition' => 'CHAR(32) NOT NULL', |
|
| 45 | 45 | ] |
| 46 | 46 | ); |
| 47 | 47 | $metadata->mapField( |
| 48 | 48 | [ |
| 49 | - 'fieldName' => 'age', |
|
| 50 | - 'type' => 'integer', |
|
| 51 | - 'options' => ["unsigned"=>true], |
|
| 49 | + 'fieldName' => 'age', |
|
| 50 | + 'type' => 'integer', |
|
| 51 | + 'options' => ["unsigned"=>true], |
|
| 52 | 52 | ] |
| 53 | 53 | ); |
| 54 | 54 | $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); |
@@ -60,25 +60,25 @@ discard block |
||
| 60 | 60 | ); |
| 61 | 61 | $metadata->mapOneToOne( |
| 62 | 62 | [ |
| 63 | - 'fieldName' => 'address', |
|
| 64 | - 'targetEntity' => Export\Address::class, |
|
| 65 | - 'inversedBy' => 'user', |
|
| 66 | - 'cascade' => |
|
| 67 | - [ |
|
| 68 | - 0 => 'persist', |
|
| 69 | - ], |
|
| 70 | - 'mappedBy' => NULL, |
|
| 71 | - 'joinColumns' => |
|
| 72 | - [ |
|
| 73 | - 0 => |
|
| 74 | - [ |
|
| 63 | + 'fieldName' => 'address', |
|
| 64 | + 'targetEntity' => Export\Address::class, |
|
| 65 | + 'inversedBy' => 'user', |
|
| 66 | + 'cascade' => |
|
| 67 | + [ |
|
| 68 | + 0 => 'persist', |
|
| 69 | + ], |
|
| 70 | + 'mappedBy' => NULL, |
|
| 71 | + 'joinColumns' => |
|
| 72 | + [ |
|
| 73 | + 0 => |
|
| 74 | + [ |
|
| 75 | 75 | 'name' => 'address_id', |
| 76 | 76 | 'referencedColumnName' => 'id', |
| 77 | 77 | 'onDelete' => 'CASCADE', |
| 78 | - ], |
|
| 79 | - ], |
|
| 80 | - 'orphanRemoval' => true, |
|
| 81 | - 'fetch' => ClassMetadataInfo::FETCH_EAGER, |
|
| 78 | + ], |
|
| 79 | + ], |
|
| 80 | + 'orphanRemoval' => true, |
|
| 81 | + 'fetch' => ClassMetadataInfo::FETCH_EAGER, |
|
| 82 | 82 | ] |
| 83 | 83 | ); |
| 84 | 84 | $metadata->mapOneToOne( |
@@ -97,41 +97,41 @@ discard block |
||
| 97 | 97 | ); |
| 98 | 98 | $metadata->mapOneToMany( |
| 99 | 99 | [ |
| 100 | - 'fieldName' => 'phonenumbers', |
|
| 101 | - 'targetEntity' => Export\Phonenumber::class, |
|
| 102 | - 'cascade' => |
|
| 103 | - [ |
|
| 104 | - 1 => 'persist', |
|
| 105 | - 2 => 'merge', |
|
| 106 | - ], |
|
| 107 | - 'mappedBy' => 'user', |
|
| 108 | - 'orphanRemoval' => true, |
|
| 109 | - 'fetch' => ClassMetadataInfo::FETCH_LAZY, |
|
| 110 | - 'orderBy' => |
|
| 111 | - [ |
|
| 112 | - 'number' => 'ASC', |
|
| 113 | - ], |
|
| 100 | + 'fieldName' => 'phonenumbers', |
|
| 101 | + 'targetEntity' => Export\Phonenumber::class, |
|
| 102 | + 'cascade' => |
|
| 103 | + [ |
|
| 104 | + 1 => 'persist', |
|
| 105 | + 2 => 'merge', |
|
| 106 | + ], |
|
| 107 | + 'mappedBy' => 'user', |
|
| 108 | + 'orphanRemoval' => true, |
|
| 109 | + 'fetch' => ClassMetadataInfo::FETCH_LAZY, |
|
| 110 | + 'orderBy' => |
|
| 111 | + [ |
|
| 112 | + 'number' => 'ASC', |
|
| 113 | + ], |
|
| 114 | 114 | ] |
| 115 | 115 | ); |
| 116 | 116 | $metadata->mapManyToMany( |
| 117 | 117 | [ |
| 118 | - 'fieldName' => 'groups', |
|
| 119 | - 'targetEntity' => Export\Group::class, |
|
| 120 | - 'fetch' => ClassMetadataInfo::FETCH_EXTRA_LAZY, |
|
| 121 | - 'cascade' => |
|
| 122 | - [ |
|
| 123 | - 0 => 'remove', |
|
| 124 | - 1 => 'persist', |
|
| 125 | - 2 => 'refresh', |
|
| 126 | - 3 => 'merge', |
|
| 127 | - 4 => 'detach', |
|
| 128 | - ], |
|
| 129 | - 'mappedBy' => NULL, |
|
| 130 | - 'joinTable' => |
|
| 131 | - [ |
|
| 132 | - 'name' => 'cms_users_groups', |
|
| 133 | - 'joinColumns' => |
|
| 134 | - [ |
|
| 118 | + 'fieldName' => 'groups', |
|
| 119 | + 'targetEntity' => Export\Group::class, |
|
| 120 | + 'fetch' => ClassMetadataInfo::FETCH_EXTRA_LAZY, |
|
| 121 | + 'cascade' => |
|
| 122 | + [ |
|
| 123 | + 0 => 'remove', |
|
| 124 | + 1 => 'persist', |
|
| 125 | + 2 => 'refresh', |
|
| 126 | + 3 => 'merge', |
|
| 127 | + 4 => 'detach', |
|
| 128 | + ], |
|
| 129 | + 'mappedBy' => NULL, |
|
| 130 | + 'joinTable' => |
|
| 131 | + [ |
|
| 132 | + 'name' => 'cms_users_groups', |
|
| 133 | + 'joinColumns' => |
|
| 134 | + [ |
|
| 135 | 135 | 0 => |
| 136 | 136 | [ |
| 137 | 137 | 'name' => 'user_id', |
@@ -139,18 +139,18 @@ discard block |
||
| 139 | 139 | 'unique' => false, |
| 140 | 140 | 'nullable' => false, |
| 141 | 141 | ], |
| 142 | - ], |
|
| 143 | - 'inverseJoinColumns' => |
|
| 144 | - [ |
|
| 142 | + ], |
|
| 143 | + 'inverseJoinColumns' => |
|
| 144 | + [ |
|
| 145 | 145 | 0 => |
| 146 | 146 | [ |
| 147 | 147 | 'name' => 'group_id', |
| 148 | 148 | 'referencedColumnName' => 'id', |
| 149 | 149 | 'columnDefinition' => 'INT NULL', |
| 150 | 150 | ], |
| 151 | - ], |
|
| 152 | - ], |
|
| 153 | - 'orderBy' => NULL, |
|
| 151 | + ], |
|
| 152 | + ], |
|
| 153 | + 'orderBy' => NULL, |
|
| 154 | 154 | ] |
| 155 | 155 | ); |
| 156 | 156 | $metadata->addEntityListener(Events::prePersist, UserListener::class, 'customPrePersist'); |
@@ -253,7 +253,7 @@ |
||
| 253 | 253 | private function processEntityListenerConfig(array $array, array $entityListenerConfig, string $event): array |
| 254 | 254 | { |
| 255 | 255 | foreach ($entityListenerConfig as $entityListener) { |
| 256 | - if (!isset($array['entityListeners'][$entityListener['class']])) { |
|
| 256 | + if ( ! isset($array['entityListeners'][$entityListener['class']])) { |
|
| 257 | 257 | $array['entityListeners'][$entityListener['class']] = []; |
| 258 | 258 | } |
| 259 | 259 | $array['entityListeners'][$entityListener['class']][$event] = [$entityListener['method']]; |
@@ -51,27 +51,27 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if ($metadata->inheritanceType) { |
| 54 | - $lines[] = '$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_' . $this->_getInheritanceTypeString($metadata->inheritanceType) . ');'; |
|
| 54 | + $lines[] = '$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_'.$this->_getInheritanceTypeString($metadata->inheritanceType).');'; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | if ($metadata->customRepositoryClassName) { |
| 58 | - $lines[] = "\$metadata->customRepositoryClassName = '" . $metadata->customRepositoryClassName . "';"; |
|
| 58 | + $lines[] = "\$metadata->customRepositoryClassName = '".$metadata->customRepositoryClassName."';"; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if ($metadata->table) { |
| 62 | - $lines[] = '$metadata->setPrimaryTable(' . $this->_varExport($metadata->table) . ');'; |
|
| 62 | + $lines[] = '$metadata->setPrimaryTable('.$this->_varExport($metadata->table).');'; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if ($metadata->discriminatorColumn) { |
| 66 | - $lines[] = '$metadata->setDiscriminatorColumn(' . $this->_varExport($metadata->discriminatorColumn) . ');'; |
|
| 66 | + $lines[] = '$metadata->setDiscriminatorColumn('.$this->_varExport($metadata->discriminatorColumn).');'; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if ($metadata->discriminatorMap) { |
| 70 | - $lines[] = '$metadata->setDiscriminatorMap(' . $this->_varExport($metadata->discriminatorMap) . ');'; |
|
| 70 | + $lines[] = '$metadata->setDiscriminatorMap('.$this->_varExport($metadata->discriminatorMap).');'; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if ($metadata->changeTrackingPolicy) { |
| 74 | - $lines[] = '$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_' . $this->_getChangeTrackingPolicyString($metadata->changeTrackingPolicy) . ');'; |
|
| 74 | + $lines[] = '$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_'.$this->_getChangeTrackingPolicyString($metadata->changeTrackingPolicy).');'; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | if ($metadata->lifecycleCallbacks) { |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | $lines = array_merge($lines, $this->processEntityListeners($metadata)); |
| 86 | 86 | |
| 87 | 87 | foreach ($metadata->fieldMappings as $fieldMapping) { |
| 88 | - $lines[] = '$metadata->mapField(' . $this->_varExport($fieldMapping) . ');'; |
|
| 88 | + $lines[] = '$metadata->mapField('.$this->_varExport($fieldMapping).');'; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if ( ! $metadata->isIdentifierComposite && $generatorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { |
| 92 | - $lines[] = '$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_' . $generatorType . ');'; |
|
| 92 | + $lines[] = '$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_'.$generatorType.');'; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | foreach ($metadata->associationMappings as $associationMapping) { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $associationMappingArray = array_merge($associationMappingArray, $manyToManyMappingArray); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $lines[] = '$metadata->' . $method . '(' . $this->_varExport($associationMappingArray) . ');'; |
|
| 158 | + $lines[] = '$metadata->'.$method.'('.$this->_varExport($associationMappingArray).');'; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | return implode("\n", $lines); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | protected function _varExport($var): string |
| 170 | 170 | { |
| 171 | 171 | $export = var_export($var, true); |
| 172 | - $export = str_replace("\n", PHP_EOL . str_repeat(' ', 8), $export); |
|
| 172 | + $export = str_replace("\n", PHP_EOL.str_repeat(' ', 8), $export); |
|
| 173 | 173 | $export = str_replace(' ', ' ', $export); |
| 174 | 174 | $export = str_replace('array (', 'array(', $export); |
| 175 | 175 | $export = str_replace('array( ', 'array(', $export); |
@@ -1237,6 +1237,9 @@ |
||
| 1237 | 1237 | return implode("\n", $lines); |
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | + /** |
|
| 1241 | + * @param string $defaultValue |
|
| 1242 | + */ |
|
| 1240 | 1243 | protected function generateEntityStubMethod( |
| 1241 | 1244 | ClassMetadataInfo $metadata, |
| 1242 | 1245 | string $type, |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | */ |
| 366 | 366 | public function writeEntityClass(ClassMetadataInfo $metadata, $outputDirectory): void |
| 367 | 367 | { |
| 368 | - $path = $outputDirectory . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name) . $this->extension; |
|
| 368 | + $path = $outputDirectory.'/'.str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name).$this->extension; |
|
| 369 | 369 | $dir = dirname($path); |
| 370 | 370 | |
| 371 | 371 | if ( ! is_dir($dir)) { |
@@ -381,8 +381,8 @@ discard block |
||
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | if ($this->backupExisting && file_exists($path)) { |
| 384 | - $backupPath = dirname($path) . DIRECTORY_SEPARATOR . basename($path) . "~"; |
|
| 385 | - if (!copy($path, $backupPath)) { |
|
| 384 | + $backupPath = dirname($path).DIRECTORY_SEPARATOR.basename($path)."~"; |
|
| 385 | + if ( ! copy($path, $backupPath)) { |
|
| 386 | 386 | throw new \RuntimeException("Attempt to backup overwritten entity file but copy operation failed."); |
| 387 | 387 | } |
| 388 | 388 | } |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | $body = str_replace('<spaces>', $this->spaces, $body); |
| 444 | 444 | $last = strrpos($currentCode, '}'); |
| 445 | 445 | |
| 446 | - return substr($currentCode, 0, $last) . $body . ($body ? "\n" : '') . "}\n"; |
|
| 446 | + return substr($currentCode, 0, $last).$body.($body ? "\n" : '')."}\n"; |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | public function setFieldVisibility($visibility): void |
| 508 | 508 | { |
| 509 | 509 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
| 510 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
| 510 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | $this->fieldVisibility = $visibility; |
@@ -602,18 +602,18 @@ discard block |
||
| 602 | 602 | * |
| 603 | 603 | * @return string |
| 604 | 604 | */ |
| 605 | - protected function generateEntityNamespace(ClassMetadataInfo $metadata): ?string |
|
| 605 | + protected function generateEntityNamespace(ClassMetadataInfo $metadata): ? string |
|
| 606 | 606 | { |
| 607 | - if (!$this->hasNamespace($metadata)) { |
|
| 607 | + if ( ! $this->hasNamespace($metadata)) { |
|
| 608 | 608 | return null; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - return 'namespace ' . $this->getNamespace($metadata) .';'; |
|
| 611 | + return 'namespace '.$this->getNamespace($metadata).';'; |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | - protected function generateEntityUse(): ?string |
|
| 614 | + protected function generateEntityUse(): ? string |
|
| 615 | 615 | { |
| 616 | - if (!$this->generateAnnotations) { |
|
| 616 | + if ( ! $this->generateAnnotations) { |
|
| 617 | 617 | return null; |
| 618 | 618 | } |
| 619 | 619 | |
@@ -627,8 +627,8 @@ discard block |
||
| 627 | 627 | */ |
| 628 | 628 | protected function generateEntityClassName(ClassMetadataInfo $metadata): string |
| 629 | 629 | { |
| 630 | - return 'class ' . $this->getClassName($metadata) . |
|
| 631 | - ($this->extendsClass() ? ' extends ' . $this->getClassToExtendName() : null); |
|
| 630 | + return 'class '.$this->getClassName($metadata). |
|
| 631 | + ($this->extendsClass() ? ' extends '.$this->getClassToExtendName() : null); |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | /** |
@@ -730,13 +730,13 @@ discard block |
||
| 730 | 730 | $fieldMappings = array_merge($requiredFields, $optionalFields); |
| 731 | 731 | |
| 732 | 732 | foreach ($metadata->embeddedClasses as $fieldName => $embeddedClass) { |
| 733 | - $paramType = '\\' . ltrim($embeddedClass['class'], '\\'); |
|
| 734 | - $paramVariable = '$' . $fieldName; |
|
| 733 | + $paramType = '\\'.ltrim($embeddedClass['class'], '\\'); |
|
| 734 | + $paramVariable = '$'.$fieldName; |
|
| 735 | 735 | |
| 736 | 736 | $paramTypes[] = $paramType; |
| 737 | 737 | $paramVariables[] = $paramVariable; |
| 738 | - $params[] = $paramType . ' ' . $paramVariable; |
|
| 739 | - $fields[] = '$this->' . $fieldName . ' = ' . $paramVariable . ';'; |
|
| 738 | + $params[] = $paramType.' '.$paramVariable; |
|
| 739 | + $fields[] = '$this->'.$fieldName.' = '.$paramVariable.';'; |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | foreach ($fieldMappings as $fieldMapping) { |
@@ -744,27 +744,27 @@ discard block |
||
| 744 | 744 | continue; |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | - $paramTypes[] = $this->getType($fieldMapping['type']) . (!empty($fieldMapping['nullable']) ? '|null' : ''); |
|
| 748 | - $param = '$' . $fieldMapping['fieldName']; |
|
| 747 | + $paramTypes[] = $this->getType($fieldMapping['type']).( ! empty($fieldMapping['nullable']) ? '|null' : ''); |
|
| 748 | + $param = '$'.$fieldMapping['fieldName']; |
|
| 749 | 749 | $paramVariables[] = $param; |
| 750 | 750 | |
| 751 | 751 | if ($fieldMapping['type'] === 'datetime') { |
| 752 | - $param = $this->getType($fieldMapping['type']) . ' ' . $param; |
|
| 752 | + $param = $this->getType($fieldMapping['type']).' '.$param; |
|
| 753 | 753 | } |
| 754 | 754 | |
| 755 | - if (!empty($fieldMapping['nullable'])) { |
|
| 755 | + if ( ! empty($fieldMapping['nullable'])) { |
|
| 756 | 756 | $param .= ' = null'; |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | $params[] = $param; |
| 760 | 760 | |
| 761 | - $fields[] = '$this->' . $fieldMapping['fieldName'] . ' = $' . $fieldMapping['fieldName'] . ';'; |
|
| 761 | + $fields[] = '$this->'.$fieldMapping['fieldName'].' = $'.$fieldMapping['fieldName'].';'; |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | $maxParamTypeLength = max(array_map('strlen', $paramTypes)); |
| 765 | 765 | $paramTags = array_map( |
| 766 | - function ($type, $variable) use ($maxParamTypeLength) { |
|
| 767 | - return '@param ' . $type . str_repeat(' ', $maxParamTypeLength - strlen($type) + 1) . $variable; |
|
| 766 | + function($type, $variable) use ($maxParamTypeLength) { |
|
| 767 | + return '@param '.$type.str_repeat(' ', $maxParamTypeLength - strlen($type) + 1).$variable; |
|
| 768 | 768 | }, |
| 769 | 769 | $paramTypes, |
| 770 | 770 | $paramVariables |
@@ -772,8 +772,8 @@ discard block |
||
| 772 | 772 | |
| 773 | 773 | // Generate multi line constructor if the signature exceeds 120 characters. |
| 774 | 774 | if (array_sum(array_map('strlen', $params)) + count($params) * 2 + 29 > 120) { |
| 775 | - $delimiter = "\n" . $this->spaces; |
|
| 776 | - $params = $delimiter . implode(',' . $delimiter, $params) . "\n"; |
|
| 775 | + $delimiter = "\n".$this->spaces; |
|
| 776 | + $params = $delimiter.implode(','.$delimiter, $params)."\n"; |
|
| 777 | 777 | } else { |
| 778 | 778 | $params = implode(', ', $params); |
| 779 | 779 | } |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | $replacements = [ |
| 782 | 782 | '<paramTags>' => implode("\n * ", $paramTags), |
| 783 | 783 | '<params>' => $params, |
| 784 | - '<fields>' => implode("\n" . $this->spaces, $fields), |
|
| 784 | + '<fields>' => implode("\n".$this->spaces, $fields), |
|
| 785 | 785 | ]; |
| 786 | 786 | |
| 787 | 787 | $constructor = str_replace( |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | |
| 827 | 827 | if ($inClass) { |
| 828 | 828 | $inClass = false; |
| 829 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
| 829 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
| 830 | 830 | $this->staticReflection[$lastSeenClass]['properties'] = []; |
| 831 | 831 | $this->staticReflection[$lastSeenClass]['methods'] = []; |
| 832 | 832 | } |
@@ -834,23 +834,23 @@ discard block |
||
| 834 | 834 | if (T_NAMESPACE === $token[0]) { |
| 835 | 835 | $lastSeenNamespace = ''; |
| 836 | 836 | $inNamespace = true; |
| 837 | - } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i-1][0]) { |
|
| 837 | + } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i - 1][0]) { |
|
| 838 | 838 | $inClass = true; |
| 839 | 839 | } elseif (T_FUNCTION === $token[0]) { |
| 840 | - if (T_STRING === $tokens[$i+2][0]) { |
|
| 841 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
| 842 | - } elseif ($tokens[$i+2] == '&' && T_STRING === $tokens[$i+3][0]) { |
|
| 843 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
| 840 | + if (T_STRING === $tokens[$i + 2][0]) { |
|
| 841 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
| 842 | + } elseif ($tokens[$i + 2] == '&' && T_STRING === $tokens[$i + 3][0]) { |
|
| 843 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
| 844 | 844 | } |
| 845 | - } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i+2][0]) { |
|
| 846 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
| 845 | + } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i + 2][0]) { |
|
| 846 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
| 847 | 847 | } |
| 848 | 848 | } |
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | protected function hasProperty(string $property, ClassMetadataInfo $metadata): bool |
| 852 | 852 | { |
| 853 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 853 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
| 854 | 854 | // don't generate property if its already on the base class. |
| 855 | 855 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
| 856 | 856 | if ($reflClass->hasProperty($property)) { |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | |
| 874 | 874 | protected function hasMethod(string $method, ClassMetadataInfo $metadata): bool |
| 875 | 875 | { |
| 876 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 876 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
| 877 | 877 | // don't generate method if its already on the base class. |
| 878 | 878 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
| 879 | 879 | |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | |
| 898 | 898 | protected function getTraits(ClassMetadataInfo $metadata): array |
| 899 | 899 | { |
| 900 | - if (! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
| 900 | + if ( ! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
| 901 | 901 | return []; |
| 902 | 902 | } |
| 903 | 903 | |
@@ -924,7 +924,7 @@ discard block |
||
| 924 | 924 | return (bool) $this->classToExtend; |
| 925 | 925 | } |
| 926 | 926 | |
| 927 | - protected function getClassToExtend(): ?string |
|
| 927 | + protected function getClassToExtend(): ? string |
|
| 928 | 928 | { |
| 929 | 929 | return $this->classToExtend; |
| 930 | 930 | } |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | { |
| 934 | 934 | $refl = new \ReflectionClass($this->getClassToExtend()); |
| 935 | 935 | |
| 936 | - return '\\' . $refl->getName(); |
|
| 936 | + return '\\'.$refl->getName(); |
|
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | protected function getClassName(ClassMetadataInfo $metadata): string |
@@ -951,7 +951,7 @@ discard block |
||
| 951 | 951 | { |
| 952 | 952 | $lines = []; |
| 953 | 953 | $lines[] = '/**'; |
| 954 | - $lines[] = ' * ' . $this->getClassName($metadata); |
|
| 954 | + $lines[] = ' * '.$this->getClassName($metadata); |
|
| 955 | 955 | |
| 956 | 956 | if ($this->generateAnnotations) { |
| 957 | 957 | $lines[] = ' *'; |
@@ -967,12 +967,12 @@ discard block |
||
| 967 | 967 | |
| 968 | 968 | foreach ($methods as $method) { |
| 969 | 969 | if ($code = $this->$method($metadata)) { |
| 970 | - $lines[] = ' * ' . $code; |
|
| 970 | + $lines[] = ' * '.$code; |
|
| 971 | 971 | } |
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) { |
| 975 | - $lines[] = ' * @' . $this->annotationsPrefix . 'HasLifecycleCallbacks'; |
|
| 975 | + $lines[] = ' * @'.$this->annotationsPrefix.'HasLifecycleCallbacks'; |
|
| 976 | 976 | } |
| 977 | 977 | } |
| 978 | 978 | |
@@ -983,17 +983,17 @@ discard block |
||
| 983 | 983 | |
| 984 | 984 | protected function generateEntityAnnotation(ClassMetadataInfo $metadata): string |
| 985 | 985 | { |
| 986 | - $prefix = '@' . $this->annotationsPrefix; |
|
| 986 | + $prefix = '@'.$this->annotationsPrefix; |
|
| 987 | 987 | |
| 988 | 988 | if ($metadata->isEmbeddedClass) { |
| 989 | - return $prefix . 'Embeddable'; |
|
| 989 | + return $prefix.'Embeddable'; |
|
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | $customRepository = $metadata->customRepositoryClassName |
| 993 | - ? '(repositoryClass="' . $metadata->customRepositoryClassName . '")' |
|
| 993 | + ? '(repositoryClass="'.$metadata->customRepositoryClassName.'")' |
|
| 994 | 994 | : ''; |
| 995 | 995 | |
| 996 | - return $prefix . ($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity') . $customRepository; |
|
| 996 | + return $prefix.($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity').$customRepository; |
|
| 997 | 997 | } |
| 998 | 998 | |
| 999 | 999 | protected function generateTableAnnotation(ClassMetadataInfo $metadata): string |
@@ -1005,28 +1005,28 @@ discard block |
||
| 1005 | 1005 | $table = []; |
| 1006 | 1006 | |
| 1007 | 1007 | if (isset($metadata->table['schema'])) { |
| 1008 | - $table[] = 'schema="' . $metadata->table['schema'] . '"'; |
|
| 1008 | + $table[] = 'schema="'.$metadata->table['schema'].'"'; |
|
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | if (isset($metadata->table['name'])) { |
| 1012 | - $table[] = 'name="' . $metadata->table['name'] . '"'; |
|
| 1012 | + $table[] = 'name="'.$metadata->table['name'].'"'; |
|
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | if (isset($metadata->table['options']) && $metadata->table['options']) { |
| 1016 | - $table[] = 'options={' . $this->exportTableOptions((array) $metadata->table['options']) . '}'; |
|
| 1016 | + $table[] = 'options={'.$this->exportTableOptions((array) $metadata->table['options']).'}'; |
|
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | if (isset($metadata->table['uniqueConstraints']) && $metadata->table['uniqueConstraints']) { |
| 1020 | 1020 | $constraints = $this->generateTableConstraints('UniqueConstraint', $metadata->table['uniqueConstraints']); |
| 1021 | - $table[] = 'uniqueConstraints={' . $constraints . '}'; |
|
| 1021 | + $table[] = 'uniqueConstraints={'.$constraints.'}'; |
|
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | if (isset($metadata->table['indexes']) && $metadata->table['indexes']) { |
| 1025 | 1025 | $constraints = $this->generateTableConstraints('Index', $metadata->table['indexes']); |
| 1026 | - $table[] = 'indexes={' . $constraints . '}'; |
|
| 1026 | + $table[] = 'indexes={'.$constraints.'}'; |
|
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | - return '@' . $this->annotationsPrefix . 'Table(' . implode(', ', $table) . ')'; |
|
| 1029 | + return '@'.$this->annotationsPrefix.'Table('.implode(', ', $table).')'; |
|
| 1030 | 1030 | } |
| 1031 | 1031 | |
| 1032 | 1032 | protected function generateTableConstraints(string $constraintName, array $constraints): string |
@@ -1035,38 +1035,38 @@ discard block |
||
| 1035 | 1035 | foreach ($constraints as $name => $constraint) { |
| 1036 | 1036 | $columns = []; |
| 1037 | 1037 | foreach ($constraint['columns'] as $column) { |
| 1038 | - $columns[] = '"' . $column . '"'; |
|
| 1038 | + $columns[] = '"'.$column.'"'; |
|
| 1039 | 1039 | } |
| 1040 | - $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})'; |
|
| 1040 | + $annotations[] = '@'.$this->annotationsPrefix.$constraintName.'(name="'.$name.'", columns={'.implode(', ', $columns).'})'; |
|
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | return implode(', ', $annotations); |
| 1044 | 1044 | } |
| 1045 | 1045 | |
| 1046 | - protected function generateInheritanceAnnotation(ClassMetadataInfo $metadata): ?string |
|
| 1046 | + protected function generateInheritanceAnnotation(ClassMetadataInfo $metadata): ? string |
|
| 1047 | 1047 | { |
| 1048 | 1048 | if ($metadata->inheritanceType === ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
| 1049 | 1049 | return null; |
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | - return '@' . $this->annotationsPrefix . 'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1052 | + return '@'.$this->annotationsPrefix.'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | - protected function generateDiscriminatorColumnAnnotation(ClassMetadataInfo $metadata): ?string |
|
| 1055 | + protected function generateDiscriminatorColumnAnnotation(ClassMetadataInfo $metadata): ? string |
|
| 1056 | 1056 | { |
| 1057 | 1057 | if ($metadata->inheritanceType === ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
| 1058 | 1058 | return null; |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | $discrColumn = $metadata->discriminatorColumn; |
| 1062 | - $columnDefinition = 'name="' . $discrColumn['name'] |
|
| 1063 | - . '", type="' . $discrColumn['type'] |
|
| 1064 | - . '", length=' . $discrColumn['length']; |
|
| 1062 | + $columnDefinition = 'name="'.$discrColumn['name'] |
|
| 1063 | + . '", type="'.$discrColumn['type'] |
|
| 1064 | + . '", length='.$discrColumn['length']; |
|
| 1065 | 1065 | |
| 1066 | - return '@' . $this->annotationsPrefix . 'DiscriminatorColumn(' . $columnDefinition . ')'; |
|
| 1066 | + return '@'.$this->annotationsPrefix.'DiscriminatorColumn('.$columnDefinition.')'; |
|
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | - protected function generateDiscriminatorMapAnnotation(ClassMetadataInfo $metadata): ?string |
|
| 1069 | + protected function generateDiscriminatorMapAnnotation(ClassMetadataInfo $metadata): ? string |
|
| 1070 | 1070 | { |
| 1071 | 1071 | if ($metadata->inheritanceType === ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
| 1072 | 1072 | return null; |
@@ -1075,10 +1075,10 @@ discard block |
||
| 1075 | 1075 | $inheritanceClassMap = []; |
| 1076 | 1076 | |
| 1077 | 1077 | foreach ($metadata->discriminatorMap as $type => $class) { |
| 1078 | - $inheritanceClassMap[] .= '"' . $type . '" = "' . $class . '"'; |
|
| 1078 | + $inheritanceClassMap[] .= '"'.$type.'" = "'.$class.'"'; |
|
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | - return '@' . $this->annotationsPrefix . 'DiscriminatorMap({' . implode(', ', $inheritanceClassMap) . '})'; |
|
| 1081 | + return '@'.$this->annotationsPrefix.'DiscriminatorMap({'.implode(', ', $inheritanceClassMap).'})'; |
|
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | 1084 | protected function generateEntityStubMethods(ClassMetadataInfo $metadata): string |
@@ -1092,8 +1092,8 @@ discard block |
||
| 1092 | 1092 | |
| 1093 | 1093 | $nullableField = $this->nullableFieldExpression($fieldMapping); |
| 1094 | 1094 | |
| 1095 | - if ((!$metadata->isEmbeddedClass || !$this->embeddablesImmutable) |
|
| 1096 | - && (!isset($fieldMapping['id']) || ! $fieldMapping['id'] || $metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_NONE) |
|
| 1095 | + if (( ! $metadata->isEmbeddedClass || ! $this->embeddablesImmutable) |
|
| 1096 | + && ( ! isset($fieldMapping['id']) || ! $fieldMapping['id'] || $metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_NONE) |
|
| 1097 | 1097 | && $code = $this->generateEntityStubMethod($metadata, 'set', $fieldMapping['fieldName'], $fieldMapping['type'], $nullableField) |
| 1098 | 1098 | ) { |
| 1099 | 1099 | $methods[] = $code; |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | 1161 | foreach ($joinColumns as $joinColumn) { |
| 1162 | - if (isset($joinColumn['nullable']) && !$joinColumn['nullable']) { |
|
| 1162 | + if (isset($joinColumn['nullable']) && ! $joinColumn['nullable']) { |
|
| 1163 | 1163 | return false; |
| 1164 | 1164 | } |
| 1165 | 1165 | } |
@@ -1167,7 +1167,7 @@ discard block |
||
| 1167 | 1167 | return true; |
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | - protected function generateEntityLifecycleCallbackMethods(ClassMetadataInfo $metadata): ?string |
|
| 1170 | + protected function generateEntityLifecycleCallbackMethods(ClassMetadataInfo $metadata): ? string |
|
| 1171 | 1171 | { |
| 1172 | 1172 | if (empty($metadata->lifecycleCallbacks)) { |
| 1173 | 1173 | return null; |
@@ -1194,8 +1194,8 @@ discard block |
||
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | 1196 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($associationMapping, $metadata); |
| 1197 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $associationMapping['fieldName'] |
|
| 1198 | - . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
| 1197 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$associationMapping['fieldName'] |
|
| 1198 | + . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null).";\n"; |
|
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | return implode("\n", $lines); |
@@ -1214,8 +1214,8 @@ discard block |
||
| 1214 | 1214 | } |
| 1215 | 1215 | |
| 1216 | 1216 | $lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata); |
| 1217 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName'] |
|
| 1218 | - . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
| 1217 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldMapping['fieldName'] |
|
| 1218 | + . (isset($fieldMapping['options']['default']) ? ' = '.var_export($fieldMapping['options']['default'], true) : null).";\n"; |
|
| 1219 | 1219 | } |
| 1220 | 1220 | |
| 1221 | 1221 | return implode("\n", $lines); |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | 1233 | $lines[] = $this->generateEmbeddedPropertyDocBlock($embeddedClass); |
| 1234 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldName . ";\n"; |
|
| 1234 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldName.";\n"; |
|
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | 1237 | return implode("\n", $lines); |
@@ -1241,10 +1241,10 @@ discard block |
||
| 1241 | 1241 | ClassMetadataInfo $metadata, |
| 1242 | 1242 | string $type, |
| 1243 | 1243 | string $fieldName, |
| 1244 | - ?string $typeHint = null, |
|
| 1245 | - ?string $defaultValue = null): string |
|
| 1244 | + ? string $typeHint = null, |
|
| 1245 | + ? string $defaultValue = null) : string |
|
| 1246 | 1246 | { |
| 1247 | - $methodName = $type . Inflector::classify($fieldName); |
|
| 1247 | + $methodName = $type.Inflector::classify($fieldName); |
|
| 1248 | 1248 | $variableName = Inflector::camelize($fieldName); |
| 1249 | 1249 | if (in_array($type, ["add", "remove"])) { |
| 1250 | 1250 | $methodName = Inflector::singularize($methodName); |
@@ -1264,18 +1264,18 @@ discard block |
||
| 1264 | 1264 | $variableType = $typeHint ? $this->getType($typeHint) : null; |
| 1265 | 1265 | |
| 1266 | 1266 | if ($typeHint && ! isset($types[$typeHint])) { |
| 1267 | - $variableType = '\\' . ltrim($variableType, '\\'); |
|
| 1268 | - $methodTypeHint = '\\' . $typeHint . ' '; |
|
| 1267 | + $variableType = '\\'.ltrim($variableType, '\\'); |
|
| 1268 | + $methodTypeHint = '\\'.$typeHint.' '; |
|
| 1269 | 1269 | } |
| 1270 | 1270 | |
| 1271 | 1271 | $replacements = [ |
| 1272 | - '<description>' => ucfirst($type) . ' ' . $variableName . '.', |
|
| 1272 | + '<description>' => ucfirst($type).' '.$variableName.'.', |
|
| 1273 | 1273 | '<methodTypeHint>' => $methodTypeHint, |
| 1274 | - '<variableType>' => $variableType . (null !== $defaultValue ? ('|' . $defaultValue) : ''), |
|
| 1274 | + '<variableType>' => $variableType.(null !== $defaultValue ? ('|'.$defaultValue) : ''), |
|
| 1275 | 1275 | '<variableName>' => $variableName, |
| 1276 | 1276 | '<methodName>' => $methodName, |
| 1277 | 1277 | '<fieldName>' => $fieldName, |
| 1278 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = ' . $defaultValue) : '', |
|
| 1278 | + '<variableDefault>' => ($defaultValue !== null) ? (' = '.$defaultValue) : '', |
|
| 1279 | 1279 | '<entity>' => $this->getClassName($metadata) |
| 1280 | 1280 | ]; |
| 1281 | 1281 | |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | return $this->prefixCodeWithSpaces($method); |
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | - protected function generateLifecycleCallbackMethod(string $name, string $methodName, ClassMetadataInfo $metadata): ?string |
|
| 1291 | + protected function generateLifecycleCallbackMethod(string $name, string $methodName, ClassMetadataInfo $metadata): ? string |
|
| 1292 | 1292 | { |
| 1293 | 1293 | if ($this->hasMethod($methodName, $metadata)) { |
| 1294 | 1294 | return null; |
@@ -1297,7 +1297,7 @@ discard block |
||
| 1297 | 1297 | $this->staticReflection[$metadata->name]['methods'][] = $methodName; |
| 1298 | 1298 | |
| 1299 | 1299 | $replacements = [ |
| 1300 | - '<name>' => $this->annotationsPrefix . ucfirst($name), |
|
| 1300 | + '<name>' => $this->annotationsPrefix.ucfirst($name), |
|
| 1301 | 1301 | '<methodName>' => $methodName, |
| 1302 | 1302 | ]; |
| 1303 | 1303 | |
@@ -1315,51 +1315,51 @@ discard block |
||
| 1315 | 1315 | $joinColumnAnnot = []; |
| 1316 | 1316 | |
| 1317 | 1317 | if (isset($joinColumn['name'])) { |
| 1318 | - $joinColumnAnnot[] = 'name="' . $joinColumn['name'] . '"'; |
|
| 1318 | + $joinColumnAnnot[] = 'name="'.$joinColumn['name'].'"'; |
|
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | 1321 | if (isset($joinColumn['referencedColumnName'])) { |
| 1322 | - $joinColumnAnnot[] = 'referencedColumnName="' . $joinColumn['referencedColumnName'] . '"'; |
|
| 1322 | + $joinColumnAnnot[] = 'referencedColumnName="'.$joinColumn['referencedColumnName'].'"'; |
|
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | 1325 | if (isset($joinColumn['unique']) && $joinColumn['unique']) { |
| 1326 | - $joinColumnAnnot[] = 'unique=' . ($joinColumn['unique'] ? 'true' : 'false'); |
|
| 1326 | + $joinColumnAnnot[] = 'unique='.($joinColumn['unique'] ? 'true' : 'false'); |
|
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | 1329 | if (isset($joinColumn['nullable'])) { |
| 1330 | - $joinColumnAnnot[] = 'nullable=' . ($joinColumn['nullable'] ? 'true' : 'false'); |
|
| 1330 | + $joinColumnAnnot[] = 'nullable='.($joinColumn['nullable'] ? 'true' : 'false'); |
|
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | 1333 | if (isset($joinColumn['onDelete'])) { |
| 1334 | - $joinColumnAnnot[] = 'onDelete="' . ($joinColumn['onDelete'] . '"'); |
|
| 1334 | + $joinColumnAnnot[] = 'onDelete="'.($joinColumn['onDelete'].'"'); |
|
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | if (isset($joinColumn['columnDefinition'])) { |
| 1338 | - $joinColumnAnnot[] = 'columnDefinition="' . $joinColumn['columnDefinition'] . '"'; |
|
| 1338 | + $joinColumnAnnot[] = 'columnDefinition="'.$joinColumn['columnDefinition'].'"'; |
|
| 1339 | 1339 | } |
| 1340 | 1340 | |
| 1341 | - return '@' . $this->annotationsPrefix . 'JoinColumn(' . implode(', ', $joinColumnAnnot) . ')'; |
|
| 1341 | + return '@'.$this->annotationsPrefix.'JoinColumn('.implode(', ', $joinColumnAnnot).')'; |
|
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | 1344 | protected function generateAssociationMappingPropertyDocBlock(array $associationMapping, ClassMetadataInfo $metadata): string |
| 1345 | 1345 | { |
| 1346 | 1346 | $lines = []; |
| 1347 | - $lines[] = $this->spaces . '/**'; |
|
| 1347 | + $lines[] = $this->spaces.'/**'; |
|
| 1348 | 1348 | |
| 1349 | 1349 | if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) { |
| 1350 | - $lines[] = $this->spaces . ' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1350 | + $lines[] = $this->spaces.' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1351 | 1351 | } else { |
| 1352 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($associationMapping['targetEntity'], '\\'); |
|
| 1352 | + $lines[] = $this->spaces.' * @var \\'.ltrim($associationMapping['targetEntity'], '\\'); |
|
| 1353 | 1353 | } |
| 1354 | 1354 | |
| 1355 | 1355 | if ($this->generateAnnotations) { |
| 1356 | - $lines[] = $this->spaces . ' *'; |
|
| 1356 | + $lines[] = $this->spaces.' *'; |
|
| 1357 | 1357 | |
| 1358 | 1358 | if (isset($associationMapping['id']) && $associationMapping['id']) { |
| 1359 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
| 1359 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
| 1360 | 1360 | |
| 1361 | 1361 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
| 1362 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
| 1362 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
| 1363 | 1363 | } |
| 1364 | 1364 | } |
| 1365 | 1365 | |
@@ -1381,15 +1381,15 @@ discard block |
||
| 1381 | 1381 | $typeOptions = []; |
| 1382 | 1382 | |
| 1383 | 1383 | if (isset($associationMapping['targetEntity'])) { |
| 1384 | - $typeOptions[] = 'targetEntity="' . $associationMapping['targetEntity'] . '"'; |
|
| 1384 | + $typeOptions[] = 'targetEntity="'.$associationMapping['targetEntity'].'"'; |
|
| 1385 | 1385 | } |
| 1386 | 1386 | |
| 1387 | 1387 | if (isset($associationMapping['inversedBy'])) { |
| 1388 | - $typeOptions[] = 'inversedBy="' . $associationMapping['inversedBy'] . '"'; |
|
| 1388 | + $typeOptions[] = 'inversedBy="'.$associationMapping['inversedBy'].'"'; |
|
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | 1391 | if (isset($associationMapping['mappedBy'])) { |
| 1392 | - $typeOptions[] = 'mappedBy="' . $associationMapping['mappedBy'] . '"'; |
|
| 1392 | + $typeOptions[] = 'mappedBy="'.$associationMapping['mappedBy'].'"'; |
|
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | 1395 | if ($associationMapping['cascade']) { |
@@ -1405,11 +1405,11 @@ discard block |
||
| 1405 | 1405 | $cascades = ['"all"']; |
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | - $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}'; |
|
| 1408 | + $typeOptions[] = 'cascade={'.implode(',', $cascades).'}'; |
|
| 1409 | 1409 | } |
| 1410 | 1410 | |
| 1411 | 1411 | if (isset($associationMapping['orphanRemoval']) && $associationMapping['orphanRemoval']) { |
| 1412 | - $typeOptions[] = 'orphanRemoval=' . ($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
| 1412 | + $typeOptions[] = 'orphanRemoval='.($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | 1415 | if (isset($associationMapping['fetch']) && $associationMapping['fetch'] !== ClassMetadataInfo::FETCH_LAZY) { |
@@ -1418,71 +1418,71 @@ discard block |
||
| 1418 | 1418 | ClassMetadataInfo::FETCH_EAGER => 'EAGER', |
| 1419 | 1419 | ]; |
| 1420 | 1420 | |
| 1421 | - $typeOptions[] = 'fetch="' . $fetchMap[$associationMapping['fetch']] . '"'; |
|
| 1421 | + $typeOptions[] = 'fetch="'.$fetchMap[$associationMapping['fetch']].'"'; |
|
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . '' . $type . '(' . implode(', ', $typeOptions) . ')'; |
|
| 1424 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.''.$type.'('.implode(', ', $typeOptions).')'; |
|
| 1425 | 1425 | |
| 1426 | 1426 | if (isset($associationMapping['joinColumns']) && $associationMapping['joinColumns']) { |
| 1427 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinColumns({'; |
|
| 1427 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinColumns({'; |
|
| 1428 | 1428 | |
| 1429 | 1429 | $joinColumnsLines = []; |
| 1430 | 1430 | |
| 1431 | 1431 | foreach ($associationMapping['joinColumns'] as $joinColumn) { |
| 1432 | 1432 | if ($joinColumnAnnot = $this->generateJoinColumnAnnotation($joinColumn)) { |
| 1433 | - $joinColumnsLines[] = $this->spaces . ' * ' . $joinColumnAnnot; |
|
| 1433 | + $joinColumnsLines[] = $this->spaces.' * '.$joinColumnAnnot; |
|
| 1434 | 1434 | } |
| 1435 | 1435 | } |
| 1436 | 1436 | |
| 1437 | 1437 | $lines[] = implode(",\n", $joinColumnsLines); |
| 1438 | - $lines[] = $this->spaces . ' * })'; |
|
| 1438 | + $lines[] = $this->spaces.' * })'; |
|
| 1439 | 1439 | } |
| 1440 | 1440 | |
| 1441 | 1441 | if (isset($associationMapping['joinTable']) && $associationMapping['joinTable']) { |
| 1442 | 1442 | $joinTable = []; |
| 1443 | - $joinTable[] = 'name="' . $associationMapping['joinTable']['name'] . '"'; |
|
| 1443 | + $joinTable[] = 'name="'.$associationMapping['joinTable']['name'].'"'; |
|
| 1444 | 1444 | |
| 1445 | 1445 | if (isset($associationMapping['joinTable']['schema'])) { |
| 1446 | - $joinTable[] = 'schema="' . $associationMapping['joinTable']['schema'] . '"'; |
|
| 1446 | + $joinTable[] = 'schema="'.$associationMapping['joinTable']['schema'].'"'; |
|
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinTable(' . implode(', ', $joinTable) . ','; |
|
| 1450 | - $lines[] = $this->spaces . ' * joinColumns={'; |
|
| 1449 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinTable('.implode(', ', $joinTable).','; |
|
| 1450 | + $lines[] = $this->spaces.' * joinColumns={'; |
|
| 1451 | 1451 | |
| 1452 | 1452 | $joinColumnsLines = []; |
| 1453 | 1453 | |
| 1454 | 1454 | foreach ($associationMapping['joinTable']['joinColumns'] as $joinColumn) { |
| 1455 | - $joinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1455 | + $joinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1456 | 1456 | } |
| 1457 | 1457 | |
| 1458 | - $lines[] = implode(",". PHP_EOL, $joinColumnsLines); |
|
| 1459 | - $lines[] = $this->spaces . ' * },'; |
|
| 1460 | - $lines[] = $this->spaces . ' * inverseJoinColumns={'; |
|
| 1458 | + $lines[] = implode(",".PHP_EOL, $joinColumnsLines); |
|
| 1459 | + $lines[] = $this->spaces.' * },'; |
|
| 1460 | + $lines[] = $this->spaces.' * inverseJoinColumns={'; |
|
| 1461 | 1461 | |
| 1462 | 1462 | $inverseJoinColumnsLines = []; |
| 1463 | 1463 | |
| 1464 | 1464 | foreach ($associationMapping['joinTable']['inverseJoinColumns'] as $joinColumn) { |
| 1465 | - $inverseJoinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1465 | + $inverseJoinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | - $lines[] = implode(",". PHP_EOL, $inverseJoinColumnsLines); |
|
| 1469 | - $lines[] = $this->spaces . ' * }'; |
|
| 1470 | - $lines[] = $this->spaces . ' * )'; |
|
| 1468 | + $lines[] = implode(",".PHP_EOL, $inverseJoinColumnsLines); |
|
| 1469 | + $lines[] = $this->spaces.' * }'; |
|
| 1470 | + $lines[] = $this->spaces.' * )'; |
|
| 1471 | 1471 | } |
| 1472 | 1472 | |
| 1473 | 1473 | if (isset($associationMapping['orderBy'])) { |
| 1474 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'OrderBy({'; |
|
| 1474 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'OrderBy({'; |
|
| 1475 | 1475 | |
| 1476 | 1476 | foreach ($associationMapping['orderBy'] as $name => $direction) { |
| 1477 | - $lines[] = $this->spaces . ' * "' . $name . '"="' . $direction . '",'; |
|
| 1477 | + $lines[] = $this->spaces.' * "'.$name.'"="'.$direction.'",'; |
|
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | 1480 | $lines[count($lines) - 1] = substr($lines[count($lines) - 1], 0, strlen($lines[count($lines) - 1]) - 1); |
| 1481 | - $lines[] = $this->spaces . ' * })'; |
|
| 1481 | + $lines[] = $this->spaces.' * })'; |
|
| 1482 | 1482 | } |
| 1483 | 1483 | } |
| 1484 | 1484 | |
| 1485 | - $lines[] = $this->spaces . ' */'; |
|
| 1485 | + $lines[] = $this->spaces.' */'; |
|
| 1486 | 1486 | |
| 1487 | 1487 | return implode("\n", $lines); |
| 1488 | 1488 | } |
@@ -1490,37 +1490,37 @@ discard block |
||
| 1490 | 1490 | protected function generateFieldMappingPropertyDocBlock(array $fieldMapping, ClassMetadataInfo $metadata): string |
| 1491 | 1491 | { |
| 1492 | 1492 | $lines = []; |
| 1493 | - $lines[] = $this->spaces . '/**'; |
|
| 1494 | - $lines[] = $this->spaces . ' * @var ' |
|
| 1493 | + $lines[] = $this->spaces.'/**'; |
|
| 1494 | + $lines[] = $this->spaces.' * @var ' |
|
| 1495 | 1495 | . $this->getType($fieldMapping['type']) |
| 1496 | 1496 | . ($this->nullableFieldExpression($fieldMapping) ? '|null' : ''); |
| 1497 | 1497 | |
| 1498 | 1498 | if ($this->generateAnnotations) { |
| 1499 | - $lines[] = $this->spaces . ' *'; |
|
| 1499 | + $lines[] = $this->spaces.' *'; |
|
| 1500 | 1500 | |
| 1501 | 1501 | $column = []; |
| 1502 | 1502 | if (isset($fieldMapping['columnName'])) { |
| 1503 | - $column[] = 'name="' . $fieldMapping['columnName'] . '"'; |
|
| 1503 | + $column[] = 'name="'.$fieldMapping['columnName'].'"'; |
|
| 1504 | 1504 | } |
| 1505 | 1505 | |
| 1506 | 1506 | if (isset($fieldMapping['type'])) { |
| 1507 | - $column[] = 'type="' . $fieldMapping['type'] . '"'; |
|
| 1507 | + $column[] = 'type="'.$fieldMapping['type'].'"'; |
|
| 1508 | 1508 | } |
| 1509 | 1509 | |
| 1510 | 1510 | if (isset($fieldMapping['length'])) { |
| 1511 | - $column[] = 'length=' . $fieldMapping['length']; |
|
| 1511 | + $column[] = 'length='.$fieldMapping['length']; |
|
| 1512 | 1512 | } |
| 1513 | 1513 | |
| 1514 | 1514 | if (isset($fieldMapping['precision'])) { |
| 1515 | - $column[] = 'precision=' . $fieldMapping['precision']; |
|
| 1515 | + $column[] = 'precision='.$fieldMapping['precision']; |
|
| 1516 | 1516 | } |
| 1517 | 1517 | |
| 1518 | 1518 | if (isset($fieldMapping['scale'])) { |
| 1519 | - $column[] = 'scale=' . $fieldMapping['scale']; |
|
| 1519 | + $column[] = 'scale='.$fieldMapping['scale']; |
|
| 1520 | 1520 | } |
| 1521 | 1521 | |
| 1522 | 1522 | if (isset($fieldMapping['nullable'])) { |
| 1523 | - $column[] = 'nullable=' . var_export($fieldMapping['nullable'], true); |
|
| 1523 | + $column[] = 'nullable='.var_export($fieldMapping['nullable'], true); |
|
| 1524 | 1524 | } |
| 1525 | 1525 | |
| 1526 | 1526 | $options = []; |
@@ -1534,47 +1534,47 @@ discard block |
||
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | if (isset($fieldMapping['columnDefinition'])) { |
| 1537 | - $column[] = 'columnDefinition="' . $fieldMapping['columnDefinition'] . '"'; |
|
| 1537 | + $column[] = 'columnDefinition="'.$fieldMapping['columnDefinition'].'"'; |
|
| 1538 | 1538 | } |
| 1539 | 1539 | |
| 1540 | 1540 | if (isset($fieldMapping['unique'])) { |
| 1541 | - $column[] = 'unique=' . var_export($fieldMapping['unique'], true); |
|
| 1541 | + $column[] = 'unique='.var_export($fieldMapping['unique'], true); |
|
| 1542 | 1542 | } |
| 1543 | 1543 | |
| 1544 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Column(' . implode(', ', $column) . ')'; |
|
| 1544 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Column('.implode(', ', $column).')'; |
|
| 1545 | 1545 | |
| 1546 | 1546 | if (isset($fieldMapping['id']) && $fieldMapping['id']) { |
| 1547 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
| 1547 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
| 1548 | 1548 | |
| 1549 | 1549 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
| 1550 | - $lines[] = $this->spaces.' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
| 1550 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
| 1551 | 1551 | } |
| 1552 | 1552 | |
| 1553 | 1553 | if ($metadata->sequenceGeneratorDefinition) { |
| 1554 | 1554 | $sequenceGenerator = []; |
| 1555 | 1555 | |
| 1556 | 1556 | if (isset($metadata->sequenceGeneratorDefinition['sequenceName'])) { |
| 1557 | - $sequenceGenerator[] = 'sequenceName="' . $metadata->sequenceGeneratorDefinition['sequenceName'] . '"'; |
|
| 1557 | + $sequenceGenerator[] = 'sequenceName="'.$metadata->sequenceGeneratorDefinition['sequenceName'].'"'; |
|
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) { |
| 1561 | - $sequenceGenerator[] = 'allocationSize=' . $metadata->sequenceGeneratorDefinition['allocationSize']; |
|
| 1561 | + $sequenceGenerator[] = 'allocationSize='.$metadata->sequenceGeneratorDefinition['allocationSize']; |
|
| 1562 | 1562 | } |
| 1563 | 1563 | |
| 1564 | 1564 | if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) { |
| 1565 | - $sequenceGenerator[] = 'initialValue=' . $metadata->sequenceGeneratorDefinition['initialValue']; |
|
| 1565 | + $sequenceGenerator[] = 'initialValue='.$metadata->sequenceGeneratorDefinition['initialValue']; |
|
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'SequenceGenerator(' . implode(', ', $sequenceGenerator) . ')'; |
|
| 1568 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'SequenceGenerator('.implode(', ', $sequenceGenerator).')'; |
|
| 1569 | 1569 | } |
| 1570 | 1570 | } |
| 1571 | 1571 | |
| 1572 | 1572 | if (isset($fieldMapping['version']) && $fieldMapping['version']) { |
| 1573 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Version'; |
|
| 1573 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Version'; |
|
| 1574 | 1574 | } |
| 1575 | 1575 | } |
| 1576 | 1576 | |
| 1577 | - $lines[] = $this->spaces . ' */'; |
|
| 1577 | + $lines[] = $this->spaces.' */'; |
|
| 1578 | 1578 | |
| 1579 | 1579 | return implode("\n", $lines); |
| 1580 | 1580 | } |
@@ -1582,32 +1582,32 @@ discard block |
||
| 1582 | 1582 | protected function generateEmbeddedPropertyDocBlock(array $embeddedClass): string |
| 1583 | 1583 | { |
| 1584 | 1584 | $lines = []; |
| 1585 | - $lines[] = $this->spaces . '/**'; |
|
| 1586 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($embeddedClass['class'], '\\'); |
|
| 1585 | + $lines[] = $this->spaces.'/**'; |
|
| 1586 | + $lines[] = $this->spaces.' * @var \\'.ltrim($embeddedClass['class'], '\\'); |
|
| 1587 | 1587 | |
| 1588 | 1588 | if ($this->generateAnnotations) { |
| 1589 | - $lines[] = $this->spaces . ' *'; |
|
| 1589 | + $lines[] = $this->spaces.' *'; |
|
| 1590 | 1590 | |
| 1591 | - $embedded = ['class="' . $embeddedClass['class'] . '"']; |
|
| 1591 | + $embedded = ['class="'.$embeddedClass['class'].'"']; |
|
| 1592 | 1592 | |
| 1593 | 1593 | if (isset($embeddedClass['columnPrefix'])) { |
| 1594 | 1594 | if (is_string($embeddedClass['columnPrefix'])) { |
| 1595 | - $embedded[] = 'columnPrefix="' . $embeddedClass['columnPrefix'] . '"'; |
|
| 1595 | + $embedded[] = 'columnPrefix="'.$embeddedClass['columnPrefix'].'"'; |
|
| 1596 | 1596 | } else { |
| 1597 | - $embedded[] = 'columnPrefix=' . var_export($embeddedClass['columnPrefix'], true); |
|
| 1597 | + $embedded[] = 'columnPrefix='.var_export($embeddedClass['columnPrefix'], true); |
|
| 1598 | 1598 | } |
| 1599 | 1599 | } |
| 1600 | 1600 | |
| 1601 | - $lines[] = $this->spaces . ' * @' . |
|
| 1602 | - $this->annotationsPrefix . 'Embedded(' . implode(', ', $embedded) . ')'; |
|
| 1601 | + $lines[] = $this->spaces.' * @'. |
|
| 1602 | + $this->annotationsPrefix.'Embedded('.implode(', ', $embedded).')'; |
|
| 1603 | 1603 | } |
| 1604 | 1604 | |
| 1605 | - $lines[] = $this->spaces . ' */'; |
|
| 1605 | + $lines[] = $this->spaces.' */'; |
|
| 1606 | 1606 | |
| 1607 | 1607 | return implode("\n", $lines); |
| 1608 | 1608 | } |
| 1609 | 1609 | |
| 1610 | - protected function generateEntityListenerAnnotation(ClassMetadataInfo $metadata): ?string |
|
| 1610 | + protected function generateEntityListenerAnnotation(ClassMetadataInfo $metadata): ? string |
|
| 1611 | 1611 | { |
| 1612 | 1612 | if (0 === \count($metadata->entityListeners)) { |
| 1613 | 1613 | return null; |
@@ -1616,13 +1616,13 @@ discard block |
||
| 1616 | 1616 | $processedClasses = []; |
| 1617 | 1617 | foreach ($metadata->entityListeners as $event => $eventListeners) { |
| 1618 | 1618 | foreach ($eventListeners as $eventListener) { |
| 1619 | - $processedClasses[] = '"' . $eventListener['class'] . '"'; |
|
| 1619 | + $processedClasses[] = '"'.$eventListener['class'].'"'; |
|
| 1620 | 1620 | } |
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | 1623 | return \sprintf( |
| 1624 | 1624 | '%s%s({%s})', |
| 1625 | - '@' . $this->annotationsPrefix, |
|
| 1625 | + '@'.$this->annotationsPrefix, |
|
| 1626 | 1626 | 'EntityListeners', |
| 1627 | 1627 | \implode(',', \array_unique($processedClasses)) |
| 1628 | 1628 | ); |
@@ -1634,7 +1634,7 @@ discard block |
||
| 1634 | 1634 | |
| 1635 | 1635 | foreach ($lines as $key => $value) { |
| 1636 | 1636 | if ( ! empty($value)) { |
| 1637 | - $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; |
|
| 1637 | + $lines[$key] = str_repeat($this->spaces, $num).$lines[$key]; |
|
| 1638 | 1638 | } |
| 1639 | 1639 | } |
| 1640 | 1640 | |
@@ -1689,7 +1689,7 @@ discard block |
||
| 1689 | 1689 | return static::$generatorStrategyMap[$type]; |
| 1690 | 1690 | } |
| 1691 | 1691 | |
| 1692 | - private function nullableFieldExpression(array $fieldMapping): ?string |
|
| 1692 | + private function nullableFieldExpression(array $fieldMapping): ? string |
|
| 1693 | 1693 | { |
| 1694 | 1694 | if (isset($fieldMapping['nullable']) && true === $fieldMapping['nullable']) { |
| 1695 | 1695 | return 'null'; |
@@ -1711,9 +1711,9 @@ discard block |
||
| 1711 | 1711 | |
| 1712 | 1712 | foreach ($options as $name => $option) { |
| 1713 | 1713 | if (is_array($option)) { |
| 1714 | - $optionsStr[] = '"' . $name . '"={' . $this->exportTableOptions($option) . '}'; |
|
| 1714 | + $optionsStr[] = '"'.$name.'"={'.$this->exportTableOptions($option).'}'; |
|
| 1715 | 1715 | } else { |
| 1716 | - $optionsStr[] = '"' . $name . '"="' . (string) $option . '"'; |
|
| 1716 | + $optionsStr[] = '"'.$name.'"="'.(string) $option.'"'; |
|
| 1717 | 1717 | } |
| 1718 | 1718 | } |
| 1719 | 1719 | |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function exportClassMetadata(ClassMetadataInfo $metadata): string |
| 43 | 43 | { |
| 44 | - $xml = new SimpleXmlElement('<?xml version="1.0" encoding="utf-8"?><doctrine-mapping ' . |
|
| 45 | - 'xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" ' . |
|
| 46 | - 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' . |
|
| 44 | + $xml = new SimpleXmlElement('<?xml version="1.0" encoding="utf-8"?><doctrine-mapping '. |
|
| 45 | + 'xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" '. |
|
| 46 | + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '. |
|
| 47 | 47 | 'xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" />'); |
| 48 | 48 | |
| 49 | 49 | if ($metadata->isMappedSuperclass) { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if (!$metadata->isIdentifierComposite && $idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { |
|
| 147 | + if ( ! $metadata->isIdentifierComposite && $idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { |
|
| 148 | 148 | $id[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $idGeneratorType; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if (count($cascade) === 5) { |
| 300 | - $cascade = ['cascade-all']; |
|
| 300 | + $cascade = ['cascade-all']; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | if ($cascade) { |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - if (isset($metadata->lifecycleCallbacks) && count($metadata->lifecycleCallbacks)>0) { |
|
| 382 | + if (isset($metadata->lifecycleCallbacks) && count($metadata->lifecycleCallbacks) > 0) { |
|
| 383 | 383 | $lifecycleCallbacksXml = $root->addChild('lifecycle-callbacks'); |
| 384 | 384 | |
| 385 | 385 | foreach ($metadata->lifecycleCallbacks as $name => $methods) { |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | { |
| 431 | 431 | $sequenceDefinition = $metadata->sequenceGeneratorDefinition; |
| 432 | 432 | |
| 433 | - if (!($metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE && $sequenceDefinition)) { |
|
| 433 | + if ( ! ($metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE && $sequenceDefinition)) { |
|
| 434 | 434 | return; |
| 435 | 435 | } |
| 436 | 436 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function exportClassMetadata(ClassMetadataInfo $metadata): string |
| 48 | 48 | { |
| 49 | - if (!$this->_entityGenerator) { |
|
| 49 | + if ( ! $this->_entityGenerator) { |
|
| 50 | 50 | throw new \RuntimeException('For the AnnotationExporter you must set an EntityGenerator instance with the setEntityGenerator() method.'); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | protected function _generateOutputPath(ClassMetadataInfo $metadata): string |
| 62 | 62 | { |
| 63 | - return $this->_outputDir . '/' . str_replace('\\', '/', $metadata->name) . $this->_extension; |
|
| 63 | + return $this->_outputDir.'/'.str_replace('\\', '/', $metadata->name).$this->_extension; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function setEntityGenerator(EntityGenerator $entityGenerator): void |