Completed
Branch feature/pre-split (4ff102)
by Anton
03:27
created
source/Spiral/ORM/Entities/Loaders/RootLoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
      */
79 79
     public function primaryKey(): string
80 80
     {
81
-        return $this->getAlias() . '.' . $this->schema[Record::SH_PRIMARY_KEY];
81
+        return $this->getAlias().'.'.$this->schema[Record::SH_PRIMARY_KEY];
82 82
     }
83 83
 
84 84
     /**
Please login to merge, or discard this patch.
source/Spiral/ORM/RecordEntity.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
      *
100 100
      * @see Record::INDEXES
101 101
      */
102
-    const INDEX  = 1000;            //Default index type
103
-    const UNIQUE = 2000;            //Unique index definition
102
+    const INDEX  = 1000; //Default index type
103
+    const UNIQUE = 2000; //Unique index definition
104 104
 
105 105
     /*
106 106
      * ================================================
@@ -307,11 +307,11 @@  discard block
 block discarded – undo
307 307
         $this->dispatch('insert', new RecordEvent($this, $command));
308 308
 
309 309
         //Executed when transaction successfully completed
310
-        $command->onComplete(function (InsertCommand $command) {
310
+        $command->onComplete(function(InsertCommand $command) {
311 311
             $this->handleInsert($command);
312 312
         });
313 313
 
314
-        $command->onRollBack(function () {
314
+        $command->onRollBack(function() {
315 315
             //Flushing existed insert command to prevent collisions
316 316
             $this->firstInsert = null;
317 317
         });
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         );
333 333
 
334 334
         if (!empty($this->firstInsert)) {
335
-            $this->firstInsert->onExecute(function (InsertCommand $insert) use ($command) {
335
+            $this->firstInsert->onExecute(function(InsertCommand $insert) use ($command) {
336 336
                 //Sync primary key values
337 337
                 $command->setWhere([$this->primaryColumn() => $insert->getInsertID()]);
338 338
             });
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         $this->dispatch('update', new RecordEvent($this));
344 344
 
345 345
         //Executed when transaction successfully completed
346
-        $command->onComplete(function (UpdateCommand $command) {
346
+        $command->onComplete(function(UpdateCommand $command) {
347 347
             $this->handleUpdate($command);
348 348
         });
349 349
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
         );
362 362
 
363 363
         if (!empty($this->firstInsert)) {
364
-            $this->firstInsert->onExecute(function (InsertCommand $insert) use ($command) {
364
+            $this->firstInsert->onExecute(function(InsertCommand $insert) use ($command) {
365 365
                 //Sync primary key values
366 366
                 $command->setWhere([$this->primaryColumn() => $insert->getInsertID()]);
367 367
             });
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $this->dispatch('delete', new RecordEvent($this));
373 373
 
374 374
         //Executed when transaction successfully completed
375
-        $command->onComplete(function (DeleteCommand $command) {
375
+        $command->onComplete(function(DeleteCommand $command) {
376 376
             $this->handleDelete($command);
377 377
         });
378 378
 
Please login to merge, or discard this patch.
source/Spiral/ORM/Entities/RelationMap.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      * $post = new Post();
227 227
      * $post->user = new User();
228 228
      *
229
-     * @return RelationInterface[]|\Generator
229
+     * @return \Generator
230 230
      */
231 231
     protected function leadingRelations()
232 232
     {
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      * $post = new Post();
246 246
      * $post->comments->add(new Comment());
247 247
      *
248
-     * @return RelationInterface[]|\Generator
248
+     * @return \Generator
249 249
      */
250 250
     protected function dependedRelations()
251 251
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@
 block discarded – undo
212 212
             $class = (new \ReflectionClass($accessor->getClass()))->getShortName();
213 213
 
214 214
             //[+] for loaded, [~] for lazy loaded
215
-            $relations[$relation] = $type . '(' . $class . ') [' . ($accessor->isLoaded() ? '+]' : '~]');
215
+            $relations[$relation] = $type.'('.$class.') ['.($accessor->isLoaded() ? '+]' : '~]');
216 216
         }
217 217
 
218 218
         return $relations;
Please login to merge, or discard this patch.
source/Spiral/Database/Drivers/Postgres/Schemas/PostgresColumn.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 
269 269
         //Dropping enum constrain before any operation
270 270
         if ($initial->abstractType() == 'enum' && $this->constrained) {
271
-            $operations[] = 'DROP CONSTRAINT ' . $driver->identifier($this->enumConstraint());
271
+            $operations[] = 'DROP CONSTRAINT '.$driver->identifier($this->enumConstraint());
272 272
         }
273 273
 
274 274
         //Default value set and dropping
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
         //Nullable option
