@@ -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 | ]; |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | private function getConnectionParameters(string $connectionName): array |
| 115 | 115 | { |
| 116 | 116 | if (!isset($this->parametersMap[$connectionName])) { |
| 117 | - throw new DBALException('Connection name "' . $connectionName . '" is not set'); |
|
| 117 | + throw new DBALException('Connection name "'.$connectionName.'" is not set'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $parameters = $this->parametersMap[$connectionName]; |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function __construct(string $entity, string $field) |
| 17 | 17 | { |
| 18 | - parent::__construct('The field "' . $field . '" is not declared for the entity ' . $entity); |
|
| 18 | + parent::__construct('The field "'.$field.'" is not declared for the entity '.$entity); |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function __construct(string $entityClass, string $message = '', ?Throwable $previous = null) |
| 26 | 26 | { |
| 27 | - parent::__construct($entityClass . ' : ' . $message, 0, $previous); |
|
| 27 | + parent::__construct($entityClass.' : '.$message, 0, $previous); |
|
| 28 | 28 | |
| 29 | 29 | $this->entityClass = $entityClass; |
| 30 | 30 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - throw new HydratorGenerationException($this->className, 'Cannot get the value of property "' . $attribute . '"'); |
|
| 92 | + throw new HydratorGenerationException($this->className, 'Cannot get the value of property "'.$attribute.'"'); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | return $varName.'->set'.ucfirst($attribute).'('.$value.')'; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - throw new HydratorGenerationException($this->className, 'Cannot access to attribute "' . $attribute . '" on write'); |
|
| 121 | + throw new HydratorGenerationException($this->className, 'Cannot access to attribute "'.$attribute.'" on write'); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | } catch (ReflectionException $e) { |
| 167 | - throw new HydratorGenerationException($this->className, 'Cannot access to the property ' . $prop, $e); |
|
| 167 | + throw new HydratorGenerationException($this->className, 'Cannot access to the property '.$prop, $e); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | return true; |
@@ -327,7 +327,7 @@ |
||
| 327 | 327 | return array_unique($classes); |
| 328 | 328 | |
| 329 | 329 | default: |
| 330 | - throw new HydratorGenerationException($this->mapper->getEntityClass(), 'Cannot handle relation type ' . $relation['type']); |
|
| 330 | + throw new HydratorGenerationException($this->mapper->getEntityClass(), 'Cannot handle relation type '.$relation['type']); |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $values = []; |
| 47 | 47 | $attributes = array_flip($attributes); |
| 48 | 48 | |
| 49 | - $privatePrefix = "\0" . get_class($object) . "\0"; |
|
| 49 | + $privatePrefix = "\0".get_class($object)."\0"; |
|
| 50 | 50 | $privatePrefixLen = strlen($privatePrefix); |
| 51 | 51 | |
| 52 | 52 | foreach ((array) $object as $name => $property) { |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | return $this->hydratorsCache[$entityClass]; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $hydrator = static function ($object, array $data) { |
|
| 86 | + $hydrator = static function($object, array $data) { |
|
| 87 | 87 | foreach ($data as $property => $value) { |
| 88 | 88 | try { |
| 89 | 89 | if (isset($object->$property) && $object->$property instanceof ImportableInterface && is_array($value)) { |
| 90 | 90 | $object->$property->import($value); |
| 91 | - } elseif (method_exists($object, 'set' . ucfirst($property))) { |
|
| 92 | - $object->{'set' . ucfirst($property)}($value); |
|
| 91 | + } elseif (method_exists($object, 'set'.ucfirst($property))) { |
|
| 92 | + $object->{'set'.ucfirst($property)}($value); |
|
| 93 | 93 | } elseif (property_exists($object, $property)) { |
| 94 | 94 | $object->$property = $value; |
| 95 | 95 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function hydratorClassName() |
| 127 | 127 | { |
| 128 | - return 'Hydrator_' . str_replace('\\', '_', $this->className); |
|
| 128 | + return 'Hydrator_'.str_replace('\\', '_', $this->className); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function hydratorFullClassName() |
| 137 | 137 | { |
| 138 | - return $this->hydratorNamespace() . '\\' . $this->hydratorClassName(); |
|
| 138 | + return $this->hydratorNamespace().'\\'.$this->hydratorClassName(); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | if (!isset($classes[$class])) { |
| 168 | 168 | $classes[$class] = true; |
| 169 | 169 | |
| 170 | - $property = '__' . str_replace('\\', '_', $class) . '_hydrator'; |
|
| 170 | + $property = '__'.str_replace('\\', '_', $class).'_hydrator'; |
|
| 171 | 171 | $this->embeddedHydrators[$class] = $property; |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | protected function generateEmbeddedHydrate(AttributeInfo $attribute) |
| 274 | 274 | { |
| 275 | 275 | // We can have multiple entity classes for one attribute : morph |
| 276 | - $varName = '$__rel_' . str_replace('.', '_', $attribute->name()); |
|
| 276 | + $varName = '$__rel_'.str_replace('.', '_', $attribute->name()); |
|
| 277 | 277 | |
| 278 | 278 | $hydrators = []; |
| 279 | 279 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | return '$this'; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - return '$this->' . $this->embeddedHydrators[$class]; |
|
| 311 | + return '$this->'.$this->embeddedHydrators[$class]; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | protected function normalizeClassName($className) |
| 322 | 322 | { |
| 323 | - return '\\' . ltrim($className, '\\'); |
|
| 323 | + return '\\'.ltrim($className, '\\'); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -373,11 +373,11 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | if (empty($possiblyNotInitialized)) { |
| 376 | - return 'return [' . implode(', ', $lines) . '];'; |
|
| 376 | + return 'return ['.implode(', ', $lines).'];'; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - return '$values = [' . implode(', ', $lines) . '];' . PHP_EOL . PHP_EOL . |
|
| 380 | - implode(PHP_EOL, $possiblyNotInitialized) . PHP_EOL . PHP_EOL . |
|
| 379 | + return '$values = ['.implode(', ', $lines).'];'.PHP_EOL.PHP_EOL. |
|
| 380 | + implode(PHP_EOL, $possiblyNotInitialized).PHP_EOL.PHP_EOL. |
|
| 381 | 381 | 'return $values;' |
| 382 | 382 | ; |
| 383 | 383 | } |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | $line = ''; |
| 440 | 440 | |
| 441 | 441 | if ($attribute->isEmbedded()) { |
| 442 | - $varName = '$__rel_' . str_replace('.', '_', $attribute->name()); |
|
| 443 | - $line .= '(' . $varName . ' = '.$this->accessor->getter('$object', $attribute->property()) . ") === null ? null : "; |
|
| 442 | + $varName = '$__rel_'.str_replace('.', '_', $attribute->name()); |
|
| 443 | + $line .= '('.$varName.' = '.$this->accessor->getter('$object', $attribute->property()).") === null ? null : "; |
|
| 444 | 444 | |
| 445 | 445 | foreach ($attribute->embedded()->classes() as $class) { |
| 446 | 446 | if ($this->resolver->isImportable($class)) { |
@@ -733,13 +733,13 @@ discard block |
||
| 733 | 733 | */ |
| 734 | 734 | protected function generateExtractOneCaseEmbedded(EmbeddedInfo $embedded) |
| 735 | 735 | { |
| 736 | - $varName = '$__' . str_replace('.', '_', $embedded->path()); |
|
| 736 | + $varName = '$__'.str_replace('.', '_', $embedded->path()); |
|
| 737 | 737 | $code = $this->accessors->embedded($embedded)->getEmbedded($varName, false); |
| 738 | 738 | $className = $embedded->isRoot() ? $this->mapper->getEntityClass() : $embedded->parent()->class(); |
| 739 | 739 | |
| 740 | 740 | return <<<PHP |
| 741 | 741 | try { |
| 742 | -{$this->code->indent($this->code->lines([$code, 'return ' . $varName . ';']), 1)} |
|
| 742 | +{$this->code->indent($this->code->lines([$code, 'return '.$varName.';']), 1)} |
|
| 743 | 743 | } catch (\Error \$e) { |
| 744 | 744 | throw new \Bdf\Prime\Entity\Hydrator\Exception\UninitializedPropertyException('{$className}', '{$embedded->property()}'); |
| 745 | 745 | } |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | ->fullSetter($attribute->property(), '$value', '$__embedded').';' |
| 795 | 795 | ; |
| 796 | 796 | } else { |
| 797 | - $code = $this->accessor->setter('$object', $attribute->property(), '$value', false) . ';'; |
|
| 797 | + $code = $this->accessor->setter('$object', $attribute->property(), '$value', false).';'; |
|
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | // Always surround with try catch because setter can also be typed |