Passed
Pull Request — master (#900)
by Michael
03:06
created
src/Handler/LazyHandlerRegistry.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function __construct($container, array $handlers = array())
31 31
     {
32
-        if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) {
32
+        if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) {
33 33
             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)));
34 34
         }
35 35
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             return $this->initializedHandlers[$direction][$typeName][$format];
50 50
         }
51 51
 
52
-        if (!isset($this->handlers[$direction][$typeName][$format])) {
52
+        if ( ! isset($this->handlers[$direction][$typeName][$format])) {
53 53
             return null;
54 54
         }
55 55
 
Please login to merge, or discard this patch.
src/Context.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
     private function assertMutable(): void
134 134
     {
135
-        if (!$this->initialized) {
135
+        if ( ! $this->initialized) {
136 136
             return;
137 137
         }
138 138
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
             throw new LogicException('The groups must not be empty.');
170 170
         }
171 171
 
172
-        $this->attributes['groups'] = (array)$groups;
173
-        $this->addExclusionStrategy(new GroupsExclusionStrategy((array)$groups));
172
+        $this->attributes['groups'] = (array) $groups;
173
+        $this->addExclusionStrategy(new GroupsExclusionStrategy((array) $groups));
174 174
 
175 175
         return $this;
176 176
     }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     {
228 228
         $metadata = $this->metadataStack->pop();
229 229
 
230
-        if (!$metadata instanceof PropertyMetadata) {
230
+        if ( ! $metadata instanceof PropertyMetadata) {
231 231
             throw new RuntimeException('Context metadataStack not working well');
232 232
         }
233 233
     }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     {
237 237
         $metadata = $this->metadataStack->pop();
238 238
 
239
-        if (!$metadata instanceof ClassMetadata) {
239
+        if ( ! $metadata instanceof ClassMetadata) {
240 240
             throw new RuntimeException('Context metadataStack not working well');
241 241
         }
242 242
     }
Please login to merge, or discard this patch.
src/VisitorFactory/JsonSerializationVisitorFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 
43 43
     public function setOptions(int $options): self
44 44
     {
45
-        $this->options = (integer)$options;
45
+        $this->options = (integer) $options;
46 46
         return $this;
47 47
     }
48 48
 }
Please login to merge, or discard this patch.
src/VisitorFactory/XmlSerializationVisitorFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,6 +69,6 @@
 block discarded – undo
69 69
 
70 70
     public function setFormatOutput(bool $formatOutput)
71 71
     {
72
-        $this->formatOutput = (boolean)$formatOutput;
72
+        $this->formatOutput = (boolean) $formatOutput;
73 73
     }
74 74
 }
Please login to merge, or discard this patch.
src/VisitorFactory/XmlDeserializationVisitorFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 
41 41
     public function enableExternalEntities(bool $enable = true): self
42 42
     {
43
-        $this->disableExternalEntities = !$enable;
43
+        $this->disableExternalEntities = ! $enable;
44 44
         return $this;
45 45
     }
46 46
 
Please login to merge, or discard this patch.
src/EventDispatcher/Subscriber/DoctrineProxySubscriber.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 
42 42
     public function __construct($skipVirtualTypeInit = true, $initializeExcluded = false)
43 43
     {
44
-        $this->skipVirtualTypeInit = (bool)$skipVirtualTypeInit;
45
-        $this->initializeExcluded = (bool)$initializeExcluded;
44
+        $this->skipVirtualTypeInit = (bool) $skipVirtualTypeInit;
45
+        $this->initializeExcluded = (bool) $initializeExcluded;
46 46
     }
47 47
 
48 48
     public function onPreSerialize(PreSerializeEvent $event)
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
         // If the set type name is not an actual class, but a faked type for which a custom handler exists, we do not
54 54
         // modify it with this subscriber. Also, we forgo autoloading here as an instance of this type is already created,
55 55
         // so it must be loaded if its a real class.
56
-        $virtualType = !class_exists($type['name'], false);
56
+        $virtualType = ! class_exists($type['name'], false);
57 57
 
58 58
         if ($object instanceof PersistentCollection
59 59
             || $object instanceof MongoDBPersistentCollection
60 60
             || $object instanceof PHPCRPersistentCollection
61 61
         ) {
62
-            if (!$virtualType) {
62
+            if ( ! $virtualType) {
63 63
                 $event->setType('ArrayCollection');
64 64
             }
65 65
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
         }
68 68
 
69 69
         if (($this->skipVirtualTypeInit && $virtualType) ||
70
-            (!$object instanceof Proxy && !$object instanceof ORMProxy)
70
+            ( ! $object instanceof Proxy && ! $object instanceof ORMProxy)
71 71
         ) {
72 72
             return;
73 73
         }
74 74
 
75 75
         // do not initialize the proxy if is going to be excluded by-class by some exclusion strategy
76
-        if ($this->initializeExcluded === false && !$virtualType) {
76
+        if ($this->initializeExcluded === false && ! $virtualType) {
77 77
             $context = $event->getContext();
78 78
             $exclusionStrategy = $context->getExclusionStrategy();
79 79
             $metadata = $context->getMetadataFactory()->getMetadataForClass(get_parent_class($object));
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
         $object->__load();
86 86
 
87
-        if (!$virtualType) {
87
+        if ( ! $virtualType) {
88 88
             $event->setType(get_parent_class($object), $type['params']);
89 89
         }
90 90
     }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     {
94 94
         $type = $event->getType();
95 95
         // is a virtual type? then there is no need to change the event name
96
-        if (!class_exists($type['name'], false)) {
96
+        if ( ! class_exists($type['name'], false)) {
97 97
             return;
98 98
         }
99 99
 
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
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
                     $classMetadata->setDiscriminator($annot->field, $annot->map, $annot->groups);
113 113
                 }
114 114
             } elseif ($annot instanceof XmlDiscriminator) {
115
-                $classMetadata->xmlDiscriminatorAttribute = (bool)$annot->attribute;
116
-                $classMetadata->xmlDiscriminatorCData = (bool)$annot->cdata;
117
-                $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string)$annot->namespace : null;
115
+                $classMetadata->xmlDiscriminatorAttribute = (bool) $annot->attribute;
116
+                $classMetadata->xmlDiscriminatorCData = (bool) $annot->cdata;
117
+                $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string) $annot->namespace : null;
118 118
             } elseif ($annot instanceof VirtualProperty) {
119 119
                 $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, $annot->name, $annot->exp);
120 120
                 $propertiesMetadata[] = $virtualPropertyMetadata;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             }
149 149
         }
