Completed
Branch feature/pre-split (0a985a)
by Anton
05:37
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/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/Entities/RecordSelector.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
      *
293 293
      * @param array|null $query
294 294
      *
295
-     * @return EntityInterface|null
295
+     * @return null|RecordInterface
296 296
      */
297 297
     public function findOne(array $query = null)
298 298
     {
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
      * order to cache request data.
311 311
      *
312 312
      * @param string                      $cacheKey
313
-     * @param int|\DateInterval           $ttl
313
+     * @param integer           $ttl
314 314
      * @param CacheItemPoolInterface|null $pool
315 315
      *
316 316
      * @return RecordIterator|RecordInterface[]
Please login to merge, or discard this patch.
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/Entities/Relations/BelongsToRelation.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
              * Particular case when parent entity exists but now saved yet AND outer key is PK.
79 79
              * Promised by previous command.
80 80
              */
81
-            $related->onExecute(function (ContextualCommandInterface $related) use ($command) {
81
+            $related->onExecute(function(ContextualCommandInterface $related) use ($command) {
82 82
                 //Giving our child our context in a form of FK value
83 83
                 $command->addContext(
84 84
                     $this->key(Record::INNER_KEY),
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
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
              * Particular case when parent entity exists but now saved yet AND outer key is PK.
95 95
              * Basically inversed case of BELONGS_TO.
96 96
              */
97
-            $command->onExecute(function (ContextualCommandInterface $command) use ($inner) {
97
+            $command->onExecute(function(ContextualCommandInterface $command) use ($inner) {
98 98
                 $inner->addContext(
99 99
                     $this->schema[Record::OUTER_KEY],
100 100
                     $command->primaryKey()
Please login to merge, or discard this patch.