284 284
         if ($initial->nullable != $this->nullable) {
285
-            $operations[] = "ALTER COLUMN {$identifier} " . (!$this->nullable ? 'SET' : 'DROP') . ' NOT NULL';
285
+            $operations[] = "ALTER COLUMN {$identifier} ".(!$this->nullable ? 'SET' : 'DROP').' NOT NULL';
286 286
         }
287 287
 
288 288
         if ($this->abstractType() == 'enum') {
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             }
293 293
 
294 294
             $operations[] = "ADD CONSTRAINT {$driver->identifier($this->enumConstraint())} "
295
-                . "CHECK ({$identifier} IN (" . implode(', ', $enumValues) . '))';
295
+                . "CHECK ({$identifier} IN (".implode(', ', $enumValues).'))';
296 296
         }
297 297
 
298 298
         return $operations;
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     protected function quoteEnum(Driver $driver): string
305 305
     {
306 306
         //Postgres enums are just constrained strings
307
-        return '(' . $this->size . ')';
307
+        return '('.$this->size.')';
308 308
     }
309 309
 
310 310
     /**
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
     private function enumConstraint(): string
316 316
     {
317 317
         if (empty($this->constrainName)) {
318
-            $this->constrainName = $this->table . '_' . $this->getName() . '_enum_' . uniqid();
318
+            $this->constrainName = $this->table.'_'.$this->getName().'_enum_'.uniqid();
319 319
         }
320 320
 
321 321
         return $this->constrainName;
@@ -419,11 +419,11 @@  discard block
 block discarded – undo
419 419
 
420 420
         $constraints = $driver->query($query, [
421 421
             $tableOID,
422
-            '(' . $column->name . '%',
423
-            '("' . $column->name . '%',
422
+            '('.$column->name.'%',
423
+            '("'.$column->name.'%',
424 424
             //Postgres magic
425
-            $column->name . '::text%',
426
-            '%(' . $column->name . ')::text%'
425
+            $column->name.'::text%',
426
+            '%('.$column->name.')::text%'
427 427
         ]);
428 428
 
429 429
         foreach ($constraints as $constraint) {
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
      */
454 454
     private static function resolveEnum(Driver $driver, PostgresColumn $column)
455 455
     {
456
-        $range = $driver->query('SELECT enum_range(NULL::' . $column->type . ')')->fetchColumn(0);
456
+        $range = $driver->query('SELECT enum_range(NULL::'.$column->type.')')->fetchColumn(0);
457 457
 
458 458
         $column->enumValues = explode(',', substr($range, 1, -1));
459 459
 
Please login to merge, or discard this patch.
source/Spiral/ORM/Commands/InsertCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
      */
55 55
     public function execute()
56 56
     {
57
-        $this->insertID = $this->table->insertOne($this->context +  $this->data);
57
+        $this->insertID = $this->table->insertOne($this->context + $this->data);
58 58
         parent::execute();
59 59
     }
60 60
 }
Please login to merge, or discard this patch.
source/Spiral/ORM/Entities/Relations/BelongsToRelation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
             /**
90 90
              * Particular case when parent entity exists but now saved yet AND outer key is PK.
91 91
              */
92
-            $leadingCommand->onExecute(function (InsertCommand $related) use ($command) {
92
+            $leadingCommand->onExecute(function(InsertCommand $related) use ($command) {
93 93
                 $command->addContext($this->schema[Record::INNER_KEY], $related->getInsertID());
94 94
             });
95 95
         } elseif ($this->changed) {
Please login to merge, or discard this patch.
source/Spiral/ORM/Entities/Relations/HasOneRelation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
              *
103 103
              * Basically inversed case of BELONGS_TO.
104 104
              */
105
-            $command->onExecute(function (InsertCommand $command) use ($related) {
105
+            $command->onExecute(function(InsertCommand $command) use ($related) {
106 106
                 $related->addContext($this->schema[Record::OUTER_KEY], $command->getInsertID());
107 107
             });
108 108
         } elseif ($this->changed) {
Please login to merge, or discard this patch.
source/Spiral/ORM/Entities/Relations/SingularRelation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
             }
108 108
         } elseif (!is_a($value, $this->class, false)) {
109 109
             throw new RelationException(
110
-                "Must be an instance of '{$this->class}', '" . get_class($value) . "' given"
110
+                "Must be an instance of '{$this->class}', '".get_class($value)."' given"
111 111
             );
112 112
         }
113 113
     }
Please login to merge, or discard this patch.
source/Spiral/ORM/EntityMap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
             return null;
108 108
         }
109 109
 
110
-        return $this->entities[$class . '.' . $identity];
110
+        return $this->entities[$class.'.'.$identity];
111 111
     }
112 112
 
113 113
     /**
Please login to merge, or discard this patch.