150 150
 
151
-        if (!$excludeAll) {
151
+        if ( ! $excludeAll) {
152 152
             foreach ($class->getProperties() as $property) {
153 153
                 if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
154 154
                     continue;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                     } elseif ($annot instanceof Expose) {
180 180
                         $isExpose = true;
181 181
                         if (null !== $annot->if) {
182
-                            $propertyMetadata->excludeIf = "!(" . $annot->if . ")";
182
+                            $propertyMetadata->excludeIf = "!(".$annot->if.")";
183 183
                         }
184 184
                     } elseif ($annot instanceof Exclude) {
185 185
                         if (null !== $annot->if) {
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
                         $accessor = array($annot->getter, $annot->setter);
224 224
                     } elseif ($annot instanceof Groups) {
225 225
                         $propertyMetadata->groups = $annot->groups;
226
-                        foreach ((array)$propertyMetadata->groups as $groupName) {
226
+                        foreach ((array) $propertyMetadata->groups as $groupName) {
227 227
                             if (false !== strpos($groupName, ',')) {
228 228
                                 throw new InvalidArgumentException(sprintf(
229 229
                                     'Invalid group name "%s" on "%s", did you mean to create multiple groups?',
230 230
                                     implode(', ', $propertyMetadata->groups),
231
-                                    $propertyMetadata->class . '->' . $propertyMetadata->name
231
+                                    $propertyMetadata->class.'->'.$propertyMetadata->name
232 232
                                 ));
233 233
                             }
234 234
                         }
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
                     }
242 242
                 }
243 243
 
244
-                if (!$propertyMetadata->serializedName) {
244
+                if ( ! $propertyMetadata->serializedName) {
245 245
                     $propertyMetadata->serializedName = $this->namingStrategy->translateName($propertyMetadata);
246 246
                 }
247 247
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                     }
252 252
                 }
253 253
 
254
-                if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude)
254
+                if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude)
255 255
                     || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose)
