@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | #[ReadOperation] |
341 | 341 | public function loadRelations($entity, $relations): void |
342 | 342 | { |
343 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
343 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
344 | 344 | $this->relation($relationName)->loadIfNotLoaded( |
345 | 345 | new SingleEntityIndexer($this->mapper, $entity), |
346 | 346 | $meta['relations'], |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | #[ReadOperation] |
364 | 364 | public function reloadRelations($entity, $relations): void |
365 | 365 | { |
366 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
366 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
367 | 367 | $this->relation($relationName)->load( |
368 | 368 | new SingleEntityIndexer($this->mapper, $entity), |
369 | 369 | $meta['relations'], |
@@ -403,9 +403,9 @@ discard block |
||
403 | 403 | #[WriteOperation] |
404 | 404 | public function saveAll($entity, $relations): int |
405 | 405 | { |
406 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
406 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
407 | 407 | |
408 | - return $this->transaction(function () use ($entity, $relations) { |
|
408 | + return $this->transaction(function() use ($entity, $relations) { |
|
409 | 409 | $nb = $this->save($entity); |
410 | 410 | |
411 | 411 | foreach ($relations as $relationName => $info) { |
@@ -422,9 +422,9 @@ discard block |
||
422 | 422 | #[WriteOperation] |
423 | 423 | public function deleteAll($entity, $relations): int |
424 | 424 | { |
425 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
425 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
426 | 426 | |
427 | - return $this->transaction(function () use ($entity, $relations) { |
|
427 | + return $this->transaction(function() use ($entity, $relations) { |
|
428 | 428 | $nb = $this->delete($entity); |
429 | 429 | |
430 | 430 | foreach ($relations as $relationName => $info) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | return ''; |
39 | 39 | } |
40 | 40 | |
41 | - return 'namespace ' . $namespace . ';'; |
|
41 | + return 'namespace '.$namespace.';'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $out = ''; |
55 | 55 | |
56 | 56 | foreach ($names as $property) { |
57 | - $out .= $visibility.' $' . $property . ';'.$this->eol; |
|
57 | + $out .= $visibility.' $'.$property.';'.$this->eol; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $out; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function simpleConstructor($properties) |
71 | 71 | { |
72 | - $parameters = implode(', ', array_map(function ($p) { |
|
72 | + $parameters = implode(', ', array_map(function($p) { |
|
73 | 73 | return '$'.$p; |
74 | 74 | }, $properties)); |
75 | 75 | $content = ''; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $content .= $this->eol; |
80 | 80 | } |
81 | 81 | |
82 | - $content .= '$this->' . $property . ' = $' . $property . ';'; |
|
82 | + $content .= '$this->'.$property.' = $'.$property.';'; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | { |
104 | 104 | $spaces = str_repeat($this->tab, $tabs); |
105 | 105 | |
106 | - return $spaces . str_replace($this->eol, $this->eol.$spaces, $code); |
|
106 | + return $spaces.str_replace($this->eol, $this->eol.$spaces, $code); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @return string |
162 | 162 | */ |
163 | - public function switch($varName, array $cases, $default = null) |
|
163 | + public function switch ($varName, array $cases, $default = null) |
|
164 | 164 | { |
165 | 165 | $code = 'switch ('.$varName.') {'.$this->eol; |
166 | 166 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | */ |
37 | 37 | public function __toString() |
38 | 38 | { |
39 | - return (string)$this->value; |
|
39 | + return (string) $this->value; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -51,10 +51,10 @@ |
||
51 | 51 | { |
52 | 52 | if ($this->cacheKey === null) { |
53 | 53 | $this->cacheKey = new CacheKey( |
54 | - function () { |
|
54 | + function() { |
|
55 | 55 | return $this->cacheNamespace(); |
56 | 56 | }, |
57 | - $key ?? function () { |
|
57 | + $key ?? function() { |
|
58 | 58 | return $this->cacheKey(); |
59 | 59 | }, |
60 | 60 | $lifetime |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | $query->joinEntity( |
48 | 48 | $this->distant->entityName(), |
49 | - function (JoinClause $clause) use ($alias, $query) { |
|
49 | + function(JoinClause $clause) use ($alias, $query) { |
|
50 | 50 | $this->buildJoinClause($clause, $query, $alias); |
51 | 51 | }, |
52 | 52 | null, |
@@ -180,21 +180,21 @@ |
||
180 | 180 | if ($default !== null) { |
181 | 181 | switch ($type) { |
182 | 182 | case TypeInterface::BOOLEAN: |
183 | - $default = (bool)$default; |
|
183 | + $default = (bool) $default; |
|
184 | 184 | break; |
185 | 185 | |
186 | 186 | case TypeInterface::TINYINT: |
187 | 187 | case TypeInterface::SMALLINT: |
188 | 188 | case TypeInterface::INTEGER: |
189 | - $default = (int)$default; |
|
189 | + $default = (int) $default; |
|
190 | 190 | break; |
191 | 191 | |
192 | 192 | case TypeInterface::FLOAT: |
193 | - $default = (float)$default; |
|
193 | + $default = (float) $default; |
|
194 | 194 | break; |
195 | 195 | |
196 | 196 | case TypeInterface::DOUBLE: |
197 | - $default = (float)$default; |
|
197 | + $default = (float) $default; |
|
198 | 198 | break; |
199 | 199 | } |
200 | 200 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | #[ReadOperation] |
78 | 78 | public function load($relations) |
79 | 79 | { |
80 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
80 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
81 | 81 | $this->repository->relation($relationName)->load( |
82 | 82 | EntityIndexer::fromArray($this->repository->mapper(), $this->storage->all()), |
83 | 83 | $meta['relations'], |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | #[WriteOperation] |
143 | 143 | public function delete() |
144 | 144 | { |
145 | - $this->repository->transaction(function (RepositoryInterface $repository) { |
|
145 | + $this->repository->transaction(function(RepositoryInterface $repository) { |
|
146 | 146 | /** @var RepositoryInterface&RepositoryEventsSubscriberInterface $repository */ |
147 | 147 | $writer = new BufferedWriter($repository); |
148 | 148 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | #[WriteOperation] |
166 | 166 | public function save() |
167 | 167 | { |
168 | - $this->repository->transaction(function (RepositoryInterface $repository) { |
|
168 | + $this->repository->transaction(function(RepositoryInterface $repository) { |
|
169 | 169 | foreach ($this as $entity) { |
170 | 170 | $repository->save($entity); |
171 | 171 | } |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | #[WriteOperation] |
187 | 187 | public function saveAll($relations) |
188 | 188 | { |
189 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
189 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
190 | 190 | |
191 | - return $this->repository->transaction(function (RepositoryInterface $repository) use ($relations) { |
|
191 | + return $this->repository->transaction(function(RepositoryInterface $repository) use ($relations) { |
|
192 | 192 | $nb = 0; |
193 | 193 | |
194 | 194 | foreach ($this as $entity) { |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | #[WriteOperation] |
216 | 216 | public function deleteAll($relations) |
217 | 217 | { |
218 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
218 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
219 | 219 | |
220 | - return $this->repository->transaction(function (RepositoryInterface $repository) use ($relations) { |
|
220 | + return $this->repository->transaction(function(RepositoryInterface $repository) use ($relations) { |
|
221 | 221 | $nb = 0; |
222 | 222 | |
223 | 223 | foreach ($this as $entity) { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | throw new \LogicException('Custom mode should only used with callable callback'); |
230 | 230 | } |
231 | 231 | |
232 | - $groupBy = function ($item, $key, $results) use ($groupBy) { |
|
232 | + $groupBy = function($item, $key, $results) use ($groupBy) { |
|
233 | 233 | return $this->getDataFromItem($item, $groupBy); |
234 | 234 | }; |
235 | 235 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | return $items->all(); |
331 | 331 | } |
332 | 332 | |
333 | - return (array)$items; |
|
333 | + return (array) $items; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace Bdf\Prime; |
4 | 4 | |
5 | -require_once __DIR__ . '/_files/BenchData.php'; |
|
5 | +require_once __DIR__.'/_files/BenchData.php'; |
|
6 | 6 | |
7 | 7 | use Bdf\Prime\Bench\BenchData; |
8 | 8 | use Bdf\Prime\Bench\EntityArrayOf; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $entities[] = new EntityNotTypedArray([ |
71 | 71 | 'floats' => $this->randArray('double', self::SCALAR_COUNT), |
72 | 72 | 'booleans' => $this->randArray('boolean', self::SCALAR_COUNT), |
73 | - 'dates' => array_map(function (\DateTime $dateTime) { return $dateTime->format(\DateTime::ISO8601); }, $this->randArray('datetime', self::DATEIME_COUNT)), |
|
73 | + 'dates' => array_map(function(\DateTime $dateTime) { return $dateTime->format(\DateTime::ISO8601); }, $this->randArray('datetime', self::DATEIME_COUNT)), |
|
74 | 74 | ]); |
75 | 75 | } |
76 | 76 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | foreach ($this->notTypedRepository->all() as $entity) { |
106 | 106 | $entity->booleans = array_map('boolval', $entity->booleans); |
107 | 107 | $entity->floats = array_map('doubleval', $entity->floats); |
108 | - $entity->dates = array_map(function ($str) { return \DateTime::createFromFormat(\DateTime::ISO8601, $str); }, $entity->dates); |
|
108 | + $entity->dates = array_map(function($str) { return \DateTime::createFromFormat(\DateTime::ISO8601, $str); }, $entity->dates); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | new EntityNotTypedArray([ |
133 | 133 | 'floats' => $this->randArray('double', self::SCALAR_COUNT), |
134 | 134 | 'booleans' => $this->randArray('boolean', self::SCALAR_COUNT), |
135 | - 'dates' => array_map(function (\DateTime $dateTime) { return $dateTime->format(\DateTime::ISO8601); }, $this->randArray('datetime', self::DATEIME_COUNT)), |
|
135 | + 'dates' => array_map(function(\DateTime $dateTime) { return $dateTime->format(\DateTime::ISO8601); }, $this->randArray('datetime', self::DATEIME_COUNT)), |
|
136 | 136 | ]) |
137 | 137 | ); |
138 | 138 | } |