@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | #[ReadOperation] |
| 325 | 325 | public function loadRelations($entity, $relations): void |
| 326 | 326 | { |
| 327 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
| 327 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
| 328 | 328 | $this->relation($relationName)->loadIfNotLoaded( |
| 329 | 329 | new SingleEntityIndexer($this->mapper, $entity), |
| 330 | 330 | $meta['relations'], |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | #[ReadOperation] |
| 348 | 348 | public function reloadRelations($entity, $relations): void |
| 349 | 349 | { |
| 350 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
| 350 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
| 351 | 351 | $this->relation($relationName)->load( |
| 352 | 352 | new SingleEntityIndexer($this->mapper, $entity), |
| 353 | 353 | $meta['relations'], |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | #[WriteOperation] |
| 388 | 388 | public function saveAll($entity, $relations): int |
| 389 | 389 | { |
| 390 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
| 390 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
| 391 | 391 | |
| 392 | 392 | return $this->transaction(function() use($entity, $relations) { |
| 393 | 393 | $nb = $this->save($entity); |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | #[WriteOperation] |
| 407 | 407 | public function deleteAll($entity, $relations): int |
| 408 | 408 | { |
| 409 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
| 409 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
| 410 | 410 | |
| 411 | 411 | return $this->transaction(function() use($entity, $relations) { |
| 412 | 412 | $nb = $this->delete($entity); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | public function setGenerator($generator): void |
| 289 | 289 | { |
| 290 | 290 | if (!is_string($generator) && !$generator instanceof GeneratorInterface) { |
| 291 | - throw new LogicException('Trying to set an invalid generator in "' . get_class($this) . '"'); |
|
| 291 | + throw new LogicException('Trying to set an invalid generator in "'.get_class($this).'"'); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | $this->generator = $generator; |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | $relations = $this->relations(); |
| 515 | 515 | |
| 516 | 516 | if (!isset($relations[$relationName])) { |
| 517 | - throw new RelationNotFoundException('Relation "' . $relationName . '" is not set in ' . $this->metadata->entityName); |
|
| 517 | + throw new RelationNotFoundException('Relation "'.$relationName.'" is not set in '.$this->metadata->entityName); |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | return $relations[$relationName]; |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | */ |
| 689 | 689 | public function scopes() |
| 690 | 690 | { |
| 691 | - throw new LogicException('No scopes have been defined in "' . get_class($this) . '"'); |
|
| 691 | + throw new LogicException('No scopes have been defined in "'.get_class($this).'"'); |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | /** |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | $attributePath = $attribute; |
| 891 | 891 | $path = null; |
| 892 | 892 | } else { |
| 893 | - $attributePath = $embeddedMeta['path'] . '.' . $attribute; |
|
| 893 | + $attributePath = $embeddedMeta['path'].'.'.$attribute; |
|
| 894 | 894 | $path = $embeddedMeta['path']; |
| 895 | 895 | } |
| 896 | 896 | |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | |
| 945 | 945 | $this->sequence = [ |
| 946 | 946 | 'connection' => $sequence['connection'] ?? $this->connection, |
| 947 | - 'table' => $sequence['table'] ?? $this->table . '_seq', |
|
| 947 | + 'table' => $sequence['table'] ?? $this->table.'_seq', |
|
| 948 | 948 | 'column' => $sequence['column'] ?? 'id', |
| 949 | 949 | 'options' => $sequence['tableOptions'] ?? [], |
| 950 | 950 | ]; |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | $body = str_replace('<spaces>', $this->spaces, $body); |
| 387 | 387 | $last = strrpos($currentCode, '}'); |
| 388 | 388 | |
| 389 | - return substr($currentCode, 0, $last) . $body . (strlen($body) > 0 ? "\n" : '') . "}\n"; |
|
| 389 | + return substr($currentCode, 0, $last).$body.(strlen($body) > 0 ? "\n" : '')."}\n"; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | /** |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | protected function generateEntityNamespace(): string |
| 396 | 396 | { |
| 397 | 397 | if ($this->hasNamespace($this->mapperInfo->className())) { |
| 398 | - return 'namespace ' . $this->getNamespace($this->mapperInfo->className()) .';' . "\n\n"; |
|
| 398 | + return 'namespace '.$this->getNamespace($this->mapperInfo->className()).';'."\n\n"; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | return ''; |
@@ -411,18 +411,18 @@ discard block |
||
| 411 | 411 | $use = []; |
| 412 | 412 | |
| 413 | 413 | if ($this->hasNamespace($this->getClassToExtend())) { |
| 414 | - $use[$this->getClassToExtend()] = 'use ' . $this->getClassToExtend() . ';'; |
|
| 414 | + $use[$this->getClassToExtend()] = 'use '.$this->getClassToExtend().';'; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | foreach ($this->interfaces as $interface) { |
| 418 | 418 | if ($this->hasNamespace($interface)) { |
| 419 | - $use[$interface] = 'use ' . $interface . ';'; |
|
| 419 | + $use[$interface] = 'use '.$interface.';'; |
|
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | foreach ($this->traits as $trait) { |
| 424 | 424 | if ($this->hasNamespace($trait)) { |
| 425 | - $use[$trait] = 'use ' . $trait . ';'; |
|
| 425 | + $use[$trait] = 'use '.$trait.';'; |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | |
| 453 | 453 | sort($use); |
| 454 | 454 | |
| 455 | - return implode("\n", $use) . "\n\n"; |
|
| 455 | + return implode("\n", $use)."\n\n"; |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | /** |
@@ -460,9 +460,9 @@ discard block |
||
| 460 | 460 | */ |
| 461 | 461 | protected function generateEntityClassName() |
| 462 | 462 | { |
| 463 | - return 'class ' . $this->getClassName($this->mapperInfo->className()) . |
|
| 464 | - ($this->classToExtend ? ' extends ' . $this->getClassToExtendName() : null) . |
|
| 465 | - ($this->interfaces ? ' implements ' . $this->getInterfacesToImplement() : null); |
|
| 463 | + return 'class '.$this->getClassName($this->mapperInfo->className()). |
|
| 464 | + ($this->classToExtend ? ' extends '.$this->getClassToExtendName() : null). |
|
| 465 | + ($this->interfaces ? ' implements '.$this->getInterfacesToImplement() : null); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
@@ -477,10 +477,10 @@ discard block |
||
| 477 | 477 | $traits = ''; |
| 478 | 478 | |
| 479 | 479 | foreach ($this->traits as $trait) { |
| 480 | - $traits .= $this->spaces . 'use ' . $this->getRelativeClassName($trait) . ';' . "\n"; |
|
| 480 | + $traits .= $this->spaces.'use '.$this->getRelativeClassName($trait).';'."\n"; |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | - return $traits . "\n"; |
|
| 483 | + return $traits."\n"; |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /** |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | { |
| 586 | 586 | $lines = array(); |
| 587 | 587 | $lines[] = '/**'; |
| 588 | - $lines[] = ' * ' . $this->getClassName($this->mapperInfo->className()); |
|
| 588 | + $lines[] = ' * '.$this->getClassName($this->mapperInfo->className()); |
|
| 589 | 589 | $lines[] = ' */'; |
| 590 | 590 | |
| 591 | 591 | return implode("\n", $lines); |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | |
| 686 | 686 | if (!$property->isRelation()) { |
| 687 | 687 | $lines[] = $this->generateEmbeddedPropertyDocBlock($property); |
| 688 | - $lines[] = $this->spaces . $this->fieldVisibility . $this->getPropertyTypeHintForObject($property) . ' $'.$property->name().";\n"; |
|
| 688 | + $lines[] = $this->spaces.$this->fieldVisibility.$this->getPropertyTypeHintForObject($property).' $'.$property->name().";\n"; |
|
| 689 | 689 | } else { |
| 690 | 690 | $name = $property->name(); |
| 691 | 691 | $default = ''; |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | $lines[] = $this->generateEmbeddedPropertyDocBlock($property); |
| 704 | - $lines[] = $this->spaces . $this->fieldVisibility . $this->getPropertyTypeHintForObject($property) . ' $' . $name . $default .";\n"; |
|
| 704 | + $lines[] = $this->spaces.$this->fieldVisibility.$this->getPropertyTypeHintForObject($property).' $'.$name.$default.";\n"; |
|
| 705 | 705 | } |
| 706 | 706 | } |
| 707 | 707 | |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | $variableName = $this->inflector->camelize($fieldName); |
| 730 | 730 | $methodName = $variableName; |
| 731 | 731 | } else { |
| 732 | - $methodName = $type . $this->inflector->classify($fieldName); |
|
| 732 | + $methodName = $type.$this->inflector->classify($fieldName); |
|
| 733 | 733 | $variableName = $this->inflector->camelize($fieldName); |
| 734 | 734 | } |
| 735 | 735 | |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | if ($propertyInfo->isObject()) { |
| 748 | 748 | /** @var ObjectPropertyInfo $propertyInfo */ |
| 749 | 749 | $variableType = $this->getRelativeClassName($propertyInfo->className()); |
| 750 | - $methodTypeHint = $variableType.' '; |
|
| 750 | + $methodTypeHint = $variableType.' '; |
|
| 751 | 751 | } else { |
| 752 | 752 | /** @var PropertyInfo $propertyInfo */ |
| 753 | 753 | $variableType = $propertyInfo->phpType(); |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | '<variableName>' => $variableName, |
| 779 | 779 | '<methodName>' => $methodName, |
| 780 | 780 | '<fieldName>' => $fieldName, |
| 781 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = '.$defaultValue) : '' |
|
| 781 | + '<variableDefault>' => ($defaultValue !== null) ? (' = '.$defaultValue) : '' |
|
| 782 | 782 | ); |
| 783 | 783 | |
| 784 | 784 | $method = str_replace( |
@@ -853,9 +853,9 @@ discard block |
||
| 853 | 853 | protected function generateFieldMappingPropertyDocBlock($property) |
| 854 | 854 | { |
| 855 | 855 | $lines = array(); |
| 856 | - $lines[] = $this->spaces . '/**'; |
|
| 857 | - $lines[] = $this->spaces . ' * @var '.$property->phpType(); |
|
| 858 | - $lines[] = $this->spaces . ' */'; |
|
| 856 | + $lines[] = $this->spaces.'/**'; |
|
| 857 | + $lines[] = $this->spaces.' * @var '.$property->phpType(); |
|
| 858 | + $lines[] = $this->spaces.' */'; |
|
| 859 | 859 | |
| 860 | 860 | return implode("\n", $lines); |
| 861 | 861 | } |
@@ -884,9 +884,9 @@ discard block |
||
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | $lines = array(); |
| 887 | - $lines[] = $this->spaces . '/**'; |
|
| 888 | - $lines[] = $this->spaces . ' * @var '.$className; |
|
| 889 | - $lines[] = $this->spaces . ' */'; |
|
| 887 | + $lines[] = $this->spaces.'/**'; |
|
| 888 | + $lines[] = $this->spaces.' * @var '.$className; |
|
| 889 | + $lines[] = $this->spaces.' */'; |
|
| 890 | 890 | |
| 891 | 891 | return implode("\n", $lines); |
| 892 | 892 | } |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | |
| 928 | 928 | if ($inClass) { |
| 929 | 929 | $inClass = false; |
| 930 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
| 930 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
| 931 | 931 | $this->staticReflection[$lastSeenClass]['properties'] = array(); |
| 932 | 932 | $this->staticReflection[$lastSeenClass]['methods'] = array(); |
| 933 | 933 | } |
@@ -935,16 +935,16 @@ discard block |
||
| 935 | 935 | if ($token[0] == T_NAMESPACE) { |
| 936 | 936 | $lastSeenNamespace = ""; |
| 937 | 937 | $inNamespace = true; |
| 938 | - } elseif ($token[0] == T_CLASS && $tokens[$i-1][0] != T_DOUBLE_COLON) { |
|
| 938 | + } elseif ($token[0] == T_CLASS && $tokens[$i - 1][0] != T_DOUBLE_COLON) { |
|
| 939 | 939 | $inClass = true; |
| 940 | 940 | } elseif ($token[0] == T_FUNCTION) { |
| 941 | - if ($tokens[$i+2][0] == T_STRING) { |
|
| 942 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
| 943 | - } elseif ($tokens[$i+2] == "&" && $tokens[$i+3][0] == T_STRING) { |
|
| 944 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
| 941 | + if ($tokens[$i + 2][0] == T_STRING) { |
|
| 942 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
| 943 | + } elseif ($tokens[$i + 2] == "&" && $tokens[$i + 3][0] == T_STRING) { |
|
| 944 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
| 945 | 945 | } |
| 946 | - } elseif (in_array($token[0], array(T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED)) && $tokens[$i+2][0] != T_FUNCTION) { |
|
| 947 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
| 946 | + } elseif (in_array($token[0], array(T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED)) && $tokens[$i + 2][0] != T_FUNCTION) { |
|
| 947 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
| 948 | 948 | } |
| 949 | 949 | } |
| 950 | 950 | } |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | if ($this->hasNamespace($className)) { |
| 1020 | 1020 | return $this->getClassName($className); |
| 1021 | 1021 | } else { |
| 1022 | - return '\\' . $className; |
|
| 1022 | + return '\\'.$className; |
|
| 1023 | 1023 | } |
| 1024 | 1024 | } |
| 1025 | 1025 | |
@@ -1120,8 +1120,8 @@ discard block |
||
| 1120 | 1120 | $lines = explode("\n", $code); |
| 1121 | 1121 | |
| 1122 | 1122 | foreach ($lines as $key => $value) { |
| 1123 | - if ( ! empty($value)) { |
|
| 1124 | - $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; |
|
| 1123 | + if (!empty($value)) { |
|
| 1124 | + $lines[$key] = str_repeat($this->spaces, $num).$lines[$key]; |
|
| 1125 | 1125 | } |
| 1126 | 1126 | } |
| 1127 | 1127 | |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | if (is_string($value)) { |
| 1153 | - return "'" . $value . "'"; |
|
| 1153 | + return "'".$value."'"; |
|
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | 1156 | if (is_bool($value)) { |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | $type = self::PROPERTY_TYPE_MAP[$type] ?? $type; |
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | - return ($nullable ? '?' : '') . $type; |
|
| 1186 | + return ($nullable ? '?' : '').$type; |
|
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | 1189 | /** |
@@ -1202,7 +1202,7 @@ discard block |
||
| 1202 | 1202 | return ''; |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | - return ' ' . $this->getPropertyTypeHint($property->phpType(), $property->isNullable()); |
|
| 1205 | + return ' '.$this->getPropertyTypeHint($property->phpType(), $property->isNullable()); |
|
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | /** |
@@ -1236,7 +1236,7 @@ discard block |
||
| 1236 | 1236 | } |
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | - return ' ' . $this->getPropertyTypeHint($type, $property->isRelation()); |
|
| 1239 | + return ' '.$this->getPropertyTypeHint($type, $property->isRelation()); |
|
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | //---------------------- mutators |
@@ -1366,7 +1366,7 @@ discard block |
||
| 1366 | 1366 | public function setFieldVisibility(string $visibility): void |
| 1367 | 1367 | { |
| 1368 | 1368 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
| 1369 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
| 1369 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | 1372 | $this->fieldVisibility = $visibility; |