Completed
Pull Request — master (#928)
by Gabriel
11:09
created
src/EventDispatcher/LazyEventDispatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function __construct($container)
32 32
     {
33
-        if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) {
33
+        if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) {
34 34
             throw new InvalidArgumentException(sprintf('The container must be an instance of %s or %s (%s given).', PsrContainerInterface::class, ContainerInterface::class, \is_object($container) ? \get_class($container) : \gettype($container)));
35 35
         }
36 36
 
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
         $listeners = parent::initializeListeners($eventName, $loweredClass, $format);
46 46
 
47 47
         foreach ($listeners as &$listener) {
48
-            if (!\is_array($listener[0]) || !\is_string($listener[0][0])) {
48
+            if ( ! \is_array($listener[0]) || ! \is_string($listener[0][0])) {
49 49
                 continue;
50 50
             }
51 51
 
52
-            if (!$this->container->has($listener[0][0])) {
52
+            if ( ! $this->container->has($listener[0][0])) {
53 53
                 continue;
54 54
             }
55 55
 
Please login to merge, or discard this patch.
src/TypeParser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             /x',
53 53
             [self::T_NAME => 'T_NAME', self::T_STRING => 'T_STRING', self::T_OPEN_BRACKET => 'T_OPEN_BRACKET',
54 54
                 self::T_CLOSE_BRACKET => 'T_CLOSE_BRACKET', self::T_COMMA => 'T_COMMA', self::T_NONE => 'T_NONE'],
55
-            function ($value) {
55
+            function($value) {
56 56
                 switch ($value[0]) {
57 57
                     case '"':
58 58
                     case "'":
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     protected function parseInternal()
85 85
     {
86 86
         $typeName = $this->match(self::T_NAME);
87
-        if (!$this->lexer->isNext(self::T_OPEN_BRACKET)) {
87
+        if ( ! $this->lexer->isNext(self::T_OPEN_BRACKET)) {
88 88
             return ['name' => $typeName, 'params' => []];
89 89
         }
90 90
 
Please login to merge, or discard this patch.
src/JsonSerializationVisitor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         $rs = isset($type['params'][1]) ? new \ArrayObject() : [];
79 79
 
80
-        $isList = isset($type['params'][0]) && !isset($type['params'][1]);
80
+        $isList = isset($type['params'][0]) && ! isset($type['params'][1]);
81 81
 
82 82
         $elType = $this->getElementType($type);
83 83
         foreach ($data as $k => $v) {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
         if ($metadata->inline) {
134 134
             if (\is_array($v) || ($v instanceof \ArrayObject)) {
135
-                $this->data = array_merge($this->data, (array)$v);
135
+                $this->data = array_merge($this->data, (array) $v);
136 136
             }
137 137
         } else {
138 138
             $this->data[$metadata->serializedName] = $v;
Please login to merge, or discard this patch.
src/Metadata/ClassMetadata.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function setAccessorOrder($order, array $customOrder = [])
95 95
     {
96
-        if (!in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) {
96
+        if ( ! in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) {
97 97
             throw new InvalidArgumentException(sprintf('The accessor order "%s" is invalid.', $order));
98 98
         }
99 99
 
100 100
         foreach ($customOrder as $name) {
101
-            if (!\is_string($name)) {
101
+            if ( ! \is_string($name)) {
102 102
                 throw new InvalidArgumentException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name)));
103 103
             }
104 104
         }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
     public function merge(MergeableInterface $object)
136 136
     {
137
-        if (!$object instanceof ClassMetadata) {
137
+        if ( ! $object instanceof ClassMetadata) {
138 138
             throw new InvalidArgumentException('$object must be an instance of ClassMetadata.');
139 139
         }
140 140
         parent::merge($object);
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                 $this->discriminatorBaseClass,
159 159
                 $this->discriminatorBaseClass
160 160
             ));
161
-        } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) {
161
+        } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) {
162 162
             $this->discriminatorFieldName = $object->discriminatorFieldName;
163 163
             $this->discriminatorMap = $object->discriminatorMap;
164 164
         }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             $this->discriminatorBaseClass = $object->discriminatorBaseClass;
174 174
         }
175 175
 
176
-        if ($this->discriminatorMap && !$this->reflection->isAbstract()) {
176
+        if ($this->discriminatorMap && ! $this->reflection->isAbstract()) {
177 177
             if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) {
178 178
                 throw new LogicException(sprintf(
179 179
                     'The sub-class "%s" is not listed in the discriminator of the base class "%s".',
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             $this->discriminatorValue = $typeValue;
186 186
 
187 187
             if (isset($this->propertyMetadata[$this->discriminatorFieldName])
188
-                && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
188
+                && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
189 189
             ) {
190 190
                 throw new LogicException(sprintf(
191 191
                     'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".',
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
 
214 214
     public function registerNamespace($uri, $prefix = null)
215 215
     {
216
-        if (!\is_string($uri)) {
216
+        if ( ! \is_string($uri)) {
217 217
             throw new InvalidArgumentException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri)));
218 218
         }
219 219
 
220 220
         if ($prefix !== null) {
221
-            if (!\is_string($prefix)) {
221
+            if ( ! \is_string($prefix)) {
222 222
                 throw new InvalidArgumentException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix)));
223 223
             }
224 224
         } else {
@@ -311,19 +311,19 @@  discard block
 block discarded – undo
311 311
             case self::ACCESSOR_ORDER_CUSTOM:
312 312
                 $order = $this->customOrder;
313 313
                 $currentSorting = $this->propertyMetadata ? array_combine(array_keys($this->propertyMetadata), range(1, \count($this->propertyMetadata))) : [];
314
-                uksort($this->propertyMetadata, function ($a, $b) use ($order, $currentSorting) {
314
+                uksort($this->propertyMetadata, function($a, $b) use ($order, $currentSorting) {
315 315
                     $existsA = isset($order[$a]);
316 316
                     $existsB = isset($order[$b]);
317 317
 
318
-                    if (!$existsA && !$existsB) {
318
+                    if ( ! $existsA && ! $existsB) {
319 319
                         return $currentSorting[$a] - $currentSorting[$b];
320 320
                     }
321 321
 
322
-                    if (!$existsA) {
322
+                    if ( ! $existsA) {
323 323
                         return 1;
324 324
                     }
325 325
 
326
-                    if (!$existsB) {
326
+                    if ( ! $existsB) {
327 327
                         return -1;
328 328
                     }
329 329
 
Please login to merge, or discard this patch.
src/Metadata/Driver/AnnotationDriver.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
                     $classMetadata->setDiscriminator($annot->field, $annot->map, $annot->groups);
115 115
                 }
116 116
             } elseif ($annot instanceof XmlDiscriminator) {
117
-                $classMetadata->xmlDiscriminatorAttribute = (bool)$annot->attribute;
118
-                $classMetadata->xmlDiscriminatorCData = (bool)$annot->cdata;
119
-                $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string)$annot->namespace : null;
117
+                $classMetadata->xmlDiscriminatorAttribute = (bool) $annot->attribute;
118
+                $classMetadata->xmlDiscriminatorCData = (bool) $annot->cdata;
119
+                $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string) $annot->namespace : null;
120 120
             } elseif ($annot instanceof VirtualProperty) {
121 121
                 $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, $annot->name, $annot->exp);
122 122
                 $propertiesMetadata[] = $virtualPropertyMetadata;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             }
151 151
         }
152 152
 
153
-        if (!$excludeAll) {
153
+        if ( ! $excludeAll) {
154 154
             foreach ($class->getProperties() as $property) {
155 155
                 if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
156 156
                     continue;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                     } elseif ($annot instanceof Expose) {
182 182
                         $isExpose = true;
183 183
                         if (null !== $annot->if) {
184
-                            $propertyMetadata->excludeIf = "!(" . $annot->if . ")";
184
+                            $propertyMetadata->excludeIf = "!(".$annot->if.")";
185 185
                         }
186 186
                     } elseif ($annot instanceof Exclude) {
187 187
                         if (null !== $annot->if) {
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
                         $accessor = [$annot->getter, $annot->setter];
226 226
                     } elseif ($annot instanceof Groups) {
227 227
                         $propertyMetadata->groups = $annot->groups;
228
-                        foreach ((array)$propertyMetadata->groups as $groupName) {
228
+                        foreach ((array) $propertyMetadata->groups as $groupName) {
229 229
                             if (false !== strpos($groupName, ',')) {
230 230
                                 throw new InvalidArgumentException(sprintf(
231 231
                                     'Invalid group name "%s" on "%s", did you mean to create multiple groups?',
232 232
                                     implode(', ', $propertyMetadata->groups),
233
-                                    $propertyMetadata->class . '->' . $propertyMetadata->name
233
+                                    $propertyMetadata->class.'->'.$propertyMetadata->name
234 234
                                 ));
235 235
                             }
236 236
                         }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
                     }
244 244
                 }
245 245
 
246
-                if (!$propertyMetadata->serializedName) {
246
+                if ( ! $propertyMetadata->serializedName) {
247 247
                     $propertyMetadata->serializedName = $this->namingStrategy->translateName($propertyMetadata);
248 248
                 }
249 249
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                     }
254 254
                 }
255 255
 
256
-                if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude)
256
+                if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude)
257 257
                     || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose)
258 258
                 ) {
259 259
                     $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]);
Please login to merge, or discard this patch.
src/Handler/ConstraintViolationHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
                     'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION,
43 43
                     'type' => $type,
44 44
                     'format' => $format,
45
-                    'method' => $method . 'To' . $format,
45
+                    'method' => $method.'To'.$format,
46 46
                 ];
47 47
             }
48 48
         }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function serializeListToXml(XmlSerializationVisitor $visitor, ConstraintViolationList $list, array $type)
54 54
     {
55 55
         $currentNode = $visitor->getCurrentNode();
56
-        if (!$currentNode) {
56
+        if ( ! $currentNode) {
57 57
             $visitor->createRoot();
58 58
         }
59 59
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $violationNode = $visitor->getDocument()->createElement('violation');
73 73
 
74 74
         $parent = $visitor->getCurrentNode();
75
-        if (!$parent) {
75
+        if ( ! $parent) {
76 76
             $visitor->setCurrentAndRootNode($violationNode);
77 77
         } else {
78 78
             $parent->appendChild($violationNode);
Please login to merge, or discard this patch.
src/Handler/LazyHandlerRegistry.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function __construct($container, array $handlers = [])
33 33
     {
34
-        if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) {
34
+        if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) {
35 35
             throw new InvalidArgumentException(sprintf('The container must be an instance of %s or %s (%s given).', PsrContainerInterface::class, ContainerInterface::class, \is_object($container) ? \get_class($container) : \gettype($container)));
36 36
         }
37 37
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             return $this->initializedHandlers[$direction][$typeName][$format];
52 52
         }
53 53
 
54
-        if (!isset($this->handlers[$direction][$typeName][$format])) {
54
+        if ( ! isset($this->handlers[$direction][$typeName][$format])) {
55 55
             return null;
56 56
         }
57 57
 
Please login to merge, or discard this patch.
src/Handler/StdClassHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
         $classMetadata = $context->getMetadataFactory()->getMetadataForClass('stdClass');
53 53
         $visitor->startVisitingObject($classMetadata, $stdClass, ['name' => 'stdClass'], $context);
54 54
 
55
-        foreach ((array)$stdClass as $name => $value) {
55
+        foreach ((array) $stdClass as $name => $value) {
56 56
             $metadata = new StaticPropertyMetadata('stdClass', $name, $value);
57 57
             $visitor->visitProperty($metadata, $value);
58 58
         }
Please login to merge, or discard this patch.
src/Construction/DoctrineObjectConstructor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         // Locate possible ObjectManager
66 66
         $objectManager = $this->managerRegistry->getManagerForClass($metadata->name);
67 67
 
68
-        if (!$objectManager) {
68
+        if ( ! $objectManager) {
69 69
             // No ObjectManager found, proceed with normal deserialization
70 70
             return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context);
71 71
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         }
80 80
 
81 81
         // Managed entity, check for proxy load
82
-        if (!\is_array($data)) {
82
+        if ( ! \is_array($data)) {
83 83
             // Single identifier, load proxy
84 84
             return $objectManager->getReference($metadata->name, $data);
85 85
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         $identifierList = [];
90 90
 
91 91
         foreach ($classMetadata->getIdentifierFieldNames() as $name) {
92
-            if (!array_key_exists($name, $data)) {
92
+            if ( ! array_key_exists($name, $data)) {
93 93
                 return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context);
94 94
             }
95 95
 
Please login to merge, or discard this patch.