@@ -1363,7 +1363,7 @@ discard block |
||
| 1363 | 1363 | |
| 1364 | 1364 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($associationMapping, $metadata); |
| 1365 | 1365 | $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $associationMapping['fieldName'] |
| 1366 | - . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
| 1366 | + . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | 1369 | return implode("\n", $lines); |
@@ -1388,7 +1388,7 @@ discard block |
||
| 1388 | 1388 | |
| 1389 | 1389 | $lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata); |
| 1390 | 1390 | $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName'] |
| 1391 | - . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
| 1391 | + . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | 1394 | return implode("\n", $lines); |
@@ -1461,15 +1461,15 @@ discard block |
||
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 | $replacements = [ |
| 1464 | - '<description>' => ucfirst($type) . ' ' . $variableName, |
|
| 1465 | - '<methodTypeHint>' => $methodTypeHint, |
|
| 1466 | - '<variableType>' => $variableType . (null !== $defaultValue ? ('|' . $defaultValue) : ''), |
|
| 1467 | - '<variableName>' => $variableName, |
|
| 1468 | - '<methodName>' => $methodName, |
|
| 1469 | - '<fieldName>' => $fieldName, |
|
| 1470 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = ' . $defaultValue) : '', |
|
| 1471 | - '<entity>' => $this->getClassName($metadata), |
|
| 1472 | - '<methodTypeReturn>' => $methodReturnType, |
|
| 1464 | + '<description>' => ucfirst($type) . ' ' . $variableName, |
|
| 1465 | + '<methodTypeHint>' => $methodTypeHint, |
|
| 1466 | + '<variableType>' => $variableType . (null !== $defaultValue ? ('|' . $defaultValue) : ''), |
|
| 1467 | + '<variableName>' => $variableName, |
|
| 1468 | + '<methodName>' => $methodName, |
|
| 1469 | + '<fieldName>' => $fieldName, |
|
| 1470 | + '<variableDefault>' => ($defaultValue !== null ) ? (' = ' . $defaultValue) : '', |
|
| 1471 | + '<entity>' => $this->getClassName($metadata), |
|
| 1472 | + '<methodTypeReturn>' => $methodReturnType, |
|
| 1473 | 1473 | ]; |
| 1474 | 1474 | |
| 1475 | 1475 | $method = str_replace( |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | */ |
| 394 | 394 | public function writeEntityClass(ClassMetadataInfo $metadata, $outputDirectory) |
| 395 | 395 | { |
| 396 | - $path = $outputDirectory . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name) . $this->extension; |
|
| 396 | + $path = $outputDirectory.'/'.str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name).$this->extension; |
|
| 397 | 397 | $dir = dirname($path); |
| 398 | 398 | |
| 399 | 399 | if ( ! is_dir($dir)) { |
@@ -409,8 +409,8 @@ discard block |
||
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | if ($this->backupExisting && file_exists($path)) { |
| 412 | - $backupPath = dirname($path) . DIRECTORY_SEPARATOR . basename($path) . "~"; |
|
| 413 | - if (!copy($path, $backupPath)) { |
|
| 412 | + $backupPath = dirname($path).DIRECTORY_SEPARATOR.basename($path)."~"; |
|
| 413 | + if ( ! copy($path, $backupPath)) { |
|
| 414 | 414 | throw new \RuntimeException("Attempt to backup overwritten entity file but copy operation failed."); |
| 415 | 415 | } |
| 416 | 416 | } |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | $body = str_replace('<spaces>', $this->spaces, $body); |
| 474 | 474 | $last = strrpos($currentCode, '}'); |
| 475 | 475 | |
| 476 | - return substr($currentCode, 0, $last) . $body . ($body ? "\n" : '') . "}\n"; |
|
| 476 | + return substr($currentCode, 0, $last).$body.($body ? "\n" : '')."}\n"; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | public function setFieldVisibility($visibility) |
| 538 | 538 | { |
| 539 | 539 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
| 540 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
| 540 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | $this->fieldVisibility = $visibility; |
@@ -670,11 +670,11 @@ discard block |
||
| 670 | 670 | */ |
| 671 | 671 | protected function generateEntityNamespace(ClassMetadataInfo $metadata) |
| 672 | 672 | { |
| 673 | - if (! $this->hasNamespace($metadata)) { |
|
| 673 | + if ( ! $this->hasNamespace($metadata)) { |
|
| 674 | 674 | return ''; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | - return 'namespace ' . $this->getNamespace($metadata) .';'; |
|
| 677 | + return 'namespace '.$this->getNamespace($metadata).';'; |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | /** |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | */ |
| 683 | 683 | protected function generateEntityUse() |
| 684 | 684 | { |
| 685 | - if (! $this->generateAnnotations) { |
|
| 685 | + if ( ! $this->generateAnnotations) { |
|
| 686 | 686 | return ''; |
| 687 | 687 | } |
| 688 | 688 | |
@@ -696,8 +696,8 @@ discard block |
||
| 696 | 696 | */ |
| 697 | 697 | protected function generateEntityClassName(ClassMetadataInfo $metadata) |
| 698 | 698 | { |
| 699 | - return 'class ' . $this->getClassName($metadata) . |
|
| 700 | - ($this->extendsClass() ? ' extends ' . $this->getClassToExtendName() : null); |
|
| 699 | + return 'class '.$this->getClassName($metadata). |
|
| 700 | + ($this->extendsClass() ? ' extends '.$this->getClassToExtendName() : null); |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | /** |
@@ -799,13 +799,13 @@ discard block |
||
| 799 | 799 | $fieldMappings = array_merge($requiredFields, $optionalFields); |
| 800 | 800 | |
| 801 | 801 | foreach ($metadata->embeddedClasses as $fieldName => $embeddedClass) { |
| 802 | - $paramType = '\\' . ltrim($embeddedClass['class'], '\\'); |
|
| 803 | - $paramVariable = '$' . $fieldName; |
|
| 802 | + $paramType = '\\'.ltrim($embeddedClass['class'], '\\'); |
|
| 803 | + $paramVariable = '$'.$fieldName; |
|
| 804 | 804 | |
| 805 | 805 | $paramTypes[] = $paramType; |
| 806 | 806 | $paramVariables[] = $paramVariable; |
| 807 | - $params[] = $paramType . ' ' . $paramVariable; |
|
| 808 | - $fields[] = '$this->' . $fieldName . ' = ' . $paramVariable . ';'; |
|
| 807 | + $params[] = $paramType.' '.$paramVariable; |
|
| 808 | + $fields[] = '$this->'.$fieldName.' = '.$paramVariable.';'; |
|
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | foreach ($fieldMappings as $fieldMapping) { |
@@ -813,27 +813,27 @@ discard block |
||
| 813 | 813 | continue; |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | - $paramTypes[] = $this->getType($fieldMapping['type']) . (!empty($fieldMapping['nullable']) ? '|null' : ''); |
|
| 817 | - $param = '$' . $fieldMapping['fieldName']; |
|
| 816 | + $paramTypes[] = $this->getType($fieldMapping['type']).( ! empty($fieldMapping['nullable']) ? '|null' : ''); |
|
| 817 | + $param = '$'.$fieldMapping['fieldName']; |
|
| 818 | 818 | $paramVariables[] = $param; |
| 819 | 819 | |
| 820 | 820 | if ($fieldMapping['type'] === 'datetime') { |
| 821 | - $param = $this->getType($fieldMapping['type']) . ' ' . $param; |
|
| 821 | + $param = $this->getType($fieldMapping['type']).' '.$param; |
|
| 822 | 822 | } |
| 823 | 823 | |
| 824 | - if (!empty($fieldMapping['nullable'])) { |
|
| 824 | + if ( ! empty($fieldMapping['nullable'])) { |
|
| 825 | 825 | $param .= ' = null'; |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | $params[] = $param; |
| 829 | 829 | |
| 830 | - $fields[] = '$this->' . $fieldMapping['fieldName'] . ' = $' . $fieldMapping['fieldName'] . ';'; |
|
| 830 | + $fields[] = '$this->'.$fieldMapping['fieldName'].' = $'.$fieldMapping['fieldName'].';'; |
|
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | $maxParamTypeLength = max(array_map('strlen', $paramTypes)); |
| 834 | 834 | $paramTags = array_map( |
| 835 | - function ($type, $variable) use ($maxParamTypeLength) { |
|
| 836 | - return '@param ' . $type . str_repeat(' ', $maxParamTypeLength - strlen($type) + 1) . $variable; |
|
| 835 | + function($type, $variable) use ($maxParamTypeLength) { |
|
| 836 | + return '@param '.$type.str_repeat(' ', $maxParamTypeLength - strlen($type) + 1).$variable; |
|
| 837 | 837 | }, |
| 838 | 838 | $paramTypes, |
| 839 | 839 | $paramVariables |
@@ -841,8 +841,8 @@ discard block |
||
| 841 | 841 | |
| 842 | 842 | // Generate multi line constructor if the signature exceeds 120 characters. |
| 843 | 843 | if (array_sum(array_map('strlen', $params)) + count($params) * 2 + 29 > 120) { |
| 844 | - $delimiter = "\n" . $this->spaces; |
|
| 845 | - $params = $delimiter . implode(',' . $delimiter, $params) . "\n"; |
|
| 844 | + $delimiter = "\n".$this->spaces; |
|
| 845 | + $params = $delimiter.implode(','.$delimiter, $params)."\n"; |
|
| 846 | 846 | } else { |
| 847 | 847 | $params = implode(', ', $params); |
| 848 | 848 | } |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | $replacements = [ |
| 851 | 851 | '<paramTags>' => implode("\n * ", $paramTags), |
| 852 | 852 | '<params>' => $params, |
| 853 | - '<fields>' => implode("\n" . $this->spaces, $fields), |
|
| 853 | + '<fields>' => implode("\n".$this->spaces, $fields), |
|
| 854 | 854 | ]; |
| 855 | 855 | |
| 856 | 856 | $constructor = str_replace( |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | |
| 896 | 896 | if ($inClass) { |
| 897 | 897 | $inClass = false; |
| 898 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
| 898 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
| 899 | 899 | $this->staticReflection[$lastSeenClass]['properties'] = []; |
| 900 | 900 | $this->staticReflection[$lastSeenClass]['methods'] = []; |
| 901 | 901 | } |
@@ -903,16 +903,16 @@ discard block |
||
| 903 | 903 | if (T_NAMESPACE === $token[0]) { |
| 904 | 904 | $lastSeenNamespace = ''; |
| 905 | 905 | $inNamespace = true; |
| 906 | - } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i-1][0]) { |
|
| 906 | + } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i - 1][0]) { |
|
| 907 | 907 | $inClass = true; |
| 908 | 908 | } elseif (T_FUNCTION === $token[0]) { |
| 909 | - if (T_STRING === $tokens[$i+2][0]) { |
|
| 910 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
| 911 | - } elseif ($tokens[$i+2] == '&' && T_STRING === $tokens[$i+3][0]) { |
|
| 912 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
| 909 | + if (T_STRING === $tokens[$i + 2][0]) { |
|
| 910 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
| 911 | + } elseif ($tokens[$i + 2] == '&' && T_STRING === $tokens[$i + 3][0]) { |
|
| 912 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
| 913 | 913 | } |
| 914 | - } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i+2][0]) { |
|
| 915 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
| 914 | + } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i + 2][0]) { |
|
| 915 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
| 916 | 916 | } |
| 917 | 917 | } |
| 918 | 918 | } |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | */ |
| 926 | 926 | protected function hasProperty($property, ClassMetadataInfo $metadata) |
| 927 | 927 | { |
| 928 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 928 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
| 929 | 929 | // don't generate property if its already on the base class. |
| 930 | 930 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
| 931 | 931 | if ($reflClass->hasProperty($property)) { |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | */ |
| 955 | 955 | protected function hasMethod($method, ClassMetadataInfo $metadata) |
| 956 | 956 | { |
| 957 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 957 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
| 958 | 958 | // don't generate method if its already on the base class. |
| 959 | 959 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
| 960 | 960 | |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | */ |
| 986 | 986 | protected function getTraits(ClassMetadataInfo $metadata) |
| 987 | 987 | { |
| 988 | - if (! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
| 988 | + if ( ! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
| 989 | 989 | return []; |
| 990 | 990 | } |
| 991 | 991 | |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | { |
| 1036 | 1036 | $refl = new \ReflectionClass($this->getClassToExtend()); |
| 1037 | 1037 | |
| 1038 | - return '\\' . $refl->getName(); |
|
| 1038 | + return '\\'.$refl->getName(); |
|
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | 1041 | /** |
@@ -1068,7 +1068,7 @@ discard block |
||
| 1068 | 1068 | { |
| 1069 | 1069 | $lines = []; |
| 1070 | 1070 | $lines[] = '/**'; |
| 1071 | - $lines[] = ' * ' . $this->getClassName($metadata); |
|
| 1071 | + $lines[] = ' * '.$this->getClassName($metadata); |
|
| 1072 | 1072 | |
| 1073 | 1073 | if ($this->generateAnnotations) { |
| 1074 | 1074 | $lines[] = ' *'; |
@@ -1084,12 +1084,12 @@ discard block |
||
| 1084 | 1084 | |
| 1085 | 1085 | foreach ($methods as $method) { |
| 1086 | 1086 | if ($code = $this->$method($metadata)) { |
| 1087 | - $lines[] = ' * ' . $code; |
|
| 1087 | + $lines[] = ' * '.$code; |
|
| 1088 | 1088 | } |
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | 1091 | if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) { |
| 1092 | - $lines[] = ' * @' . $this->annotationsPrefix . 'HasLifecycleCallbacks'; |
|
| 1092 | + $lines[] = ' * @'.$this->annotationsPrefix.'HasLifecycleCallbacks'; |
|
| 1093 | 1093 | } |
| 1094 | 1094 | } |
| 1095 | 1095 | |
@@ -1105,17 +1105,17 @@ discard block |
||
| 1105 | 1105 | */ |
| 1106 | 1106 | protected function generateEntityAnnotation(ClassMetadataInfo $metadata) |
| 1107 | 1107 | { |
| 1108 | - $prefix = '@' . $this->annotationsPrefix; |
|
| 1108 | + $prefix = '@'.$this->annotationsPrefix; |
|
| 1109 | 1109 | |
| 1110 | 1110 | if ($metadata->isEmbeddedClass) { |
| 1111 | - return $prefix . 'Embeddable'; |
|
| 1111 | + return $prefix.'Embeddable'; |
|
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | $customRepository = $metadata->customRepositoryClassName |
| 1115 | - ? '(repositoryClass="' . $metadata->customRepositoryClassName . '")' |
|
| 1115 | + ? '(repositoryClass="'.$metadata->customRepositoryClassName.'")' |
|
| 1116 | 1116 | : ''; |
| 1117 | 1117 | |
| 1118 | - return $prefix . ($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity') . $customRepository; |
|
| 1118 | + return $prefix.($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity').$customRepository; |
|
| 1119 | 1119 | } |
| 1120 | 1120 | |
| 1121 | 1121 | /** |
@@ -1132,28 +1132,28 @@ discard block |
||
| 1132 | 1132 | $table = []; |
| 1133 | 1133 | |
| 1134 | 1134 | if (isset($metadata->table['schema'])) { |
| 1135 | - $table[] = 'schema="' . $metadata->table['schema'] . '"'; |
|
| 1135 | + $table[] = 'schema="'.$metadata->table['schema'].'"'; |
|
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | if (isset($metadata->table['name'])) { |
| 1139 | - $table[] = 'name="' . $metadata->table['name'] . '"'; |
|
| 1139 | + $table[] = 'name="'.$metadata->table['name'].'"'; |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | if (isset($metadata->table['options']) && $metadata->table['options']) { |
| 1143 | - $table[] = 'options={' . $this->exportTableOptions((array) $metadata->table['options']) . '}'; |
|
| 1143 | + $table[] = 'options={'.$this->exportTableOptions((array) $metadata->table['options']).'}'; |
|
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | if (isset($metadata->table['uniqueConstraints']) && $metadata->table['uniqueConstraints']) { |
| 1147 | 1147 | $constraints = $this->generateTableConstraints('UniqueConstraint', $metadata->table['uniqueConstraints']); |
| 1148 | - $table[] = 'uniqueConstraints={' . $constraints . '}'; |
|
| 1148 | + $table[] = 'uniqueConstraints={'.$constraints.'}'; |
|
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | 1151 | if (isset($metadata->table['indexes']) && $metadata->table['indexes']) { |
| 1152 | 1152 | $constraints = $this->generateTableConstraints('Index', $metadata->table['indexes']); |
| 1153 | - $table[] = 'indexes={' . $constraints . '}'; |
|
| 1153 | + $table[] = 'indexes={'.$constraints.'}'; |
|
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | - return '@' . $this->annotationsPrefix . 'Table(' . implode(', ', $table) . ')'; |
|
| 1156 | + return '@'.$this->annotationsPrefix.'Table('.implode(', ', $table).')'; |
|
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | 1159 | /** |
@@ -1168,9 +1168,9 @@ discard block |
||
| 1168 | 1168 | foreach ($constraints as $name => $constraint) { |
| 1169 | 1169 | $columns = []; |
| 1170 | 1170 | foreach ($constraint['columns'] as $column) { |
| 1171 | - $columns[] = '"' . $column . '"'; |
|
| 1171 | + $columns[] = '"'.$column.'"'; |
|
| 1172 | 1172 | } |
| 1173 | - $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})'; |
|
| 1173 | + $annotations[] = '@'.$this->annotationsPrefix.$constraintName.'(name="'.$name.'", columns={'.implode(', ', $columns).'})'; |
|
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | 1176 | return implode(', ', $annotations); |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | return ''; |
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | - return '@' . $this->annotationsPrefix . 'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1190 | + return '@'.$this->annotationsPrefix.'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1191 | 1191 | } |
| 1192 | 1192 | |
| 1193 | 1193 | /** |
@@ -1202,11 +1202,11 @@ discard block |
||
| 1202 | 1202 | } |
| 1203 | 1203 | |
| 1204 | 1204 | $discrColumn = $metadata->discriminatorColumn; |
| 1205 | - $columnDefinition = 'name="' . $discrColumn['name'] |
|
| 1206 | - . '", type="' . $discrColumn['type'] |
|
| 1207 | - . '", length=' . $discrColumn['length']; |
|
| 1205 | + $columnDefinition = 'name="'.$discrColumn['name'] |
|
| 1206 | + . '", type="'.$discrColumn['type'] |
|
| 1207 | + . '", length='.$discrColumn['length']; |
|
| 1208 | 1208 | |
| 1209 | - return '@' . $this->annotationsPrefix . 'DiscriminatorColumn(' . $columnDefinition . ')'; |
|
| 1209 | + return '@'.$this->annotationsPrefix.'DiscriminatorColumn('.$columnDefinition.')'; |
|
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | /** |
@@ -1223,10 +1223,10 @@ discard block |
||
| 1223 | 1223 | $inheritanceClassMap = []; |
| 1224 | 1224 | |
| 1225 | 1225 | foreach ($metadata->discriminatorMap as $type => $class) { |
| 1226 | - $inheritanceClassMap[] .= '"' . $type . '" = "' . $class . '"'; |
|
| 1226 | + $inheritanceClassMap[] .= '"'.$type.'" = "'.$class.'"'; |
|
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | - return '@' . $this->annotationsPrefix . 'DiscriminatorMap({' . implode(', ', $inheritanceClassMap) . '})'; |
|
| 1229 | + return '@'.$this->annotationsPrefix.'DiscriminatorMap({'.implode(', ', $inheritanceClassMap).'})'; |
|
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | 1232 | /** |
@@ -1245,8 +1245,8 @@ discard block |
||
| 1245 | 1245 | |
| 1246 | 1246 | $nullableField = $this->nullableFieldExpression($fieldMapping); |
| 1247 | 1247 | |
| 1248 | - if ((!$metadata->isEmbeddedClass || !$this->embeddablesImmutable) |
|
| 1249 | - && (!isset($fieldMapping['id']) || ! $fieldMapping['id'] || $metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_NONE) |
|
| 1248 | + if (( ! $metadata->isEmbeddedClass || ! $this->embeddablesImmutable) |
|
| 1249 | + && ( ! isset($fieldMapping['id']) || ! $fieldMapping['id'] || $metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_NONE) |
|
| 1250 | 1250 | && $code = $this->generateEntityStubMethod($metadata, 'set', $fieldMapping['fieldName'], $fieldMapping['type'], $nullableField) |
| 1251 | 1251 | ) { |
| 1252 | 1252 | $methods[] = $code; |
@@ -1317,7 +1317,7 @@ discard block |
||
| 1317 | 1317 | } |
| 1318 | 1318 | |
| 1319 | 1319 | foreach ($joinColumns as $joinColumn) { |
| 1320 | - if (isset($joinColumn['nullable']) && !$joinColumn['nullable']) { |
|
| 1320 | + if (isset($joinColumn['nullable']) && ! $joinColumn['nullable']) { |
|
| 1321 | 1321 | return false; |
| 1322 | 1322 | } |
| 1323 | 1323 | } |
@@ -1362,8 +1362,8 @@ discard block |
||
| 1362 | 1362 | } |
| 1363 | 1363 | |
| 1364 | 1364 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($associationMapping, $metadata); |
| 1365 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $associationMapping['fieldName'] |
|
| 1366 | - . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
| 1365 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$associationMapping['fieldName'] |
|
| 1366 | + . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null).";\n"; |
|
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | 1369 | return implode("\n", $lines); |
@@ -1387,8 +1387,8 @@ discard block |
||
| 1387 | 1387 | } |
| 1388 | 1388 | |
| 1389 | 1389 | $lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata); |
| 1390 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName'] |
|
| 1391 | - . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
| 1390 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldMapping['fieldName'] |
|
| 1391 | + . (isset($fieldMapping['options']['default']) ? ' = '.var_export($fieldMapping['options']['default'], true) : null).";\n"; |
|
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | 1394 | return implode("\n", $lines); |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | } |
| 1410 | 1410 | |
| 1411 | 1411 | $lines[] = $this->generateEmbeddedPropertyDocBlock($embeddedClass); |
| 1412 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldName . ";\n"; |
|
| 1412 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldName.";\n"; |
|
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | 1415 | return implode("\n", $lines); |
@@ -1426,7 +1426,7 @@ discard block |
||
| 1426 | 1426 | */ |
| 1427 | 1427 | protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null) |
| 1428 | 1428 | { |
| 1429 | - $methodName = $type . Inflector::classify($fieldName); |
|
| 1429 | + $methodName = $type.Inflector::classify($fieldName); |
|
| 1430 | 1430 | $variableName = Inflector::camelize($fieldName); |
| 1431 | 1431 | if (in_array($type, ["add", "remove"])) { |
| 1432 | 1432 | $methodName = Inflector::singularize($methodName); |
@@ -1446,8 +1446,8 @@ discard block |
||
| 1446 | 1446 | $variableType = $typeHint ? $this->getType($typeHint) : null; |
| 1447 | 1447 | |
| 1448 | 1448 | if ($typeHint && ! isset($types[$typeHint])) { |
| 1449 | - $variableType = '\\' . ltrim($variableType, '\\'); |
|
| 1450 | - $methodTypeHint = '\\' . $typeHint . ' '; |
|
| 1449 | + $variableType = '\\'.ltrim($variableType, '\\'); |
|
| 1450 | + $methodTypeHint = '\\'.$typeHint.' '; |
|
| 1451 | 1451 | } |
| 1452 | 1452 | |
| 1453 | 1453 | $methodReturnType = null; |
@@ -1461,13 +1461,13 @@ discard block |
||
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 | $replacements = [ |
| 1464 | - '<description>' => ucfirst($type) . ' ' . $variableName, |
|
| 1464 | + '<description>' => ucfirst($type).' '.$variableName, |
|
| 1465 | 1465 | '<methodTypeHint>' => $methodTypeHint, |
| 1466 | - '<variableType>' => $variableType . (null !== $defaultValue ? ('|' . $defaultValue) : ''), |
|
| 1466 | + '<variableType>' => $variableType.(null !== $defaultValue ? ('|'.$defaultValue) : ''), |
|
| 1467 | 1467 | '<variableName>' => $variableName, |
| 1468 | 1468 | '<methodName>' => $methodName, |
| 1469 | 1469 | '<fieldName>' => $fieldName, |
| 1470 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = ' . $defaultValue) : '', |
|
| 1470 | + '<variableDefault>' => ($defaultValue !== null) ? (' = '.$defaultValue) : '', |
|
| 1471 | 1471 | '<entity>' => $this->getClassName($metadata), |
| 1472 | 1472 | '<methodTypeReturn>' => $methodReturnType, |
| 1473 | 1473 | ]; |
@@ -1497,7 +1497,7 @@ discard block |
||
| 1497 | 1497 | $this->staticReflection[$metadata->name]['methods'][] = $methodName; |
| 1498 | 1498 | |
| 1499 | 1499 | $replacements = [ |
| 1500 | - '<name>' => $this->annotationsPrefix . ucfirst($name), |
|
| 1500 | + '<name>' => $this->annotationsPrefix.ucfirst($name), |
|
| 1501 | 1501 | '<methodName>' => $methodName, |
| 1502 | 1502 | ]; |
| 1503 | 1503 | |
@@ -1520,30 +1520,30 @@ discard block |
||
| 1520 | 1520 | $joinColumnAnnot = []; |
| 1521 | 1521 | |
| 1522 | 1522 | if (isset($joinColumn['name'])) { |
| 1523 | - $joinColumnAnnot[] = 'name="' . $joinColumn['name'] . '"'; |
|
| 1523 | + $joinColumnAnnot[] = 'name="'.$joinColumn['name'].'"'; |
|
| 1524 | 1524 | } |
| 1525 | 1525 | |
| 1526 | 1526 | if (isset($joinColumn['referencedColumnName'])) { |
| 1527 | - $joinColumnAnnot[] = 'referencedColumnName="' . $joinColumn['referencedColumnName'] . '"'; |
|
| 1527 | + $joinColumnAnnot[] = 'referencedColumnName="'.$joinColumn['referencedColumnName'].'"'; |
|
| 1528 | 1528 | } |
| 1529 | 1529 | |
| 1530 | 1530 | if (isset($joinColumn['unique']) && $joinColumn['unique']) { |
| 1531 | - $joinColumnAnnot[] = 'unique=' . ($joinColumn['unique'] ? 'true' : 'false'); |
|
| 1531 | + $joinColumnAnnot[] = 'unique='.($joinColumn['unique'] ? 'true' : 'false'); |
|
| 1532 | 1532 | } |
| 1533 | 1533 | |
| 1534 | 1534 | if (isset($joinColumn['nullable'])) { |
| 1535 | - $joinColumnAnnot[] = 'nullable=' . ($joinColumn['nullable'] ? 'true' : 'false'); |
|
| 1535 | + $joinColumnAnnot[] = 'nullable='.($joinColumn['nullable'] ? 'true' : 'false'); |
|
| 1536 | 1536 | } |
| 1537 | 1537 | |
| 1538 | 1538 | if (isset($joinColumn['onDelete'])) { |
| 1539 | - $joinColumnAnnot[] = 'onDelete="' . ($joinColumn['onDelete'] . '"'); |
|
| 1539 | + $joinColumnAnnot[] = 'onDelete="'.($joinColumn['onDelete'].'"'); |
|
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | 1542 | if (isset($joinColumn['columnDefinition'])) { |
| 1543 | - $joinColumnAnnot[] = 'columnDefinition="' . $joinColumn['columnDefinition'] . '"'; |
|
| 1543 | + $joinColumnAnnot[] = 'columnDefinition="'.$joinColumn['columnDefinition'].'"'; |
|
| 1544 | 1544 | } |
| 1545 | 1545 | |
| 1546 | - return '@' . $this->annotationsPrefix . 'JoinColumn(' . implode(', ', $joinColumnAnnot) . ')'; |
|
| 1546 | + return '@'.$this->annotationsPrefix.'JoinColumn('.implode(', ', $joinColumnAnnot).')'; |
|
| 1547 | 1547 | } |
| 1548 | 1548 | |
| 1549 | 1549 | /** |
@@ -1555,22 +1555,22 @@ discard block |
||
| 1555 | 1555 | protected function generateAssociationMappingPropertyDocBlock(array $associationMapping, ClassMetadataInfo $metadata) |
| 1556 | 1556 | { |
| 1557 | 1557 | $lines = []; |
| 1558 | - $lines[] = $this->spaces . '/**'; |
|
| 1558 | + $lines[] = $this->spaces.'/**'; |
|
| 1559 | 1559 | |
| 1560 | 1560 | if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) { |
| 1561 | - $lines[] = $this->spaces . ' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1561 | + $lines[] = $this->spaces.' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1562 | 1562 | } else { |
| 1563 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($associationMapping['targetEntity'], '\\'); |
|
| 1563 | + $lines[] = $this->spaces.' * @var \\'.ltrim($associationMapping['targetEntity'], '\\'); |
|
| 1564 | 1564 | } |
| 1565 | 1565 | |
| 1566 | 1566 | if ($this->generateAnnotations) { |
| 1567 | - $lines[] = $this->spaces . ' *'; |
|
| 1567 | + $lines[] = $this->spaces.' *'; |
|
| 1568 | 1568 | |
| 1569 | 1569 | if (isset($associationMapping['id']) && $associationMapping['id']) { |
| 1570 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
| 1570 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
| 1571 | 1571 | |
| 1572 | 1572 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
| 1573 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
| 1573 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
| 1574 | 1574 | } |
| 1575 | 1575 | } |
| 1576 | 1576 | |
@@ -1592,15 +1592,15 @@ discard block |
||
| 1592 | 1592 | $typeOptions = []; |
| 1593 | 1593 | |
| 1594 | 1594 | if (isset($associationMapping['targetEntity'])) { |
| 1595 | - $typeOptions[] = 'targetEntity="' . $associationMapping['targetEntity'] . '"'; |
|
| 1595 | + $typeOptions[] = 'targetEntity="'.$associationMapping['targetEntity'].'"'; |
|
| 1596 | 1596 | } |
| 1597 | 1597 | |
| 1598 | 1598 | if (isset($associationMapping['inversedBy'])) { |
| 1599 | - $typeOptions[] = 'inversedBy="' . $associationMapping['inversedBy'] . '"'; |
|
| 1599 | + $typeOptions[] = 'inversedBy="'.$associationMapping['inversedBy'].'"'; |
|
| 1600 | 1600 | } |
| 1601 | 1601 | |
| 1602 | 1602 | if (isset($associationMapping['mappedBy'])) { |
| 1603 | - $typeOptions[] = 'mappedBy="' . $associationMapping['mappedBy'] . '"'; |
|
| 1603 | + $typeOptions[] = 'mappedBy="'.$associationMapping['mappedBy'].'"'; |
|
| 1604 | 1604 | } |
| 1605 | 1605 | |
| 1606 | 1606 | if ($associationMapping['cascade']) { |
@@ -1616,11 +1616,11 @@ discard block |
||
| 1616 | 1616 | $cascades = ['"all"']; |
| 1617 | 1617 | } |
| 1618 | 1618 | |
| 1619 | - $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}'; |
|
| 1619 | + $typeOptions[] = 'cascade={'.implode(',', $cascades).'}'; |
|
| 1620 | 1620 | } |
| 1621 | 1621 | |
| 1622 | 1622 | if (isset($associationMapping['orphanRemoval']) && $associationMapping['orphanRemoval']) { |
| 1623 | - $typeOptions[] = 'orphanRemoval=' . ($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
| 1623 | + $typeOptions[] = 'orphanRemoval='.($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
| 1624 | 1624 | } |
| 1625 | 1625 | |
| 1626 | 1626 | if (isset($associationMapping['fetch']) && $associationMapping['fetch'] !== ClassMetadataInfo::FETCH_LAZY) { |
@@ -1629,71 +1629,71 @@ discard block |
||
| 1629 | 1629 | ClassMetadataInfo::FETCH_EAGER => 'EAGER', |
| 1630 | 1630 | ]; |
| 1631 | 1631 | |
| 1632 | - $typeOptions[] = 'fetch="' . $fetchMap[$associationMapping['fetch']] . '"'; |
|
| 1632 | + $typeOptions[] = 'fetch="'.$fetchMap[$associationMapping['fetch']].'"'; |
|
| 1633 | 1633 | } |
| 1634 | 1634 | |
| 1635 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . '' . $type . '(' . implode(', ', $typeOptions) . ')'; |
|
| 1635 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.''.$type.'('.implode(', ', $typeOptions).')'; |
|
| 1636 | 1636 | |
| 1637 | 1637 | if (isset($associationMapping['joinColumns']) && $associationMapping['joinColumns']) { |
| 1638 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinColumns({'; |
|
| 1638 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinColumns({'; |
|
| 1639 | 1639 | |
| 1640 | 1640 | $joinColumnsLines = []; |
| 1641 | 1641 | |
| 1642 | 1642 | foreach ($associationMapping['joinColumns'] as $joinColumn) { |
| 1643 | 1643 | if ($joinColumnAnnot = $this->generateJoinColumnAnnotation($joinColumn)) { |
| 1644 | - $joinColumnsLines[] = $this->spaces . ' * ' . $joinColumnAnnot; |
|
| 1644 | + $joinColumnsLines[] = $this->spaces.' * '.$joinColumnAnnot; |
|
| 1645 | 1645 | } |
| 1646 | 1646 | } |
| 1647 | 1647 | |
| 1648 | 1648 | $lines[] = implode(",\n", $joinColumnsLines); |
| 1649 | - $lines[] = $this->spaces . ' * })'; |
|
| 1649 | + $lines[] = $this->spaces.' * })'; |
|
| 1650 | 1650 | } |
| 1651 | 1651 | |
| 1652 | 1652 | if (isset($associationMapping['joinTable']) && $associationMapping['joinTable']) { |
| 1653 | 1653 | $joinTable = []; |
| 1654 | - $joinTable[] = 'name="' . $associationMapping['joinTable']['name'] . '"'; |
|
| 1654 | + $joinTable[] = 'name="'.$associationMapping['joinTable']['name'].'"'; |
|
| 1655 | 1655 | |
| 1656 | 1656 | if (isset($associationMapping['joinTable']['schema'])) { |
| 1657 | - $joinTable[] = 'schema="' . $associationMapping['joinTable']['schema'] . '"'; |
|
| 1657 | + $joinTable[] = 'schema="'.$associationMapping['joinTable']['schema'].'"'; |
|
| 1658 | 1658 | } |
| 1659 | 1659 | |
| 1660 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinTable(' . implode(', ', $joinTable) . ','; |
|
| 1661 | - $lines[] = $this->spaces . ' * joinColumns={'; |
|
| 1660 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinTable('.implode(', ', $joinTable).','; |
|
| 1661 | + $lines[] = $this->spaces.' * joinColumns={'; |
|
| 1662 | 1662 | |
| 1663 | 1663 | $joinColumnsLines = []; |
| 1664 | 1664 | |
| 1665 | 1665 | foreach ($associationMapping['joinTable']['joinColumns'] as $joinColumn) { |
| 1666 | - $joinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1666 | + $joinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1667 | 1667 | } |
| 1668 | 1668 | |
| 1669 | - $lines[] = implode(",". PHP_EOL, $joinColumnsLines); |
|
| 1670 | - $lines[] = $this->spaces . ' * },'; |
|
| 1671 | - $lines[] = $this->spaces . ' * inverseJoinColumns={'; |
|
| 1669 | + $lines[] = implode(",".PHP_EOL, $joinColumnsLines); |
|
| 1670 | + $lines[] = $this->spaces.' * },'; |
|
| 1671 | + $lines[] = $this->spaces.' * inverseJoinColumns={'; |
|
| 1672 | 1672 | |
| 1673 | 1673 | $inverseJoinColumnsLines = []; |
| 1674 | 1674 | |
| 1675 | 1675 | foreach ($associationMapping['joinTable']['inverseJoinColumns'] as $joinColumn) { |
| 1676 | - $inverseJoinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1676 | + $inverseJoinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1677 | 1677 | } |
| 1678 | 1678 | |
| 1679 | - $lines[] = implode(",". PHP_EOL, $inverseJoinColumnsLines); |
|
| 1680 | - $lines[] = $this->spaces . ' * }'; |
|
| 1681 | - $lines[] = $this->spaces . ' * )'; |
|
| 1679 | + $lines[] = implode(",".PHP_EOL, $inverseJoinColumnsLines); |
|
| 1680 | + $lines[] = $this->spaces.' * }'; |
|
| 1681 | + $lines[] = $this->spaces.' * )'; |
|
| 1682 | 1682 | } |
| 1683 | 1683 | |
| 1684 | 1684 | if (isset($associationMapping['orderBy'])) { |
| 1685 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'OrderBy({'; |
|
| 1685 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'OrderBy({'; |
|
| 1686 | 1686 | |
| 1687 | 1687 | foreach ($associationMapping['orderBy'] as $name => $direction) { |
| 1688 | - $lines[] = $this->spaces . ' * "' . $name . '"="' . $direction . '",'; |
|
| 1688 | + $lines[] = $this->spaces.' * "'.$name.'"="'.$direction.'",'; |
|
| 1689 | 1689 | } |
| 1690 | 1690 | |
| 1691 | 1691 | $lines[count($lines) - 1] = substr($lines[count($lines) - 1], 0, strlen($lines[count($lines) - 1]) - 1); |
| 1692 | - $lines[] = $this->spaces . ' * })'; |
|
| 1692 | + $lines[] = $this->spaces.' * })'; |
|
| 1693 | 1693 | } |
| 1694 | 1694 | } |
| 1695 | 1695 | |
| 1696 | - $lines[] = $this->spaces . ' */'; |
|
| 1696 | + $lines[] = $this->spaces.' */'; |
|
| 1697 | 1697 | |
| 1698 | 1698 | return implode("\n", $lines); |
| 1699 | 1699 | } |
@@ -1707,37 +1707,37 @@ discard block |
||
| 1707 | 1707 | protected function generateFieldMappingPropertyDocBlock(array $fieldMapping, ClassMetadataInfo $metadata) |
| 1708 | 1708 | { |
| 1709 | 1709 | $lines = []; |
| 1710 | - $lines[] = $this->spaces . '/**'; |
|
| 1711 | - $lines[] = $this->spaces . ' * @var ' |
|
| 1710 | + $lines[] = $this->spaces.'/**'; |
|
| 1711 | + $lines[] = $this->spaces.' * @var ' |
|
| 1712 | 1712 | . $this->getType($fieldMapping['type']) |
| 1713 | 1713 | . ($this->nullableFieldExpression($fieldMapping) ? '|null' : ''); |
| 1714 | 1714 | |
| 1715 | 1715 | if ($this->generateAnnotations) { |
| 1716 | - $lines[] = $this->spaces . ' *'; |
|
| 1716 | + $lines[] = $this->spaces.' *'; |
|
| 1717 | 1717 | |
| 1718 | 1718 | $column = []; |
| 1719 | 1719 | if (isset($fieldMapping['columnName'])) { |
| 1720 | - $column[] = 'name="' . $fieldMapping['columnName'] . '"'; |
|
| 1720 | + $column[] = 'name="'.$fieldMapping['columnName'].'"'; |
|
| 1721 | 1721 | } |
| 1722 | 1722 | |
| 1723 | 1723 | if (isset($fieldMapping['type'])) { |
| 1724 | - $column[] = 'type="' . $fieldMapping['type'] . '"'; |
|
| 1724 | + $column[] = 'type="'.$fieldMapping['type'].'"'; |
|
| 1725 | 1725 | } |
| 1726 | 1726 | |
| 1727 | 1727 | if (isset($fieldMapping['length'])) { |
| 1728 | - $column[] = 'length=' . $fieldMapping['length']; |
|
| 1728 | + $column[] = 'length='.$fieldMapping['length']; |
|
| 1729 | 1729 | } |
| 1730 | 1730 | |
| 1731 | 1731 | if (isset($fieldMapping['precision'])) { |
| 1732 | - $column[] = 'precision=' . $fieldMapping['precision']; |
|
| 1732 | + $column[] = 'precision='.$fieldMapping['precision']; |
|
| 1733 | 1733 | } |
| 1734 | 1734 | |
| 1735 | 1735 | if (isset($fieldMapping['scale'])) { |
| 1736 | - $column[] = 'scale=' . $fieldMapping['scale']; |
|
| 1736 | + $column[] = 'scale='.$fieldMapping['scale']; |
|
| 1737 | 1737 | } |
| 1738 | 1738 | |
| 1739 | 1739 | if (isset($fieldMapping['nullable'])) { |
| 1740 | - $column[] = 'nullable=' . var_export($fieldMapping['nullable'], true); |
|
| 1740 | + $column[] = 'nullable='.var_export($fieldMapping['nullable'], true); |
|
| 1741 | 1741 | } |
| 1742 | 1742 | |
| 1743 | 1743 | $options = []; |
@@ -1751,47 +1751,47 @@ discard block |
||
| 1751 | 1751 | } |
| 1752 | 1752 | |
| 1753 | 1753 | if (isset($fieldMapping['columnDefinition'])) { |
| 1754 | - $column[] = 'columnDefinition="' . $fieldMapping['columnDefinition'] . '"'; |
|
| 1754 | + $column[] = 'columnDefinition="'.$fieldMapping['columnDefinition'].'"'; |
|
| 1755 | 1755 | } |
| 1756 | 1756 | |
| 1757 | 1757 | if (isset($fieldMapping['unique'])) { |
| 1758 | - $column[] = 'unique=' . var_export($fieldMapping['unique'], true); |
|
| 1758 | + $column[] = 'unique='.var_export($fieldMapping['unique'], true); |
|
| 1759 | 1759 | } |
| 1760 | 1760 | |
| 1761 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Column(' . implode(', ', $column) . ')'; |
|
| 1761 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Column('.implode(', ', $column).')'; |
|
| 1762 | 1762 | |
| 1763 | 1763 | if (isset($fieldMapping['id']) && $fieldMapping['id']) { |
| 1764 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
| 1764 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
| 1765 | 1765 | |
| 1766 | 1766 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
| 1767 | - $lines[] = $this->spaces.' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
| 1767 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
| 1768 | 1768 | } |
| 1769 | 1769 | |
| 1770 | 1770 | if ($metadata->sequenceGeneratorDefinition) { |
| 1771 | 1771 | $sequenceGenerator = []; |
| 1772 | 1772 | |
| 1773 | 1773 | if (isset($metadata->sequenceGeneratorDefinition['sequenceName'])) { |
| 1774 | - $sequenceGenerator[] = 'sequenceName="' . $metadata->sequenceGeneratorDefinition['sequenceName'] . '"'; |
|
| 1774 | + $sequenceGenerator[] = 'sequenceName="'.$metadata->sequenceGeneratorDefinition['sequenceName'].'"'; |
|
| 1775 | 1775 | } |
| 1776 | 1776 | |
| 1777 | 1777 | if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) { |
| 1778 | - $sequenceGenerator[] = 'allocationSize=' . $metadata->sequenceGeneratorDefinition['allocationSize']; |
|
| 1778 | + $sequenceGenerator[] = 'allocationSize='.$metadata->sequenceGeneratorDefinition['allocationSize']; |
|
| 1779 | 1779 | } |
| 1780 | 1780 | |
| 1781 | 1781 | if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) { |
| 1782 | - $sequenceGenerator[] = 'initialValue=' . $metadata->sequenceGeneratorDefinition['initialValue']; |
|
| 1782 | + $sequenceGenerator[] = 'initialValue='.$metadata->sequenceGeneratorDefinition['initialValue']; |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'SequenceGenerator(' . implode(', ', $sequenceGenerator) . ')'; |
|
| 1785 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'SequenceGenerator('.implode(', ', $sequenceGenerator).')'; |
|
| 1786 | 1786 | } |
| 1787 | 1787 | } |
| 1788 | 1788 | |
| 1789 | 1789 | if (isset($fieldMapping['version']) && $fieldMapping['version']) { |
| 1790 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Version'; |
|
| 1790 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Version'; |
|
| 1791 | 1791 | } |
| 1792 | 1792 | } |
| 1793 | 1793 | |
| 1794 | - $lines[] = $this->spaces . ' */'; |
|
| 1794 | + $lines[] = $this->spaces.' */'; |
|
| 1795 | 1795 | |
| 1796 | 1796 | return implode("\n", $lines); |
| 1797 | 1797 | } |
@@ -1804,27 +1804,27 @@ discard block |
||
| 1804 | 1804 | protected function generateEmbeddedPropertyDocBlock(array $embeddedClass) |
| 1805 | 1805 | { |
| 1806 | 1806 | $lines = []; |
| 1807 | - $lines[] = $this->spaces . '/**'; |
|
| 1808 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($embeddedClass['class'], '\\'); |
|
| 1807 | + $lines[] = $this->spaces.'/**'; |
|
| 1808 | + $lines[] = $this->spaces.' * @var \\'.ltrim($embeddedClass['class'], '\\'); |
|
| 1809 | 1809 | |
| 1810 | 1810 | if ($this->generateAnnotations) { |
| 1811 | - $lines[] = $this->spaces . ' *'; |
|
| 1811 | + $lines[] = $this->spaces.' *'; |
|
| 1812 | 1812 | |
| 1813 | - $embedded = ['class="' . $embeddedClass['class'] . '"']; |
|
| 1813 | + $embedded = ['class="'.$embeddedClass['class'].'"']; |
|
| 1814 | 1814 | |
| 1815 | 1815 | if (isset($embeddedClass['columnPrefix'])) { |
| 1816 | 1816 | if (is_string($embeddedClass['columnPrefix'])) { |
| 1817 | - $embedded[] = 'columnPrefix="' . $embeddedClass['columnPrefix'] . '"'; |
|
| 1817 | + $embedded[] = 'columnPrefix="'.$embeddedClass['columnPrefix'].'"'; |
|
| 1818 | 1818 | } else { |
| 1819 | - $embedded[] = 'columnPrefix=' . var_export($embeddedClass['columnPrefix'], true); |
|
| 1819 | + $embedded[] = 'columnPrefix='.var_export($embeddedClass['columnPrefix'], true); |
|
| 1820 | 1820 | } |
| 1821 | 1821 | } |
| 1822 | 1822 | |
| 1823 | - $lines[] = $this->spaces . ' * @' . |
|
| 1824 | - $this->annotationsPrefix . 'Embedded(' . implode(', ', $embedded) . ')'; |
|
| 1823 | + $lines[] = $this->spaces.' * @'. |
|
| 1824 | + $this->annotationsPrefix.'Embedded('.implode(', ', $embedded).')'; |
|
| 1825 | 1825 | } |
| 1826 | 1826 | |
| 1827 | - $lines[] = $this->spaces . ' */'; |
|
| 1827 | + $lines[] = $this->spaces.' */'; |
|
| 1828 | 1828 | |
| 1829 | 1829 | return implode("\n", $lines); |
| 1830 | 1830 | } |
@@ -1838,13 +1838,13 @@ discard block |
||
| 1838 | 1838 | $processedClasses = []; |
| 1839 | 1839 | foreach ($metadata->entityListeners as $event => $eventListeners) { |
| 1840 | 1840 | foreach ($eventListeners as $eventListener) { |
| 1841 | - $processedClasses[] = '"' . $eventListener['class'] . '"'; |
|
| 1841 | + $processedClasses[] = '"'.$eventListener['class'].'"'; |
|
| 1842 | 1842 | } |
| 1843 | 1843 | } |
| 1844 | 1844 | |
| 1845 | 1845 | return \sprintf( |
| 1846 | 1846 | '%s%s({%s})', |
| 1847 | - '@' . $this->annotationsPrefix, |
|
| 1847 | + '@'.$this->annotationsPrefix, |
|
| 1848 | 1848 | 'EntityListeners', |
| 1849 | 1849 | \implode(',', \array_unique($processedClasses)) |
| 1850 | 1850 | ); |
@@ -1862,7 +1862,7 @@ discard block |
||
| 1862 | 1862 | |
| 1863 | 1863 | foreach ($lines as $key => $value) { |
| 1864 | 1864 | if ( ! empty($value)) { |
| 1865 | - $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; |
|
| 1865 | + $lines[$key] = str_repeat($this->spaces, $num).$lines[$key]; |
|
| 1866 | 1866 | } |
| 1867 | 1867 | } |
| 1868 | 1868 | |
@@ -1944,9 +1944,9 @@ discard block |
||
| 1944 | 1944 | |
| 1945 | 1945 | foreach ($options as $name => $option) { |
| 1946 | 1946 | if (is_array($option)) { |
| 1947 | - $optionsStr[] = '"' . $name . '"={' . $this->exportTableOptions($option) . '}'; |
|
| 1947 | + $optionsStr[] = '"'.$name.'"={'.$this->exportTableOptions($option).'}'; |
|
| 1948 | 1948 | } else { |
| 1949 | - $optionsStr[] = '"' . $name . '"="' . (string) $option . '"'; |
|
| 1949 | + $optionsStr[] = '"'.$name.'"="'.(string) $option.'"'; |
|
| 1950 | 1950 | } |
| 1951 | 1951 | } |
| 1952 | 1952 | |
@@ -1969,7 +1969,7 @@ discard block |
||
| 1969 | 1969 | if ('get' === $type) { |
| 1970 | 1970 | if ( |
| 1971 | 1971 | $metadata->isSingleValuedAssociation($fieldName) || |
| 1972 | - (!$metadata->hasAssociation($fieldName) && $metadata->isNullable($fieldName)) |
|
| 1972 | + ( ! $metadata->hasAssociation($fieldName) && $metadata->isNullable($fieldName)) |
|
| 1973 | 1973 | ) { |
| 1974 | 1974 | return null; |
| 1975 | 1975 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $this->_namespace = uniqid("doctrine_"); |
| 29 | 29 | $this->_tmpDir = \sys_get_temp_dir(); |
| 30 | - \mkdir($this->_tmpDir . \DIRECTORY_SEPARATOR . $this->_namespace); |
|
| 30 | + \mkdir($this->_tmpDir.\DIRECTORY_SEPARATOR.$this->_namespace); |
|
| 31 | 31 | $this->_generator = new EntityGenerator(); |
| 32 | 32 | $this->_generator->setAnnotationPrefix(""); |
| 33 | 33 | $this->_generator->setGenerateAnnotations(true); |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function tearDown() |
| 43 | 43 | { |
| 44 | - $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->_tmpDir . '/' . $this->_namespace)); |
|
| 44 | + $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->_tmpDir.'/'.$this->_namespace)); |
|
| 45 | 45 | foreach ($ri AS $file) { |
| 46 | 46 | /* @var $file \SplFileInfo */ |
| 47 | 47 | if ($file->isFile()) { |
| 48 | 48 | \unlink($file->getPathname()); |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | - rmdir($this->_tmpDir . '/' . $this->_namespace); |
|
| 51 | + rmdir($this->_tmpDir.'/'.$this->_namespace); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function generateBookEntityFixture(array $embeddedClasses = []) |
| 60 | 60 | { |
| 61 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorBook'); |
|
| 61 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorBook'); |
|
| 62 | 62 | $metadata->namespace = $this->_namespace; |
| 63 | - $metadata->customRepositoryClassName = $this->_namespace . '\EntityGeneratorBookRepository'; |
|
| 63 | + $metadata->customRepositoryClassName = $this->_namespace.'\EntityGeneratorBookRepository'; |
|
| 64 | 64 | |
| 65 | 65 | $metadata->table['name'] = 'book'; |
| 66 | 66 | $metadata->table['uniqueConstraints']['name_uniq'] = ['columns' => ['name']]; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | private function generateEntityTypeFixture(array $field) |
| 104 | 104 | { |
| 105 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityType'); |
|
| 105 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityType'); |
|
| 106 | 106 | $metadata->namespace = $this->_namespace; |
| 107 | 107 | |
| 108 | 108 | $metadata->table['name'] = 'entity_type'; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | private function generateIsbnEmbeddableFixture(array $embeddedClasses = [], $columnPrefix = null) |
| 125 | 125 | { |
| 126 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorIsbn'); |
|
| 126 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorIsbn'); |
|
| 127 | 127 | $metadata->namespace = $this->_namespace; |
| 128 | 128 | $metadata->isEmbeddedClass = true; |
| 129 | 129 | $metadata->mapField(['fieldName' => 'prefix', 'type' => 'integer']); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | private function generateTestEmbeddableFixture() |
| 148 | 148 | { |
| 149 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorTestEmbeddable'); |
|
| 149 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorTestEmbeddable'); |
|
| 150 | 150 | $metadata->namespace = $this->_namespace; |
| 151 | 151 | $metadata->isEmbeddedClass = true; |
| 152 | 152 | $metadata->mapField(['fieldName' => 'field1', 'type' => 'integer']); |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | foreach ($embeddableMetadata->embeddedClasses as $property => $embeddableClass) { |
| 190 | 190 | $classMetadata->mapEmbedded( |
| 191 | 191 | [ |
| 192 | - 'fieldName' => $fieldName . '.' . $property, |
|
| 192 | + 'fieldName' => $fieldName.'.'.$property, |
|
| 193 | 193 | 'class' => $embeddableClass['class'], |
| 194 | 194 | 'columnPrefix' => $embeddableClass['columnPrefix'], |
| 195 | 195 | 'declaredField' => $embeddableClass['declaredField'] |
| 196 | - ? $fieldName . '.' . $embeddableClass['declaredField'] |
|
| 196 | + ? $fieldName.'.'.$embeddableClass['declaredField'] |
|
| 197 | 197 | : $fieldName, |
| 198 | 198 | 'originalField' => $embeddableClass['originalField'] ?: $property, |
| 199 | 199 | ] |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | private function loadEntityClass(ClassMetadataInfo $metadata) |
| 208 | 208 | { |
| 209 | 209 | $className = basename(str_replace('\\', '/', $metadata->name)); |
| 210 | - $path = $this->_tmpDir . '/' . $this->_namespace . '/' . $className . '.php'; |
|
| 210 | + $path = $this->_tmpDir.'/'.$this->_namespace.'/'.$className.'.php'; |
|
| 211 | 211 | |
| 212 | 212 | $this->assertFileExists($path); |
| 213 | 213 | |
@@ -267,19 +267,19 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | $book = $this->newInstance($metadata); |
| 269 | 269 | $this->assertTrue(class_exists($metadata->name), "Class does not exist."); |
| 270 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', '__construct'), "EntityGeneratorBook::__construct() missing."); |
|
| 271 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getId'), "EntityGeneratorBook::getId() missing."); |
|
| 272 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setName'), "EntityGeneratorBook::setName() missing."); |
|
| 273 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getName'), "EntityGeneratorBook::getName() missing."); |
|
| 274 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setStatus'), "EntityGeneratorBook::setStatus() missing."); |
|
| 275 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getStatus'), "EntityGeneratorBook::getStatus() missing."); |
|
| 276 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setAuthor'), "EntityGeneratorBook::setAuthor() missing."); |
|
| 277 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getAuthor'), "EntityGeneratorBook::getAuthor() missing."); |
|
| 278 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getComments'), "EntityGeneratorBook::getComments() missing."); |
|
| 279 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'addComment'), "EntityGeneratorBook::addComment() missing."); |
|
| 280 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'removeComment'), "EntityGeneratorBook::removeComment() missing."); |
|
| 281 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setIsbn'), "EntityGeneratorBook::setIsbn() missing."); |
|
| 282 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getIsbn'), "EntityGeneratorBook::getIsbn() missing."); |
|
| 270 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', '__construct'), "EntityGeneratorBook::__construct() missing."); |
|
| 271 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getId'), "EntityGeneratorBook::getId() missing."); |
|
| 272 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setName'), "EntityGeneratorBook::setName() missing."); |
|
| 273 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getName'), "EntityGeneratorBook::getName() missing."); |
|
| 274 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setStatus'), "EntityGeneratorBook::setStatus() missing."); |
|
| 275 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getStatus'), "EntityGeneratorBook::getStatus() missing."); |
|
| 276 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setAuthor'), "EntityGeneratorBook::setAuthor() missing."); |
|
| 277 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getAuthor'), "EntityGeneratorBook::getAuthor() missing."); |
|
| 278 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getComments'), "EntityGeneratorBook::getComments() missing."); |
|
| 279 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'addComment'), "EntityGeneratorBook::addComment() missing."); |
|
| 280 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'removeComment'), "EntityGeneratorBook::removeComment() missing."); |
|
| 281 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setIsbn'), "EntityGeneratorBook::setIsbn() missing."); |
|
| 282 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getIsbn'), "EntityGeneratorBook::getIsbn() missing."); |
|
| 283 | 283 | |
| 284 | 284 | $reflClass = new \ReflectionClass($metadata->name); |
| 285 | 285 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 334 | 334 | |
| 335 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/EntityGeneratorBook.php~"); |
|
| 335 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/EntityGeneratorBook.php~"); |
|
| 336 | 336 | |
| 337 | 337 | $book = $this->newInstance($metadata); |
| 338 | 338 | $reflClass = new \ReflectionClass($metadata->name); |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | // Should not throw a PHP fatal error |
| 378 | 378 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 379 | 379 | |
| 380 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/EntityGeneratorBook.php~"); |
|
| 380 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/EntityGeneratorBook.php~"); |
|
| 381 | 381 | |
| 382 | 382 | $this->newInstance($metadata); |
| 383 | 383 | $reflClass = new \ReflectionClass($metadata->name); |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | $this->assertPhpDocReturnType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor|null', new \ReflectionMethod($book, 'getAuthor')); |
| 413 | 413 | $this->assertPhpDocParamType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor|null', new \ReflectionMethod($book, 'setAuthor')); |
| 414 | 414 | |
| 415 | - $expectedClassName = '\\' . $embeddedMetadata->name; |
|
| 415 | + $expectedClassName = '\\'.$embeddedMetadata->name; |
|
| 416 | 416 | $this->assertPhpDocVarType($expectedClassName, new \ReflectionProperty($book, 'isbn')); |
| 417 | 417 | $this->assertPhpDocReturnType($expectedClassName, new \ReflectionMethod($book, 'getIsbn')); |
| 418 | 418 | $this->assertPhpDocParamType($expectedClassName, new \ReflectionMethod($book, 'setIsbn')); |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | public function testMappedSuperclassAnnotationGeneration() |
| 524 | 524 | { |
| 525 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorBook'); |
|
| 525 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorBook'); |
|
| 526 | 526 | $metadata->namespace = $this->_namespace; |
| 527 | 527 | $metadata->isMappedSuperclass = true; |
| 528 | 528 | |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | */ |
| 561 | 561 | public function testGenerateEntityWithSequenceGenerator() |
| 562 | 562 | { |
| 563 | - $metadata = new ClassMetadataInfo($this->_namespace . '\DDC1784Entity'); |
|
| 563 | + $metadata = new ClassMetadataInfo($this->_namespace.'\DDC1784Entity'); |
|
| 564 | 564 | $metadata->namespace = $this->_namespace; |
| 565 | 565 | $metadata->mapField(['fieldName' => 'id', 'type' => 'integer', 'id' => true]); |
| 566 | 566 | $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE); |
@@ -573,8 +573,8 @@ discard block |
||
| 573 | 573 | ); |
| 574 | 574 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 575 | 575 | |
| 576 | - $filename = $this->_tmpDir . DIRECTORY_SEPARATOR |
|
| 577 | - . $this->_namespace . DIRECTORY_SEPARATOR . 'DDC1784Entity.php'; |
|
| 576 | + $filename = $this->_tmpDir.DIRECTORY_SEPARATOR |
|
| 577 | + . $this->_namespace.DIRECTORY_SEPARATOR.'DDC1784Entity.php'; |
|
| 578 | 578 | |
| 579 | 579 | $this->assertFileExists($filename); |
| 580 | 580 | require_once $filename; |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | */ |
| 595 | 595 | public function testGenerateEntityWithMultipleInverseJoinColumns() |
| 596 | 596 | { |
| 597 | - $metadata = new ClassMetadataInfo($this->_namespace . '\DDC2079Entity'); |
|
| 597 | + $metadata = new ClassMetadataInfo($this->_namespace.'\DDC2079Entity'); |
|
| 598 | 598 | $metadata->namespace = $this->_namespace; |
| 599 | 599 | $metadata->mapField(['fieldName' => 'id', 'type' => 'integer', 'id' => true]); |
| 600 | 600 | $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE); |
@@ -605,20 +605,20 @@ discard block |
||
| 605 | 605 | 'joinTable' => [ |
| 606 | 606 | 'name' => 'unidade_centro_custo', |
| 607 | 607 | 'joinColumns' => [ |
| 608 | - ['name' => 'idorcamento', 'referencedColumnName' => 'idorcamento'], |
|
| 609 | - ['name' => 'idunidade', 'referencedColumnName' => 'idunidade'] |
|
| 608 | + ['name' => 'idorcamento', 'referencedColumnName' => 'idorcamento'], |
|
| 609 | + ['name' => 'idunidade', 'referencedColumnName' => 'idunidade'] |
|
| 610 | 610 | ], |
| 611 | 611 | 'inverseJoinColumns' => [ |
| 612 | - ['name' => 'idcentrocusto', 'referencedColumnName' => 'idcentrocusto'], |
|
| 613 | - ['name' => 'idpais', 'referencedColumnName' => 'idpais'], |
|
| 612 | + ['name' => 'idcentrocusto', 'referencedColumnName' => 'idcentrocusto'], |
|
| 613 | + ['name' => 'idpais', 'referencedColumnName' => 'idpais'], |
|
| 614 | 614 | ], |
| 615 | 615 | ], |
| 616 | 616 | ] |
| 617 | 617 | ); |
| 618 | 618 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 619 | 619 | |
| 620 | - $filename = $this->_tmpDir . DIRECTORY_SEPARATOR |
|
| 621 | - . $this->_namespace . DIRECTORY_SEPARATOR . 'DDC2079Entity.php'; |
|
| 620 | + $filename = $this->_tmpDir.DIRECTORY_SEPARATOR |
|
| 621 | + . $this->_namespace.DIRECTORY_SEPARATOR.'DDC2079Entity.php'; |
|
| 622 | 622 | |
| 623 | 623 | $this->assertFileExists($filename); |
| 624 | 624 | require_once $filename; |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | $method->setAccessible(true); |
| 649 | 649 | |
| 650 | 650 | foreach ($constants as $name => $value) { |
| 651 | - if( ! preg_match($pattern, $name)) { |
|
| 651 | + if ( ! preg_match($pattern, $name)) { |
|
| 652 | 652 | continue; |
| 653 | 653 | } |
| 654 | 654 | |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | $method->setAccessible(true); |
| 678 | 678 | |
| 679 | 679 | foreach ($constants as $name => $value) { |
| 680 | - if( ! preg_match($pattern, $name)) { |
|
| 680 | + if ( ! preg_match($pattern, $name)) { |
|
| 681 | 681 | continue; |
| 682 | 682 | } |
| 683 | 683 | |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | $method->setAccessible(true); |
| 707 | 707 | |
| 708 | 708 | foreach ($constants as $name => $value) { |
| 709 | - if( ! preg_match($pattern, $name)) { |
|
| 709 | + if ( ! preg_match($pattern, $name)) { |
|
| 710 | 710 | continue; |
| 711 | 711 | } |
| 712 | 712 | |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | public function testEntityTypeAlias(array $field) |
| 731 | 731 | { |
| 732 | 732 | $metadata = $this->generateEntityTypeFixture($field); |
| 733 | - $path = $this->_tmpDir . '/'. $this->_namespace . '/EntityType.php'; |
|
| 733 | + $path = $this->_tmpDir.'/'.$this->_namespace.'/EntityType.php'; |
|
| 734 | 734 | |
| 735 | 735 | $this->assertFileExists($path); |
| 736 | 736 | require_once $path; |
@@ -741,8 +741,8 @@ discard block |
||
| 741 | 741 | $type = $field['phpType']; |
| 742 | 742 | $name = $field['fieldName']; |
| 743 | 743 | $value = $field['value']; |
| 744 | - $getter = "get" . ucfirst($name); |
|
| 745 | - $setter = "set" . ucfirst($name); |
|
| 744 | + $getter = "get".ucfirst($name); |
|
| 745 | + $setter = "set".ucfirst($name); |
|
| 746 | 746 | |
| 747 | 747 | $this->assertPhpDocVarType($type, $reflClass->getProperty($name)); |
| 748 | 748 | $this->assertPhpDocParamType($type, $reflClass->getMethod($setter)); |
@@ -763,13 +763,13 @@ discard block |
||
| 763 | 763 | |
| 764 | 764 | $user = new DDC2372User(); |
| 765 | 765 | $metadata = $cmf->getMetadataFor(get_class($user)); |
| 766 | - $metadata->name = $this->_namespace . "\DDC2372User"; |
|
| 766 | + $metadata->name = $this->_namespace."\DDC2372User"; |
|
| 767 | 767 | $metadata->namespace = $this->_namespace; |
| 768 | 768 | |
| 769 | 769 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 770 | 770 | |
| 771 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/DDC2372User.php"); |
|
| 772 | - require $this->_tmpDir . "/" . $this->_namespace . "/DDC2372User.php"; |
|
| 771 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/DDC2372User.php"); |
|
| 772 | + require $this->_tmpDir."/".$this->_namespace."/DDC2372User.php"; |
|
| 773 | 773 | |
| 774 | 774 | $reflClass = new \ReflectionClass($metadata->name); |
| 775 | 775 | |
@@ -789,13 +789,13 @@ discard block |
||
| 789 | 789 | |
| 790 | 790 | $user = new DDC2372Admin(); |
| 791 | 791 | $metadata = $cmf->getMetadataFor(get_class($user)); |
| 792 | - $metadata->name = $this->_namespace . "\DDC2372Admin"; |
|
| 792 | + $metadata->name = $this->_namespace."\DDC2372Admin"; |
|
| 793 | 793 | $metadata->namespace = $this->_namespace; |
| 794 | 794 | |
| 795 | 795 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 796 | 796 | |
| 797 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/DDC2372Admin.php"); |
|
| 798 | - require $this->_tmpDir . "/" . $this->_namespace . "/DDC2372Admin.php"; |
|
| 797 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/DDC2372Admin.php"); |
|
| 798 | + require $this->_tmpDir."/".$this->_namespace."/DDC2372Admin.php"; |
|
| 799 | 799 | |
| 800 | 800 | $reflClass = new \ReflectionClass($metadata->name); |
| 801 | 801 | |
@@ -815,20 +815,20 @@ discard block |
||
| 815 | 815 | $cmf->setEntityManager($em); |
| 816 | 816 | |
| 817 | 817 | $ns = $this->_namespace; |
| 818 | - $nsdir = $this->_tmpDir . '/' . $ns; |
|
| 818 | + $nsdir = $this->_tmpDir.'/'.$ns; |
|
| 819 | 819 | |
| 820 | 820 | $content = str_replace( |
| 821 | 821 | 'namespace Doctrine\Tests\Models\DDC1590', |
| 822 | - 'namespace ' . $ns, |
|
| 823 | - file_get_contents(__DIR__ . '/../../Models/DDC1590/DDC1590User.php') |
|
| 822 | + 'namespace '.$ns, |
|
| 823 | + file_get_contents(__DIR__.'/../../Models/DDC1590/DDC1590User.php') |
|
| 824 | 824 | ); |
| 825 | 825 | |
| 826 | - $fname = $nsdir . "/DDC1590User.php"; |
|
| 826 | + $fname = $nsdir."/DDC1590User.php"; |
|
| 827 | 827 | file_put_contents($fname, $content); |
| 828 | 828 | require $fname; |
| 829 | 829 | |
| 830 | 830 | |
| 831 | - $metadata = $cmf->getMetadataFor($ns . '\DDC1590User'); |
|
| 831 | + $metadata = $cmf->getMetadataFor($ns.'\DDC1590User'); |
|
| 832 | 832 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 833 | 833 | |
| 834 | 834 | // class DDC1590User extends DDC1590Entity { ... } |
@@ -836,13 +836,13 @@ discard block |
||
| 836 | 836 | |
| 837 | 837 | // class _DDC1590User extends DDC1590Entity { ... } |
| 838 | 838 | $source2 = str_replace('class DDC1590User', 'class _DDC1590User', $source); |
| 839 | - $fname2 = $nsdir . "/_DDC1590User.php"; |
|
| 839 | + $fname2 = $nsdir."/_DDC1590User.php"; |
|
| 840 | 840 | file_put_contents($fname2, $source2); |
| 841 | 841 | require $fname2; |
| 842 | 842 | |
| 843 | 843 | // class __DDC1590User { ... } |
| 844 | 844 | $source3 = str_replace('class DDC1590User extends DDC1590Entity', 'class __DDC1590User', $source); |
| 845 | - $fname3 = $nsdir . "/__DDC1590User.php"; |
|
| 845 | + $fname3 = $nsdir."/__DDC1590User.php"; |
|
| 846 | 846 | file_put_contents($fname3, $source3); |
| 847 | 847 | require $fname3; |
| 848 | 848 | |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | $this->loadEntityClass($metadata); |
| 997 | 997 | |
| 998 | 998 | $className = basename(str_replace('\\', '/', $metadata->name)); |
| 999 | - $path = $this->_tmpDir . '/' . $this->_namespace . '/' . $className . '.php'; |
|
| 999 | + $path = $this->_tmpDir.'/'.$this->_namespace.'/'.$className.'.php'; |
|
| 1000 | 1000 | $classTest = file_get_contents($path); |
| 1001 | 1001 | |
| 1002 | 1002 | $this->_generator->setRegenerateEntityIfExists(true); |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 1006 | 1006 | $classNew = file_get_contents($path); |
| 1007 | 1007 | |
| 1008 | - $this->assertSame($classTest,$classNew); |
|
| 1008 | + $this->assertSame($classTest, $classNew); |
|
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | public function testGenerateMethodsTypeHinting() |
@@ -1079,19 +1079,19 @@ discard block |
||
| 1079 | 1079 | $this->_generator->setGenerateMethodsTypeHinting(true); |
| 1080 | 1080 | |
| 1081 | 1081 | $metadata = $this->generateEntityTypeFixture($field); |
| 1082 | - $path = $this->_tmpDir . '/'. $this->_namespace . '/EntityType.php'; |
|
| 1082 | + $path = $this->_tmpDir.'/'.$this->_namespace.'/EntityType.php'; |
|
| 1083 | 1083 | |
| 1084 | 1084 | $this->assertFileExists($path); |
| 1085 | 1085 | require_once $path; |
| 1086 | 1086 | |
| 1087 | - $type = $field['phpType']; |
|
| 1087 | + $type = $field['phpType']; |
|
| 1088 | 1088 | if ('\\' === $type[0]) { |
| 1089 | 1089 | $type = substr($type, 1); |
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | 1092 | $name = $field['fieldName']; |
| 1093 | - $getter = "get" . ucfirst($name); |
|
| 1094 | - $setter = "set" . ucfirst($name); |
|
| 1093 | + $getter = "get".ucfirst($name); |
|
| 1094 | + $setter = "set".ucfirst($name); |
|
| 1095 | 1095 | |
| 1096 | 1096 | $reflMethod = new \ReflectionMethod($metadata->name, $setter); |
| 1097 | 1097 | $parameters = $reflMethod->getParameters(); |