256 256
                 ) {
257 257
                     $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]);
Please login to merge, or discard this patch.
src/SerializationContext.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
     public function startVisiting($object): void
54 54
     {
55
-        if (!\is_object($object)) {
55
+        if ( ! \is_object($object)) {
56 56
             return;
57 57
         }
58 58
         $this->visitingSet->attach($object);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     public function stopVisiting($object): void
63 63
     {
64
-        if (!\is_object($object)) {
64
+        if ( ! \is_object($object)) {
65 65
             return;
66 66
         }
67 67
         $this->visitingSet->detach($object);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     public function isVisiting($object): bool
76 76
     {
77
-        if (!\is_object($object)) {
77
+        if ( ! \is_object($object)) {
78 78
             return false;
79 79
         }
80 80
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             $path[] = \get_class($obj);
89 89
         }
90 90
 
91
-        if (!$path) {
91
+        if ( ! $path) {
92 92
             return null;
93 93
         }
94 94
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     public function getObject()
109 109
     {
110
-        return !$this->visitingStack->isEmpty() ? $this->visitingStack->top() : null;
110
+        return ! $this->visitingStack->isEmpty() ? $this->visitingStack->top() : null;
111 111
     }
112 112
 
113 113
     public function getVisitingStack()
Please login to merge, or discard this patch.
src/Serializer.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             $context = $this->serializationContextFactory->createSerializationContext();
151 151
         }
152 152
 
153
-        if (!isset($this->serializationVisitors[$format])) {
153
+        if ( ! isset($this->serializationVisitors[$format])) {
154 154
             throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for serialization.', $format));
155 155
         }
156 156
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $context = $this->deserializationContextFactory->createDeserializationContext();
170 170
         }
171 171
 
172
-        if (!isset($this->deserializationVisitors[$format])) {
172
+        if ( ! isset($this->deserializationVisitors[$format])) {
173 173
             throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for deserialization.', $format));
174 174
         }
175 175
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
             $context = $this->serializationContextFactory->createSerializationContext();
190 190
         }
191 191
 
192
-        if (!isset($this->serializationVisitors['json'])) {
192
+        if ( ! isset($this->serializationVisitors['json'])) {
193 193
             throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for fromArray.', 'json'));
194 194
         }
195 195
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         $result = $this->visit($this->serializationNavigator, $visitor, $context, $preparedData, 'json', $type);
202 202
         $result = $this->convertArrayObjects($result);
203 203
 
204
-        if (!\is_array($result)) {
204
+        if ( ! \is_array($result)) {
205 205
             throw new RuntimeException(sprintf(
206 206
                 'The input data of type "%s" did not convert to an array, but got a result of type "%s".',
207 207
                 \is_object($data) ? \get_class($data) : \gettype($data),
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             $context = $this->deserializationContextFactory->createDeserializationContext();
222 222
         }
223 223
 
224
-        if (!isset($this->deserializationVisitors['json'])) {
224
+        if ( ! isset($this->deserializationVisitors['json'])) {
225 225
             throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for fromArray.', 'json'));
226 226
         }
227 227
         $visitor = $this->deserializationVisitors['json']->getVisitor($this->deserializationNavigator, $this->accessorStrategy, $context);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
     private function convertArrayObjects($data)
245 245
     {
246 246
         if ($data instanceof \ArrayObject || $data instanceof \stdClass) {
247
-            $data = (array)$data;
247
+            $data = (array) $data;
248 248
         }
249 249
         if (\is_array($data)) {
250 250
             foreach ($data as $k => $v) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -95,8 +95,7 @@
 block discarded – undo
95 95
         ExpressionEvaluatorInterface $expressionEvaluator = null,
96 96
         SerializationContextFactoryInterface $serializationContextFactory = null,
97 97
         DeserializationContextFactoryInterface $deserializationContextFactory = null
98
-    )
99
-    {
98
+    ) {
100 99
         $this->factory = $factory;
101 100
         $this->handlerRegistry = $handlerRegistry;
102 101
         $this->objectConstructor = $objectConstructor;
Please login to merge, or discard this patch.