Failed Conditions
Pull Request — 2.7 (#8027)
by
unknown
07:00
created
lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -213,8 +213,8 @@
 block discarded – undo
213 213
         $this->metadataCache = [];
214 214
 
215 215
         $this->em
216
-             ->getEventManager()
217
-             ->removeEventListener([Events::onClear], $this);
216
+                ->getEventManager()
217
+                ->removeEventListener([Events::onClear], $this);
218 218
     }
219 219
 
220 220
     /**
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $row = $this->stmt->fetch(PDO::FETCH_ASSOC);
145 145
 
146
-        if (! $row) {
146
+        if ( ! $row) {
147 147
             $this->cleanup();
148 148
 
149 149
             return false;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
                         : $value;
287 287
 
288 288
                     if ($cacheKeyInfo['isIdentifier'] && $value !== null) {
289
-                        $id[$dqlAlias]                .= '|' . $value;
289
+                        $id[$dqlAlias]                .= '|'.$value;
290 290
                         $nonemptyComponents[$dqlAlias] = true;
291 291
                     }
292 292
                     break;
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
 
323 323
             // WARNING: BC break! We know this is the desired behavior to type convert values, but this
324 324
             // erroneous behavior exists since 2.0 and we're forced to keep compatibility.
325
-            if (! isset($cacheKeyInfo['isScalar'])) {
325
+            if ( ! isset($cacheKeyInfo['isScalar'])) {
326 326
                 $dqlAlias  = $cacheKeyInfo['dqlAlias'];
327 327
                 $type      = $cacheKeyInfo['type'];
328
-                $fieldName = $dqlAlias . '_' . $fieldName;
328
+                $fieldName = $dqlAlias.'_'.$fieldName;
329 329
                 $value     = $type
330 330
                     ? $type->convertToPHPValue($value, $this->platform)
331 331
                     : $value;
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
      */
432 432
     protected function getClassMetadata($className)
