Failed Conditions
Pull Request — master (#6649)
by Marco
140:45 queued 75:42
created
lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -325,7 +325,7 @@
 block discarded – undo
325 325
      *
326 326
      * @param string $className
327 327
      *
328
-     * @return callable
328
+     * @return \Closure
329 329
      */
330 330
     public function buildEntityTryGet(string $className) : callable
331 331
     {
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             $class->reflFields[$fieldName]->setValue($entity, $value);
222 222
             $this->_uow->setOriginalEntityProperty($oid, $fieldName, $value);
223 223
 
224
-            $this->initializedCollections[$oid . $fieldName] = $value;
224
+            $this->initializedCollections[$oid.$fieldName] = $value;
225 225
         } else if (
226 226
             isset($this->_hints[Query::HINT_REFRESH]) ||
227 227
             isset($this->_hints['fetched'][$parentDqlAlias][$fieldName]) &&
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
             $value->setInitialized(true);
233 233
             $value->unwrap()->clear();
234 234
 
235
-            $this->initializedCollections[$oid . $fieldName] = $value;
235
+            $this->initializedCollections[$oid.$fieldName] = $value;
236 236
         } else {
237 237
             // Is already PersistentCollection, and DON'T REFRESH or FETCH-JOIN!
238
-            $this->existingCollections[$oid . $fieldName] = $value;
238
+            $this->existingCollections[$oid.$fieldName] = $value;
239 239
         }
240 240
 
241 241
         return $value;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
         // anyway, as we need to call `createEntity` with the data
301 301
         // in any case to allow refreshing proxy information, for
302 302
         // example
303
-        if (! $managedEntity) {
303
+        if ( ! $managedEntity) {
304 304
             $entity = $this->_uow->createEntity($className, $data, $this->_hints);
305 305
 
306 306
             $this->trackedWritableEntities[\spl_object_hash($entity)] = true;
@@ -333,19 +333,19 @@  discard block
 block discarded – undo
333 333
         $metadata       = $this->_metadataCache->{$className};
334 334
         $rootEntityName = $metadata->rootEntityName;
335 335
         /* @var $idKeys string[] */
336
-        $idKeys      = [];
336
+        $idKeys = [];
337 337
 
338 338
         // Optimisation if the identifier is not composite.
339 339
         // This entire block can be removed and everything works like before, just with more function calls
340
-        if (! $metadata->isIdentifierComposite) {
340
+        if ( ! $metadata->isIdentifierComposite) {
341 341
             $idKey = $metadata->associationMappings[$metadata->identifier[0]]['joinColumns'][0]['name']
342 342
                 ?? $metadata->identifier[0];
343 343
 
344 344
             /**
345 345
              * @return object|Proxy|null
346 346
              */
347
-            return function (array $data) use ($idKey, $rootEntityName) {
348
-                if (! isset($data[$idKey])) {
347
+            return function(array $data) use ($idKey, $rootEntityName) {
348
+                if ( ! isset($data[$idKey])) {
349 349
                     return null;
350 350
                 }
351 351
 
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
         /**
363 363
          * @return object|Proxy|null
364 364
          */
365
-        return function (array $data) use ($idKeys, $rootEntityName) {
365
+        return function(array $data) use ($idKeys, $rootEntityName) {
366 366
             $idHashData = [];
367 367
 
368 368
             foreach ($idKeys as $idColumn) {
369
-                if (! isset($data[$idColumn])) {
369
+                if ( ! isset($data[$idColumn])) {
370 370
                     return null;
371 371
                 }
372 372
 
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
                 $parentAlias = $this->_rsm->parentAliasMap[$dqlAlias];
421 421
                 // we need the $path to save into the identifier map which entities were already
422 422
                 // seen for this parent-child relationship
423
-                $path = $parentAlias . '.' . $dqlAlias;
423
+                $path = $parentAlias.'.'.$dqlAlias;
424 424
 
425 425
                 // We have a RIGHT JOIN result here. Doctrine cannot hydrate RIGHT JOIN Object-Graphs
426 426
                 if ( ! isset($nonemptyComponents[$parentAlias])) {
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
                     $reflFieldValue = $reflField->getValue($parentObject);
461 461
 
462 462
                     if (isset($nonemptyComponents[$dqlAlias])) {
463
-                        $collKey = $oid . $relationField;
463
+                        $collKey = $oid.$relationField;
464 464
                         if (isset($this->initializedCollections[$collKey])) {
465 465
                             $reflFieldValue = $this->initializedCollections[$collKey];
466 466
                         } else if ( ! isset($this->existingCollections[$collKey])) {
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
                 $entityKey = $this->_rsm->entityMappings[$dqlAlias] ?: 0;
553 553
 
554 554
                 // if this row has a NULL value for the root result id then make it a null result.
555
-                if ( ! isset($nonemptyComponents[$dqlAlias]) ) {
555
+                if ( ! isset($nonemptyComponents[$dqlAlias])) {
556 556
                     if ($this->_rsm->isMixed) {
557 557
                         $result[] = [$entityKey => null];
558 558
                     } else {
@@ -608,13 +608,13 @@  discard block
 block discarded – undo
608 608
             }
609 609
         }
610 610
 
611
-        if ( ! isset($resultKey) ) {
611
+        if ( ! isset($resultKey)) {
612 612
             $this->resultCounter++;
613 613
         }
614 614
 
615 615
         // Append scalar values to mixed result sets
616 616
         if (isset($rowData['scalars'])) {
617
-            if ( ! isset($resultKey) ) {
617
+            if ( ! isset($resultKey)) {
618 618
                 $resultKey = (isset($this->_rsm->indexByMap['scalars']))
619 619
                     ? $row[$this->_rsm->indexByMap['scalars']]
620 620
                     : $this->resultCounter - 1;
@@ -627,19 +627,19 @@  discard block
 block discarded – undo
627 627
 
628 628
         // Append new object to mixed result sets
629 629
         if (isset($rowData['newObjects'])) {
630
-            if ( ! isset($resultKey) ) {
630
+            if ( ! isset($resultKey)) {
631 631
                 $resultKey = $this->resultCounter - 1;
632 632
             }
633 633
 
634 634
 
635
-            $scalarCount = (isset($rowData['scalars'])? count($rowData['scalars']): 0);
635
+            $scalarCount = (isset($rowData['scalars']) ? count($rowData['scalars']) : 0);
636 636
 
637 637
             foreach ($rowData['newObjects'] as $objIndex => $newObject) {
638 638
                 $class  = $newObject['class'];
639 639
                 $args   = $newObject['args'];
640 640
                 $obj    = $class->newInstanceArgs($args);
641 641
 
642
-                if ($scalarCount == 0 && count($rowData['newObjects']) == 1 ) {
642
+                if ($scalarCount == 0 && count($rowData['newObjects']) == 1) {
643 643
                     $result[$resultKey] = $obj;
644 644
 
645 645
                     continue;
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Internal/Hydration/Cache/LazyPropertyMap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Doctrine\ORM\Internal\Hydration\Cache;
5 5
 
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         // Note: the reason why we use dynamic access to create a private-ish property is
17 17
         //       that we do not want this property to be statically defined. If that
18 18
         //       happens, then a consumer of `__get` may access it, and that's no good
19
-        $this->{self::class . "\0callback"} = $instantiate;
19
+        $this->{self::class."\0callback"} = $instantiate;
20 20
     }
21 21
 
22 22
     /**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function __get(string $name)
28 28
     {
29
-        $this->$name = ($this->{self::class . "\0callback"})($name);
29
+        $this->$name = ($this->{self::class."\0callback"})($name);
30 30
 
31 31
         return $this->$name;
32 32
     }
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Internal/Cache/LazyPropertyMapTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace LazyMapTest;
6 6
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
             ->callback
41 41
             ->expects(self::exactly(3))
42 42
             ->method('__invoke')
43
-            ->will(self::returnCallback(function ($name) use (& $count) {
43
+            ->will(self::returnCallback(function($name) use (& $count) {
44 44
                 $count += 1;
45 45
 
46
-                return $name . ' - ' . $count;
46
+                return $name.' - '.$count;
47 47
             }));
48 48
 
49 49
         $this->assertSame('foo - 1', $this->lazyMap->foo);
Please login to merge, or discard this patch.
tests/Doctrine/Performance/Hydration/Cache/LazyPropertyMapBench.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function init() : void
35 35
     {
36
-        $this->initializer = function (string $name) : stdClass {
36
+        $this->initializer = function(string $name) : stdClass {
37 37
             return (object) [$name => true];
38 38
         };
39 39
         $this->lazyMap     = new LazyPropertyMap($this->initializer);
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 
61 61
     public function benchUninitializedPropertyAccess() : stdClass
62 62
     {
63
-        $key = 'key' . $this->currentKey++;
63
+        $key = 'key'.$this->currentKey++;
64 64
 
65 65
         return $this->lazyMap->$key;
66 66
     }
67 67
 
68 68
     public function benchUninitializedArrayAccess() : stdClass
69 69
     {
70
-        $key = 'key' . $this->currentKey++;
70
+        $key = 'key'.$this->currentKey++;
71 71
 
72 72
         return $this->array[$key] ?? $this->array[$key] = ($this->initializer)($key);
73 73
     }
Please login to merge, or discard this patch.