Completed
Branch feature/pre-split (b75444)
by Anton
10:44
created
source/Spiral/ORM/Entities/Relations/HasManyRelation.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@
 block discarded – undo
187 187
      * Delete multiple records, strict compaction, make sure exactly same instance is given. Method
188 188
      * would not autoload instance and will mark it as partial.
189 189
      *
190
-     * @param array|\Traversable $records
190
+     * @param RecordInterface[] $records
191 191
      */
192 192
     public function deleteMultiple($records)
193 193
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -371,7 +371,7 @@
 block discarded – undo
371 371
                  * Particular case when parent entity exists but now saved yet AND outer key is PK.
372 372
                  * Basically inversed case of BELONGS_TO.
373 373
                  */
374
-                $command->onExecute(function (ContextualCommandInterface $command) use ($inner) {
374
+                $command->onExecute(function(ContextualCommandInterface $command) use ($inner) {
375 375
                     $inner->addContext($this->schema[Record::OUTER_KEY], $command->primaryKey());
376 376
                 });
377 377
             } else {
Please login to merge, or discard this patch.
source/Spiral/ORM/RecordEntity.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
      *
98 98
      * @see Record::INDEXES
99 99
      */
100
-    const INDEX  = 1000;            //Default index type
101
-    const UNIQUE = 2000;            //Unique index definition
100
+    const INDEX  = 1000; //Default index type
101
+    const UNIQUE = 2000; //Unique index definition
102 102
 
103 103
     /*
104 104
      * ================================================
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
         $this->dispatch('insert', new RecordEvent($this, $command));
303 303
 
304 304
         //Executed when transaction successfully completed
305
-        $command->onComplete(function (InsertCommand $command) {
305
+        $command->onComplete(function(InsertCommand $command) {
306 306
             $this->handleInsert($command);
307 307
         });
308 308
 
309
-        $command->onRollBack(function () {
309
+        $command->onRollBack(function() {
310 310
             //Flushing existed insert command to prevent collisions
311 311
             $this->lastInsert = null;
312 312
             $this->state = ORMInterface::STATE_NEW;
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         );
330 330
 
331 331
         if (!empty($this->lastInsert)) {
332
-            $this->lastInsert->onExecute(function (InsertCommand $insert) use ($command) {
332
+            $this->lastInsert->onExecute(function(InsertCommand $insert) use ($command) {
333 333
                 //Sync primary key values
334 334
                 $command->setWhere([$this->primaryColumn() => $insert->getInsertID()]);
335 335
                 $command->setPrimaryKey($insert->getInsertID());
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
         $this->dispatch('update', new RecordEvent($this));
342 342
 
343 343
         //Executed when transaction successfully completed
344
-        $command->onComplete(function (UpdateCommand $command) {
344
+        $command->onComplete(function(UpdateCommand $command) {
345 345
             $this->handleUpdate($command);
346 346
         });
347 347
 
348
-        $command->onRollBack(function () {
348
+        $command->onRollBack(function() {
349 349
             //Flushing existed insert command to prevent collisions
350 350
             $this->state = ORMInterface::STATE_LOADED;
351 351
         });
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 
366 366
         if (!empty($this->lastInsert)) {
367 367
             //Sync primary key values
368
-            $this->lastInsert->onExecute(function (InsertCommand $insert) use ($command) {
368
+            $this->lastInsert->onExecute(function(InsertCommand $insert) use ($command) {
369 369
                 $command->setWhere([$this->primaryColumn() => $insert->primaryKey()]);
370 370
             });
371 371
         }
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         $this->dispatch('delete', new RecordEvent($this));
376 376
 
377 377
         //Executed when transaction successfully completed
378
-        $command->onComplete(function (DeleteCommand $command) {
378
+        $command->onComplete(function(DeleteCommand $command) {
379 379
             $this->handleDelete($command);
380 380
         });
381 381
 
Please login to merge, or discard this patch.
source/Spiral/ORM/Entities/Relations/AbstractRelation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -165,11 +165,11 @@
 block discarded – undo
165 165
             }
166 166
         } elseif (!is_object($value)) {
167 167
             throw new RelationException(
168
-                "Must be an instance of '{$this->class}', '" . gettype($value) . "' given"
168
+                "Must be an instance of '{$this->class}', '".gettype($value)."' given"
169 169
             );
170 170
         } elseif (!is_a($value, $this->class, false)) {
171 171
             throw new RelationException(
172
-                "Must be an instance of '{$this->class}', '" . get_class($value) . "' given"
172
+                "Must be an instance of '{$this->class}', '".get_class($value)."' given"
173 173
             );
174 174
         }
175 175
     }
Please login to merge, or discard this patch.
source/Spiral/ORM/AbstractRecord.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -224,7 +224,7 @@
 block discarded – undo
224 224
      */
225 225
     public function __toString()
226 226
     {
227
-        return static::class . '#' . hash('crc32', spl_object_hash($this));
227
+        return static::class.'#'.hash('crc32', spl_object_hash($this));
228 228
     }
229 229
 
230 230
     /**
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
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
                 );
83 83
             } else {
84 84
                 //Syncing using promise
85
-                $related->onExecute(function (ContextualCommandInterface $related) use ($command) {
85
+                $related->onExecute(function(ContextualCommandInterface $related) use ($command) {
86 86
                     //Giving our child our context in a form of FK value
87 87
                     $command->addContext($this->key(Record::INNER_KEY), $related->primaryKey());
88 88
                 });
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
@@ -371,7 +371,7 @@
 block discarded – undo
371 371
                  * Particular case when parent entity exists but now saved yet AND outer key is PK.
372 372
                  * Basically inversed case of BELONGS_TO.
373 373
                  */
374
-                $command->onExecute(function (ContextualCommandInterface $command) use ($inner) {
374
+                $command->onExecute(function(ContextualCommandInterface $command) use ($inner) {
375 375
                     $inner->addContext($this->schema[Record::OUTER_KEY], $command->primaryKey());
376 376
                 });
377 377
             } else {
Please login to merge, or discard this patch.
source/Spiral/Database/Entities/QueryCompiler.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     {
321 321
         $statement = '';
322 322
         foreach ($joinTokens as $table => $join) {
323
-            $statement .= "\n" . $join['type'] . ' JOIN ' . $this->quote($table, true);
323
+            $statement .= "\n".$join['type'].' JOIN '.$this->quote($table, true);
324 324
             $statement .= $this->optional("\n    ON", $this->compileWhere($join['on']));
325 325
         }
326 326
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
                 throw new CompilerException("Invalid sorting direction, only ASC and DESC are allowed");
373 373
             }
374 374
 
375
-            $result[] = $this->quote($order[0]) . ' ' . $direction;
375
+            $result[] = $this->quote($order[0]).' '.$direction;
376 376
         }
377 377
 
378 378
         return implode(', ', $result);
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
             $prefix .= ' ';
539 539
         }
540 540
 
541
-        return $prefix . $expression . $postfix;
541
+        return $prefix.$expression.$postfix;
542 542
     }
543 543
 
544 544
     /**
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
     {
598 598
         if ($context instanceof QueryBuilder) {
599 599
             //Nested queries has to be wrapped with braces
600
-            return '(' . $context->sqlStatement($this) . ')';
600
+            return '('.$context->sqlStatement($this).')';
601 601
         }
602 602
 
603 603
         if ($context instanceof ExpressionInterface) {
Please login to merge, or discard this patch.
source/Spiral/ORM/EntityMap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
         }
63 63
 
64 64
         if (empty($entity->primaryKey())) {
65
-            throw new MapException("Unable to store non identified entity " . get_class($entity));
65
+            throw new MapException("Unable to store non identified entity ".get_class($entity));
66 66
         }
67 67
 
68
-        $cacheID = get_class($entity) . ':' . $entity->primaryKey();
68
+        $cacheID = get_class($entity).':'.$entity->primaryKey();
69 69
 
70 70
         return $this->entities[$cacheID] = $entity;
71 71
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function forget(RecordInterface $entity)
79 79
     {
80
-        $cacheID = get_class($entity) . ':' . $entity->primaryKey();
80
+        $cacheID = get_class($entity).':'.$entity->primaryKey();
81 81
         unset($this->entities[$cacheID]);
82 82
     }
83 83
 
Please login to merge, or discard this patch.
source/Spiral/ORM/Schemas/SchemaLocator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 
61 61
             $schemas[] = $this->container->get(FactoryInterface::class)->make(
62 62
                 RecordSchema::class,
63
-                ['reflection' => new ReflectionEntity($class['name']),]
63
+                ['reflection' => new ReflectionEntity($class['name']), ]
64 64
             );
65 65
         }
66 66
 
Please login to merge, or discard this patch.