Passed
Push — develop ( 4f6606...79afb5 )
by nguereza
10:52
created
src/Query/Query.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @param bool $immediate
140 140
      * @return $this
141 141
      */
142
-    public function with(string|array $value, bool $immediate = false): self
142
+    public function with(string | array $value, bool $immediate = false): self
143 143
     {
144 144
         if (!is_array($value)) {
145 145
             $value = [$value];
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      * @param string|Expression|Closure|string[]|Expression[]|Closure[] $columns
169 169
      * @return $this
170 170
      */
171
-    public function groupBy(string|Expression|Closure|array $columns): self
171
+    public function groupBy(string | Expression | Closure | array $columns): self
172 172
     {
173 173
         if (!is_array($columns)) {
174 174
             $columns = [$columns];
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      * @param Closure|null $value
186 186
      * @return $this
187 187
      */
188
-    public function having(string|Expression|Closure $column, Closure $value = null): self
188
+    public function having(string | Expression | Closure $column, Closure $value = null): self
189 189
     {
190 190
         $this->getHavingStatement()->having($column, $value);
191 191
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      * @param Closure|null $value
199 199
      * @return $this
200 200
      */
201
-    public function orHaving(string|Expression|Closure $column, Closure $value = null): self
201
+    public function orHaving(string | Expression | Closure $column, Closure $value = null): self
202 202
     {
203 203
         $this->getHavingStatement()->orHaving($column, $value);
204 204
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      * @return $this
213 213
      */
214 214
     public function orderBy(
215
-        string|Closure|Expression|array $columns,
215
+        string | Closure | Expression | array $columns,
216 216
         string $order = 'ASC'
217 217
     ): self {
218 218
         if (!is_array($columns)) {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      * @param string|string[]|Expression|Expression[]|Closure|Closure[] $columns
263 263
      * @return void
264 264
      */
265
-    protected function select(string|Expression|Closure|array $columns = []): void
265
+    protected function select(string | Expression | Closure | array $columns = []): void
266 266
     {
267 267
         $exp = new ColumnExpression($this->getQueryStatement());
268 268
         if ($columns instanceof Closure) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
  * @class Query
58 58
  * @package Platine\Orm\Query
59 59
  */
60
-class Query extends BaseStatement
61
-{
60
+class Query extends BaseStatement {
62 61
     /**
63 62
      *
64 63
      * @var HavingStatement
@@ -94,8 +93,7 @@  discard block
 block discarded – undo
94 93
      * Create new instance
95 94
      * @param QueryStatement|null $queryStatement
96 95
      */
97
-    public function __construct(QueryStatement $queryStatement = null)
98
-    {
96
+    public function __construct(QueryStatement $queryStatement = null) {
99 97
         parent::__construct($queryStatement);
100 98
         $this->havingStatement = new HavingStatement($this->queryStatement);
101 99
     }
Please login to merge, or discard this patch.
src/Query/EntityQuery.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
     public function get(array $columns = [], bool $primaryColumn = true): ?Entity
149 149
     {
150 150
         $result = $this->query($columns, $primaryColumn)
151
-                       ->fetchAssoc()
152
-                       ->get();
151
+                        ->fetchAssoc()
152
+                        ->get();
153 153
 
154 154
         if ($result === false) {
155 155
             return null;
@@ -298,11 +298,11 @@  discard block
 block discarded – undo
298 298
     }
299 299
 
300 300
 /**
301
-     * Find entities record using primary key values
302
-     * @param mixed ...$ids
303
-     *
304
-     * @return TEntity[]
305
-     */
301
+ * Find entities record using primary key values
302
+ * @param mixed ...$ids
303
+ *
304
+ * @return TEntity[]
305
+ */
306 306
     public function findAll(mixed ...$ids): array
307 307
     {
308 308
         if (is_array($ids[0])) {
@@ -543,6 +543,6 @@  discard block
 block discarded – undo
543 543
     protected function transaction(Closure $callback): mixed
544 544
     {
545 545
         return $this->manager->getConnection()
546
-                             ->transaction($callback);
546
+                                ->transaction($callback);
547 547
     }
548 548
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      * @param string|array<int, string>|array<string, mixed> $names
116 116
      * @return $this
117 117
      */
118
-    public function filter(string|array $names): self
118
+    public function filter(string | array $names): self
119 119
     {
120 120
         if (!is_array($names)) {
121 121
             $names = [$names];
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      */
210 210
     public function delete(bool $force = false, array $tables = []): int
211 211
     {
212
-        return (int) $this->transaction(function (Connection $connection) use ($tables, $force) {
212
+        return (int) $this->transaction(function(Connection $connection) use ($tables, $force) {
213 213
             if (!$force && $this->mapper->hasSoftDelete()) {
214 214
                 return (new Update($connection, $this->mapper->getTable(), $this->queryStatement))
215 215
                         ->set([
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function update(array $columns = []): int
229 229
     {
230
-        return (int) $this->transaction(function (Connection $connection) use ($columns) {
230
+        return (int) $this->transaction(function(Connection $connection) use ($columns) {
231 231
             if ($this->mapper->hasTimestamp()) {
232 232
                 list(, $updatedAtColumn) = $this->mapper->getTimestampColumns();
233 233
                 $columns[$updatedAtColumn] = date($this->manager->getDateFormat());
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
      * @param mixed $value
244 244
      * @return int
245 245
      */
246
-    public function increment(string|array $column, mixed $value = 1): int
246
+    public function increment(string | array $column, mixed $value = 1): int
247 247
     {
248
-        return (int) $this->transaction(function (Connection $connection) use ($column, $value) {
248
+        return (int) $this->transaction(function(Connection $connection) use ($column, $value) {
249 249
             if ($this->mapper->hasTimestamp()) {
250 250
                 list(, $updatedAtColumn) = $this->mapper->getTimestampColumns();
251 251
                 $this->queryStatement->addUpdateColumns([
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
      * @param mixed $value
264 264
      * @return int
265 265
      */
266
-    public function decrement(string|array $column, mixed $value = 1): int
266
+    public function decrement(string | array $column, mixed $value = 1): int
267 267
     {
268
-        return (int) $this->transaction(function (Connection $connection) use ($column, $value) {
268
+        return (int) $this->transaction(function(Connection $connection) use ($column, $value) {
269 269
             if ($this->mapper->hasTimestamp()) {
270 270
                 list(, $updatedAtColumn) = $this->mapper->getTimestampColumns();
271 271
                 $this->queryStatement->addUpdateColumns([
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      *
284 284
      * @return TEntity|null
285 285
      */
286
-    public function find(string|int|float|array $id): ?Entity
286
+    public function find(string | int | float | array $id): ?Entity
287 287
     {
288 288
         if (is_array($id)) {
289 289
             foreach ($id as $pkColumn => $pkValue) {
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
      * @param string|Expression|Closure $column
332 332
      * @return mixed
333 333
      */
334
-    public function column(string|Expression|Closure $column): mixed
334
+    public function column(string | Expression | Closure $column): mixed
335 335
     {
336 336
         (new ColumnExpression($this->queryStatement))->column($column);
337 337
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
      * @return mixed
346 346
      */
347 347
     public function count(
348
-        string|Expression|Closure $column = '*',
348
+        string | Expression | Closure $column = '*',
349 349
         bool $distinct = false
350 350
     ): mixed {
351 351
         (new ColumnExpression($this->queryStatement))->count($column, null, $distinct);
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
      * @return mixed
361 361
      */
362 362
     public function avg(
363
-        string|Expression|Closure $column,
363
+        string | Expression | Closure $column,
364 364
         bool $distinct = false
365 365
     ): mixed {
366 366
         (new ColumnExpression($this->queryStatement))->avg($column, null, $distinct);
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      * @return mixed
376 376
      */
377 377
     public function sum(
378
-        string|Expression|Closure $column,
378
+        string | Expression | Closure $column,
379 379
         bool $distinct = false
380 380
     ): mixed {
381 381
         (new ColumnExpression($this->queryStatement))->sum($column, null, $distinct);
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
      * @param bool $distinct
390 390
      * @return mixed
391 391
      */
392
-    public function min(string|Expression|Closure $column, bool $distinct = false): mixed
392
+    public function min(string | Expression | Closure $column, bool $distinct = false): mixed
393 393
     {
394 394
         (new ColumnExpression($this->queryStatement))->min($column, null, $distinct);
395 395
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
      * @return mixed
404 404
      */
405 405
     public function max(
406
-        string|Expression|Closure $column,
406
+        string | Expression | Closure $column,
407 407
         bool $distinct = false
408 408
     ): mixed {
409 409
         (new ColumnExpression($this->queryStatement))->max($column, null, $distinct);
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
      * @param array<int, mixed>|false $results
470 470
      * @return array<string, \Platine\Orm\Relation\RelationLoader<TEntity>>
471 471
      */
472
-    protected function getRelationLoaders(array|false $results): array
472
+    protected function getRelationLoaders(array | false $results): array
473 473
     {
474 474
         if (empty($this->with) || empty($results)) {
475 475
             return [];
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@
 block discarded – undo
65 65
  * @package Platine\Orm\Query
66 66
  * @template TEntity as Entity
67 67
  */
68
-class EntityQuery extends Query
69
-{
68
+class EntityQuery extends Query {
70 69
     /**
71 70
      *
72 71
      * @var EntityManager<TEntity>
Please login to merge, or discard this patch.
src/Exception/RelationNotFoundException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,6 +38,5 @@
 block discarded – undo
38 38
  * @class RelationNotFoundException
39 39
  * @package Platine\Orm\Exception
40 40
  */
41
-class RelationNotFoundException extends RuntimeException
42
-{
41
+class RelationNotFoundException extends RuntimeException {
43 42
 }
Please login to merge, or discard this patch.
src/Exception/PropertyNotFoundException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,6 +38,5 @@
 block discarded – undo
38 38
  * @class PropertyNotFoundException
39 39
  * @package Platine\Orm\Exception
40 40
  */
41
-class PropertyNotFoundException extends RuntimeException
42
-{
41
+class PropertyNotFoundException extends RuntimeException {
43 42
 }
Please login to merge, or discard this patch.
src/Exception/EntityStateException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,6 +38,5 @@
 block discarded – undo
38 38
  * @class EntityStateException
39 39
  * @package Platine\Orm\Exception
40 40
  */
41
-class EntityStateException extends RuntimeException
42
-{
41
+class EntityStateException extends RuntimeException {
43 42
 }
Please login to merge, or discard this patch.
src/EntityManager.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
  * @package Platine\Orm
59 59
  * @template TEntity as Entity
60 60
  */
61
-class EntityManager
62
-{
61
+class EntityManager {
63 62
     /**
64 63
      * The date format
65 64
      * @var string
@@ -76,8 +75,7 @@  discard block
 block discarded – undo
76 75
      * Create new instance
77 76
      * @param Connection $connection
78 77
      */
79
-    public function __construct(protected Connection $connection)
80
-    {
78
+    public function __construct(protected Connection $connection) {
81 79
         $this->dateFormat = $connection->getDriver()->getDateFormat();
82 80
     }
83 81
 
Please login to merge, or discard this patch.
src/Mapper/EntityMapper.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
         return $this;
222 222
     }
223 223
 
224
-     /**
225
-     * {@inheritedoc}
226
-     * @return EntityMapper<TEntity>
227
-     */
224
+        /**
225
+         * {@inheritedoc}
226
+         * @return EntityMapper<TEntity>
227
+         */
228 228
     public function sequence(string $sequence): self
229 229
     {
230 230
         $this->sequence = $sequence;
@@ -254,10 +254,10 @@  discard block
 block discarded – undo
254 254
         return $this;
255 255
     }
256 256
 
257
-     /**
258
-     * {@inheritedoc}
259
-     * @return EntityMapper<TEntity>
260
-     */
257
+        /**
258
+         * {@inheritedoc}
259
+         * @return EntityMapper<TEntity>
260
+         */
261 261
     public function guarded(array $columns): self
262 262
     {
263 263
         $this->guarded = $columns;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -320,7 +320,7 @@
 block discarded – undo
320 320
     public function relation(string $name): RelationFactory
321 321
     {
322 322
         /** @var RelationFactory<TEntity> $factory */
323
-        $factory = new RelationFactory($name, function ($name, Relation $relation) {
323
+        $factory = new RelationFactory($name, function($name, Relation $relation) {
324 324
             return $this->relations[$name] = $relation;
325 325
         });
326 326
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
  * @template TEntity as \Platine\Orm\Entity
58 58
  * @implements EntityMapperInterface<TEntity>
59 59
  */
60
-class EntityMapper implements EntityMapperInterface
61
-{
60
+class EntityMapper implements EntityMapperInterface {
62 61
     /**
63 62
      * The name of the entity
64 63
      * @var string
@@ -173,8 +172,7 @@  discard block
 block discarded – undo
173 172
      * Create new instance
174 173
      * @param class-string<TEntity> $entityClass
175 174
      */
176
-    public function __construct(protected string $entityClass)
177
-    {
175
+    public function __construct(protected string $entityClass) {
178 176
     }
179 177
 
180 178
     /**
@@ -448,15 +446,13 @@  discard block
 block discarded – undo
448 446
             $primaryKey = $this->getPrimaryKey();
449 447
             $prefix = $this->getName();
450 448
 
451
-            $this->foreignKey = new class ($primaryKey, $prefix) extends ForeignKey
452
-            {
449
+            $this->foreignKey = new class ($primaryKey, $prefix) extends ForeignKey {
453 450
                 /**
454 451
                  *
455 452
                  * @param PrimaryKey<TEntity> $primaryKey
456 453
                  * @param string $prefix
457 454
                  */
458
-                public function __construct(PrimaryKey $primaryKey, string $prefix)
459
-                {
455
+                public function __construct(PrimaryKey $primaryKey, string $prefix) {
460 456
                     /** @var array<string, string> $columns */
461 457
                     $columns = [];
462 458
 
@@ -475,8 +471,7 @@  discard block
 block discarded – undo
475 471
      *
476 472
      * @return callable|null
477 473
      */
478
-    public function getPrimaryKeyGenerator()
479
-    {
474
+    public function getPrimaryKeyGenerator() {
480 475
         return $this->primaryKeyGenerator;
481 476
     }
482 477
 
Please login to merge, or discard this patch.