433 433
     {
434
-        if (! isset($this->metadataCache[$className])) {
434
+        if ( ! isset($this->metadataCache[$className])) {
435 435
             $this->metadataCache[$className] = $this->em->getClassMetadata($className);
436 436
         }
437 437
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     protected function prepare()
55 55
     {
56
-        if (! isset($this->hints[UnitOfWork::HINT_DEFEREAGERLOAD])) {
56
+        if ( ! isset($this->hints[UnitOfWork::HINT_DEFEREAGERLOAD])) {
57 57
             $this->hints[UnitOfWork::HINT_DEFEREAGERLOAD] = true;
58 58
         }
59 59
 
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 
64 64
             // Remember which associations are "fetch joined", so that we know where to inject
65 65
             // collection stubs or proxies and where not.
66
-            if (! isset($this->rsm->relationMap[$dqlAlias])) {
66
+            if ( ! isset($this->rsm->relationMap[$dqlAlias])) {
67 67
                 continue;
68 68
             }
69 69
 
70 70
             $parent = $this->rsm->parentAliasMap[$dqlAlias];
71 71
 
72
-            if (! isset($this->rsm->aliasMap[$parent])) {
72
+            if ( ! isset($this->rsm->aliasMap[$parent])) {
73 73
                 throw HydrationException::parentObjectOfRelationNotFound($dqlAlias, $parent);
74 74
             }
75 75
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 $class        = $this->getClassMetadata($className);
96 96
                 $inverseAssoc = $class->getProperty($association->getInversedBy());
97 97
 
98
-                if (! ($inverseAssoc instanceof ToOneAssociationMetadata)) {
98
+                if ( ! ($inverseAssoc instanceof ToOneAssociationMetadata)) {
99 99
                     continue;
100 100
                 }
101 101
 
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
         $value       = $association->getValue($entity);
162 162
         $oid         = spl_object_id($entity);
163 163
 
164
-        if (! $value instanceof PersistentCollection) {
164
+        if ( ! $value instanceof PersistentCollection) {
165 165
             $value = $association->wrap($entity, $value, $this->em);
166 166
 
167 167
             $association->setValue($entity, $value);
168 168
 
169 169
             $this->uow->setOriginalEntityProperty($oid, $fieldName, $value);
170 170
 
171
-            $this->initializedCollections[$oid . $fieldName] = $value;
171
+            $this->initializedCollections[$oid.$fieldName] = $value;
172 172
         } elseif (isset($this->hints[Query::HINT_REFRESH]) ||
173 173
             (isset($this->hints['fetched'][$parentDqlAlias][$fieldName]) && ! $value->isInitialized())
174 174
         ) {
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
             $value->setInitialized(true);
178 178
             $value->unwrap()->clear();
179 179
 
180
-            $this->initializedCollections[$oid . $fieldName] = $value;
180
+            $this->initializedCollections[$oid.$fieldName] = $value;
181 181
         } else {
182 182
             // Is already PersistentCollection, and DON'T REFRESH or FETCH-JOIN!
183
-            $this->existingCollections[$oid . $fieldName] = $value;
183
+            $this->existingCollections[$oid.$fieldName] = $value;
184 184
         }
185 185
 
186 186
         return $value;
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
         if (isset($this->rsm->discriminatorColumns[$dqlAlias])) {
204 204
             $fieldName = $this->rsm->discriminatorColumns[$dqlAlias];
205 205
 
206
-            if (! isset($this->rsm->metaMappings[$fieldName])) {
206
+            if ( ! isset($this->rsm->metaMappings[$fieldName])) {
207 207
                 throw HydrationException::missingDiscriminatorMetaMappingColumn($className, $fieldName, $dqlAlias);
208 208
             }
209 209
 
210 210
             $discrColumn = $this->rsm->metaMappings[$fieldName];
211 211
 
212
-            if (! isset($data[$discrColumn])) {
212
+            if ( ! isset($data[$discrColumn])) {
213 213
                 throw HydrationException::missingDiscriminatorColumn($className, $discrColumn, $dqlAlias);
214 214
             }
215 215
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             $discrMap           = $this->metadataCache[$className]->discriminatorMap;
221 221
             $discriminatorValue = (string) $data[$discrColumn];
222 222
 
223
-            if (! isset($discrMap[$discriminatorValue])) {
223
+            if ( ! isset($discrMap[$discriminatorValue])) {
224 224
                 throw HydrationException::invalidDiscriminatorValue($discriminatorValue, array_keys($discrMap));
225 225
             }
226 226
 
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
                 $parentAlias = $this->rsm->parentAliasMap[$dqlAlias];
297 297
                 // we need the $path to save into the identifier map which entities were already
298 298
                 // seen for this parent-child relationship
299
-                $path = $parentAlias . '.' . $dqlAlias;
299
+                $path = $parentAlias.'.'.$dqlAlias;
300 300
 
301 301
                 // We have a RIGHT JOIN result here. Doctrine cannot hydrate RIGHT JOIN Object-Graphs
302
-                if (! isset($nonemptyComponents[$parentAlias])) {
302
+                if ( ! isset($nonemptyComponents[$parentAlias])) {
303 303
                     // TODO: Add special case code where we hydrate the right join objects into identity map at least
304 304
                     continue;
305 305
                 }
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
                 $oid = spl_object_id($parentObject);
331 331
 
332 332
                 // Check the type of the relation (many or single-valued)
333
-                if (! ($association instanceof ToOneAssociationMetadata)) {
333
+                if ( ! ($association instanceof ToOneAssociationMetadata)) {
334 334
                     // PATH A: Collection-valued association
335 335
                     $reflFieldValue = $association->getValue($parentObject);
336 336
 
337 337
                     if (isset($nonemptyComponents[$dqlAlias])) {
338
-                        $collKey = $oid . $relationField;
338
+                        $collKey = $oid.$relationField;
339 339
                         if (isset($this->initializedCollections[$collKey])) {
340 340
                             $reflFieldValue = $this->initializedCollections[$collKey];
341
-                        } elseif (! isset($this->existingCollections[$collKey])) {
341
+                        } elseif ( ! isset($this->existingCollections[$collKey])) {
342 342
                             $reflFieldValue = $this->initRelatedCollection($parentObject, $parentClass, $relationField, $parentAlias);
343 343
                         }
344 344
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
                         $index        = $indexExists ? $this->identifierMap[$path][$id[$parentAlias]][$id[$dqlAlias]] : false;
347 347
                         $indexIsValid = $index !== false ? isset($reflFieldValue[$index]) : false;
348 348
 
349
-                        if (! $indexExists || ! $indexIsValid) {
349
+                        if ( ! $indexExists || ! $indexIsValid) {
350 350
                             if (isset($this->existingCollections[$collKey])) {
351 351
                                 $element = $this->getEntityFromIdentityMap($entityName, $data);
352 352
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                             // Update result pointer
376 376
                             $this->resultPointers[$dqlAlias] = $reflFieldValue[$index];
377 377
                         }
378
-                    } elseif (! $reflFieldValue) {
378
+                    } elseif ( ! $reflFieldValue) {
379 379
                         $reflFieldValue = $this->initRelatedCollection($parentObject, $parentClass, $relationField, $parentAlias);
380 380
                     } elseif ($reflFieldValue instanceof PersistentCollection && $reflFieldValue->isInitialized() === false) {
381 381
                         $reflFieldValue->setInitialized(true);
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                     // PATH B: Single-valued association
385 385
                     $reflFieldValue = $association->getValue($parentObject);
386 386
 
387
-                    if (! $reflFieldValue || isset($this->hints[Query::HINT_REFRESH]) ||
387
+                    if ( ! $reflFieldValue || isset($this->hints[Query::HINT_REFRESH]) ||
388 388
                         ($reflFieldValue instanceof GhostObjectInterface && ! $reflFieldValue->isProxyInitialized())) {
389 389
                         // we only need to take action if this value is null,
390 390
                         // we refresh the entity or its an uninitialized proxy.
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
                 $entityKey                    = $this->rsm->entityMappings[$dqlAlias] ?: 0;
446 446
 
447 447
                 // if this row has a NULL value for the root result id then make it a null result.
448
-                if (! isset($nonemptyComponents[$dqlAlias])) {
448
+                if ( ! isset($nonemptyComponents[$dqlAlias])) {
449 449
                     if ($this->rsm->isMixed) {
450 450
                         $result[] = [$entityKey => null];
451 451
                     } else {
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
                 }
458 458
 
459 459
                 // check for existing result from the iterations before
460
-                if (! isset($this->identifierMap[$dqlAlias][$id[$dqlAlias]])) {
460
+                if ( ! isset($this->identifierMap[$dqlAlias][$id[$dqlAlias]])) {
461 461
                     $element = $this->getEntity($data, $dqlAlias);
462 462
 
463 463
                     if ($this->rsm->isMixed) {
@@ -500,13 +500,13 @@  discard block
 block discarded – undo
500 500
             }
501 501
         }
502 502
 
503
-        if (! isset($resultKey)) {
503
+        if ( ! isset($resultKey)) {
504 504
             $this->resultCounter++;
505 505
         }
506 506
 
507 507
         // Append scalar values to mixed result sets
508 508
         if (isset($rowData['scalars'])) {
509
-            if (! isset($resultKey)) {
509
+            if ( ! isset($resultKey)) {
510 510
                 $resultKey = (isset($this->rsm->indexByMap['scalars']))
511 511
                     ? $row[$this->rsm->indexByMap['scalars']]
512 512
                     : $this->resultCounter - 1;
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 
520 520
         // Append new object to mixed result sets
521 521
         if (isset($rowData['newObjects'])) {
522
-            if (! isset($resultKey)) {
522
+            if ( ! isset($resultKey)) {
523 523
                 $resultKey = $this->resultCounter - 1;
524 524
             }
525 525
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Internal/Hydration/IterableResult.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,6 +77,6 @@
 block discarded – undo
77 77
      */
78 78
     public function valid()
79 79
     {
80
-        return $this->current!==false;
80
+        return $this->current !== false;
81 81
     }
82 82
 }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Internal/Hydration/HydrationException.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@
 block discarded – undo
40 40
      */
41 41
     public static function emptyDiscriminatorValue($dqlAlias)
42 42
     {
43
-        return new self("The DQL alias '" . $dqlAlias . "' contains an entity " .
44
-            'of an inheritance hierarchy with an empty discriminator value. This means ' .
45
-            'that the database contains inconsistent data with an empty ' .
43
+        return new self("The DQL alias '".$dqlAlias."' contains an entity ".
44
+            'of an inheritance hierarchy with an empty discriminator value. This means '.
45
+            'that the database contains inconsistent data with an empty '.
46 46
             'discriminator value in a table row.');
47 47
     }
48 48
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 $discrColumnName = $metaMappingDiscrColumnName;
84 84
             }
85 85
 
86
-            if (! isset($sqlResult[$discrColumnName])) {
86
+            if ( ! isset($sqlResult[$discrColumnName])) {
87 87
                 throw HydrationException::missingDiscriminatorColumn($entityName, $discrColumnName, key($this->rsm->aliasMap));
88 88
             }
89 89
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
             $discrMap = $this->class->discriminatorMap;
95 95
 
96
-            if (! isset($discrMap[$sqlResult[$discrColumnName]])) {
96
+            if ( ! isset($discrMap[$sqlResult[$discrColumnName]])) {
97 97
                 throw HydrationException::invalidDiscriminatorValue($sqlResult[$discrColumnName], array_keys($discrMap));
98 98
             }
99 99
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
             $cacheKeyInfo = $this->hydrateColumnInfo($column);
112 112
 
113
-            if (! $cacheKeyInfo) {
113
+            if ( ! $cacheKeyInfo) {
114 114
                 continue;
115 115
             }
116 116
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             $fieldName = $cacheKeyInfo['fieldName'];
127 127
 
128 128
             // Prevent overwrite in case of inherit classes using same property name (See AbstractHydrator)
129
-            if (! isset($data[$fieldName]) || ! $valueIsNull) {
129
+            if ( ! isset($data[$fieldName]) || ! $valueIsNull) {
130 130
                 $data[$fieldName] = $value;
131 131
             }
132 132
         }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Internal/Hydration/ArrayHydrator.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
                 // It's a joined result
93 93
 
94 94
                 $parent = $this->rsm->parentAliasMap[$dqlAlias];
95
-                $path   = $parent . '.' . $dqlAlias;
95
+                $path   = $parent.'.'.$dqlAlias;
96 96
 
97 97
                 // missing parent data, skipping as RIGHT JOIN hydration is not supported.
98
-                if (! isset($nonemptyComponents[$parent])) {
98
+                if ( ! isset($nonemptyComponents[$parent])) {
99 99
                     continue;
100 100
                 }
101 101
 
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
                 if ($this->rsm->isMixed && isset($this->rootAliases[$parent])) {
105 105
                     $first = reset($this->resultPointers);
106 106
                     // TODO: Exception if $key === null ?
107
-                    $baseElement =& $this->resultPointers[$parent][key($first)];
107
+                    $baseElement = & $this->resultPointers[$parent][key($first)];
108 108
                 } elseif (isset($this->resultPointers[$parent])) {
109
-                    $baseElement =& $this->resultPointers[$parent];
109
+                    $baseElement = & $this->resultPointers[$parent];
110 110
                 } else {
111 111
                     unset($this->resultPointers[$dqlAlias]); // Ticket #1228
112 112
 
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
                 $relation      = $parentClass->getProperty($relationAlias);
119 119
 
120 120
                 // Check the type of the relation (many or single-valued)
121
-                if (! $relation instanceof ToOneAssociationMetadata) {
121
+                if ( ! $relation instanceof ToOneAssociationMetadata) {
122 122
                     $oneToOne = false;
123 123
 
124
-                    if (! isset($baseElement[$relationAlias])) {
124
+                    if ( ! isset($baseElement[$relationAlias])) {
125 125
                         $baseElement[$relationAlias] = [];
126 126
                     }
127 127
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
                         $index        = $indexExists ? $this->identifierMap[$path][$id[$parent]][$id[$dqlAlias]] : false;
131 131
                         $indexIsValid = $index !== false ? isset($baseElement[$relationAlias][$index]) : false;
132 132
 
133
-                        if (! $indexExists || ! $indexIsValid) {
133
+                        if ( ! $indexExists || ! $indexIsValid) {
134 134
                             $element = $data;
135 135
 
136 136
                             if (isset($this->rsm->indexByMap[$dqlAlias])) {
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
                         ( ! isset($baseElement[$relationAlias]))
152 152
                     ) {
153 153
                         $baseElement[$relationAlias] = null;
154
-                    } elseif (! isset($baseElement[$relationAlias])) {
154
+                    } elseif ( ! isset($baseElement[$relationAlias])) {
155 155
                         $baseElement[$relationAlias] = $data;
156 156
                     }
157 157
                 }
158 158
 
159
-                $coll =& $baseElement[$relationAlias];
159
+                $coll = & $baseElement[$relationAlias];
160 160
 
161 161
                 if (is_array($coll)) {
162 162
                     $this->updateResultPointer($coll, $index, $dqlAlias, $oneToOne);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                 $entityKey                    = $this->rsm->entityMappings[$dqlAlias] ?: 0;
169 169
 
170 170
                 // if this row has a NULL value for the root result id then make it a null result.
171
-                if (! isset($nonemptyComponents[$dqlAlias])) {
171
+                if ( ! isset($nonemptyComponents[$dqlAlias])) {
172 172
                     $result[] = $this->rsm->isMixed
173 173
                         ? [$entityKey => null]
174 174
                         : null;
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
             }
206 206
         }
207 207
 
208
-        if (! isset($resultKey)) {
208
+        if ( ! isset($resultKey)) {
209 209
             $this->resultCounter++;
210 210
         }
211 211
 
212 212
         // Append scalar values to mixed result sets
213 213
         if (isset($rowData['scalars'])) {
214
-            if (! isset($resultKey)) {
214
+            if ( ! isset($resultKey)) {
215 215
                 // this only ever happens when no object is fetched (scalar result only)
216 216
                 $resultKey = isset($this->rsm->indexByMap['scalars'])
217 217
                     ? $row[$this->rsm->indexByMap['scalars']]
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
         // Append new object to mixed result sets
227 227
         if (isset($rowData['newObjects'])) {
228
-            if (! isset($resultKey)) {
228
+            if ( ! isset($resultKey)) {
229 229
                 $resultKey = $this->resultCounter - 1;
230 230
             }
231 231
 
@@ -267,23 +267,23 @@  discard block
 block discarded – undo
267 267
         }
268 268
 
269 269
         if ($oneToOne) {
270
-            $this->resultPointers[$dqlAlias] =& $coll;
270
+            $this->resultPointers[$dqlAlias] = & $coll;
271 271
 
272 272
             return;
273 273
         }
274 274
 
275 275
         if ($index !== false) {
276
-            $this->resultPointers[$dqlAlias] =& $coll[$index];
276
+            $this->resultPointers[$dqlAlias] = & $coll[$index];
277 277
 
278 278
             return;
279 279
         }
280 280
 
281
-        if (! $coll) {
281
+        if ( ! $coll) {
282 282
             return;
283 283
         }
284 284
 
285 285
         end($coll);
286
-        $this->resultPointers[$dqlAlias] =& $coll[key($coll)];
286
+        $this->resultPointers[$dqlAlias] = & $coll[key($coll)];
287 287
 
288 288
         return;
289 289
     }
Please login to merge, or discard this patch.