@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @var array{persistent:object[], non-persistent: object[]} |
33 | 33 | */ |
34 | 34 | protected $testPacks = [ |
35 | - 'persistent' => [], // Entités créées non modifiables |
|
35 | + 'persistent' => [], // Entités créées non modifiables |
|
36 | 36 | 'non-persistent' => [] // Entités créées et détruites aprés un test |
37 | 37 | ]; |
38 | 38 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | // On ajoute la classe de l'entité uniquement si elle n'est pas déjà dans le tableau et si le test pack n'a pas démarré de savepoint |
162 | 162 | foreach ($entityClasses as $entityClassName) { |
163 | - if (! in_array($entityClassName, $this->entityClasses)) { |
|
163 | + if (!in_array($entityClassName, $this->entityClasses)) { |
|
164 | 164 | if ($this->initialized) { |
165 | 165 | $this->create([$entityClassName]); |
166 | 166 | } else { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function onInit(callable $callback) |
222 | 222 | { |
223 | - if (! $this->initialized) { |
|
223 | + if (!$this->initialized) { |
|
224 | 224 | $this->once('testpack.initialized', $callback); |
225 | 225 | } |
226 | 226 |
@@ -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]; |
@@ -194,25 +194,25 @@ |
||
194 | 194 | $value = $repository->extractOne($entity, $attribute); |
195 | 195 | |
196 | 196 | if ($isUninitialized) { |
197 | - $this->fail($message . ': Expected attribute "'.$path.'" to be not initialised'); |
|
197 | + $this->fail($message.': Expected attribute "'.$path.'" to be not initialised'); |
|
198 | 198 | } |
199 | 199 | } catch (UninitializedPropertyException $e) { |
200 | 200 | if (!$isUninitialized) { |
201 | - $this->fail($message . ': The attribute "'.$path.'" is not initialised'); |
|
201 | + $this->fail($message.': The attribute "'.$path.'" is not initialised'); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | 205 | if (!is_object($expectedValue)) { |
206 | - $this->assertSame($expectedValue, $value, $message . ': Expected attribute "'.$path.'" is not the same'); |
|
206 | + $this->assertSame($expectedValue, $value, $message.': Expected attribute "'.$path.'" is not the same'); |
|
207 | 207 | continue; |
208 | 208 | } |
209 | 209 | |
210 | 210 | if ($expectedValue instanceof Constraint) { |
211 | - $this->assertThat($value, $expectedValue, $message . ': Expected attribute "'.$path.'" is not the same'); |
|
211 | + $this->assertThat($value, $expectedValue, $message.': Expected attribute "'.$path.'" is not the same'); |
|
212 | 212 | } elseif ($expectedValue instanceof \DateTimeInterface) { |
213 | - $this->assertEqualsWithDelta($expectedValue, $value, $dateTimeDelta, $message . ': Expected attribute "'.$path.'" is not the same'); |
|
213 | + $this->assertEqualsWithDelta($expectedValue, $value, $dateTimeDelta, $message.': Expected attribute "'.$path.'" is not the same'); |
|
214 | 214 | } else { |
215 | - $this->assertEquals($expectedValue, $value, $message . ': Expected attribute "'.$path.'" is not the same'); |
|
215 | + $this->assertEquals($expectedValue, $value, $message.': Expected attribute "'.$path.'" is not the same'); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | } |
@@ -68,15 +68,15 @@ |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * Assert that two array of entities are equal |
|
72 | - * |
|
73 | - * @param array $expectedEntities |
|
74 | - * @param array $actualEntities |
|
75 | - * @param int $dateTimeDelta |
|
76 | - * @param string $message |
|
71 | + * Assert that two array of entities are equal |
|
72 | + * |
|
73 | + * @param array $expectedEntities |
|
74 | + * @param array $actualEntities |
|
75 | + * @param int $dateTimeDelta |
|
76 | + * @param string $message |
|
77 | 77 | * |
78 | 78 | * @throws \Exception |
79 | - */ |
|
79 | + */ |
|
80 | 80 | public function assertEntities($expectedEntities, $actualEntities, $dateTimeDelta = 5, $message = '') |
81 | 81 | { |
82 | 82 | if (is_string($dateTimeDelta)) { |
@@ -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 | } |
@@ -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 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | switch ($platform->name()) { |
51 | 51 | case 'mysql': |
52 | 52 | $connection->executeUpdate('UPDATE '.$metadata->sequence['table'] |
53 | - .' SET '. $metadata->sequence['column'].' = LAST_INSERT_ID('.$metadata->sequence['column'].'+1)'); |
|
53 | + .' SET '.$metadata->sequence['column'].' = LAST_INSERT_ID('.$metadata->sequence['column'].'+1)'); |
|
54 | 54 | return (string) $connection->lastInsertId(); |
55 | 55 | |
56 | 56 | case 'sqlite': |