@@ -40,7 +40,7 @@ |
||
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 |
@@ -41,8 +41,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | private $namingStrategy; |
42 | 42 | |
43 | - public function __construct(FileLocatorInterface $locator, PropertyNamingStrategyInterface $namingStrategy, AbstractParser $typeParser = null) |
|
43 | + public function __construct(FileLocatorInterface $locator, PropertyNamingStrategyInterface $namingStrategy, AbstractParser $typeParser = null) |
|
44 | 44 | { |
45 | 45 | parent::__construct($locator); |
46 | 46 | $this->typeParser = $typeParser ?: new TypeParser(); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $config = Yaml::parse(file_get_contents($file)); |
53 | 53 | |
54 | - if (!isset($config[$name = $class->name])) { |
|
54 | + if ( ! isset($config[$name = $class->name])) { |
|
55 | 55 | throw new RuntimeException(sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file)); |
56 | 56 | } |
57 | 57 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | $metadata->fileResources[] = $file; |
61 | 61 | $metadata->fileResources[] = $class->getFileName(); |
62 | 62 | $exclusionPolicy = isset($config['exclusion_policy']) ? strtoupper($config['exclusion_policy']) : 'NONE'; |
63 | - $excludeAll = isset($config['exclude']) ? (Boolean)$config['exclude'] : false; |
|
63 | + $excludeAll = isset($config['exclude']) ? (Boolean) $config['exclude'] : false; |
|
64 | 64 | $classAccessType = isset($config['access_type']) ? $config['access_type'] : PropertyMetadata::ACCESS_TYPE_PROPERTY; |
65 | - $readOnlyClass = isset($config['read_only']) ? (Boolean)$config['read_only'] : false; |
|
65 | + $readOnlyClass = isset($config['read_only']) ? (Boolean) $config['read_only'] : false; |
|
66 | 66 | $this->addClassProperties($metadata, $config); |
67 | 67 | |
68 | 68 | $propertiesMetadata = array(); |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | |
75 | 75 | } else { |
76 | 76 | |
77 | - if (!$class->hasMethod($methodName)) { |
|
78 | - throw new RuntimeException('The method ' . $methodName . ' not found in class ' . $class->name); |
|
77 | + if ( ! $class->hasMethod($methodName)) { |
|
78 | + throw new RuntimeException('The method '.$methodName.' not found in class '.$class->name); |
|
79 | 79 | } |
80 | 80 | $virtualPropertyMetadata = new VirtualPropertyMetadata($name, $methodName); |
81 | 81 | } |
82 | 82 | |
83 | - $pName = !empty($propertySettings["name"]) ? $propertySettings["name"] : $virtualPropertyMetadata->name; |
|
83 | + $pName = ! empty($propertySettings["name"]) ? $propertySettings["name"] : $virtualPropertyMetadata->name; |
|
84 | 84 | |
85 | 85 | $propertiesMetadata[$pName] = $virtualPropertyMetadata; |
86 | 86 | $config['properties'][$pName] = $propertySettings; |
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | - if (!$excludeAll) { |
|
90 | + if ( ! $excludeAll) { |
|
91 | 91 | foreach ($class->getProperties() as $property) { |
92 | 92 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
93 | 93 | continue; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $pConfig = $config['properties'][$pName]; |
108 | 108 | |
109 | 109 | if (isset($pConfig['exclude'])) { |
110 | - $isExclude = (Boolean)$pConfig['exclude']; |
|
110 | + $isExclude = (Boolean) $pConfig['exclude']; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | if ($isExclude) { |
@@ -115,35 +115,35 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | if (isset($pConfig['expose'])) { |
118 | - $isExpose = (Boolean)$pConfig['expose']; |
|
118 | + $isExpose = (Boolean) $pConfig['expose']; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | if (isset($pConfig['skip_when_empty'])) { |
122 | - $pMetadata->skipWhenEmpty = (Boolean)$pConfig['skip_when_empty']; |
|
122 | + $pMetadata->skipWhenEmpty = (Boolean) $pConfig['skip_when_empty']; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | if (isset($pConfig['since_version'])) { |
126 | - $pMetadata->sinceVersion = (string)$pConfig['since_version']; |
|
126 | + $pMetadata->sinceVersion = (string) $pConfig['since_version']; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | if (isset($pConfig['until_version'])) { |
130 | - $pMetadata->untilVersion = (string)$pConfig['until_version']; |
|
130 | + $pMetadata->untilVersion = (string) $pConfig['until_version']; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | if (isset($pConfig['exclude_if'])) { |
134 | - $pMetadata->excludeIf = (string)$pConfig['exclude_if']; |
|
134 | + $pMetadata->excludeIf = (string) $pConfig['exclude_if']; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | if (isset($pConfig['expose_if'])) { |
138 | - $pMetadata->excludeIf = "!(" . $pConfig['expose_if'] . ")"; |
|
138 | + $pMetadata->excludeIf = "!(".$pConfig['expose_if'].")"; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | if (isset($pConfig['serialized_name'])) { |
142 | - $pMetadata->serializedName = (string)$pConfig['serialized_name']; |
|
142 | + $pMetadata->serializedName = (string) $pConfig['serialized_name']; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if (isset($pConfig['type'])) { |
146 | - $pMetadata->setType($this->typeParser->parse((string)$pConfig['type'])); |
|
146 | + $pMetadata->setType($this->typeParser->parse((string) $pConfig['type'])); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | if (isset($pConfig['groups'])) { |
@@ -155,21 +155,21 @@ discard block |
||
155 | 155 | |
156 | 156 | $colConfig = $pConfig['xml_list']; |
157 | 157 | if (isset($colConfig['inline'])) { |
158 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
158 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if (isset($colConfig['entry_name'])) { |
162 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
162 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | if (isset($colConfig['skip_when_empty'])) { |
166 | - $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean)$colConfig['skip_when_empty']; |
|
166 | + $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean) $colConfig['skip_when_empty']; |
|
167 | 167 | } else { |
168 | 168 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
169 | 169 | } |
170 | 170 | |
171 | 171 | if (isset($colConfig['namespace'])) { |
172 | - $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace']; |
|
172 | + $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace']; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | |
179 | 179 | $colConfig = $pConfig['xml_map']; |
180 | 180 | if (isset($colConfig['inline'])) { |
181 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
181 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | if (isset($colConfig['entry_name'])) { |
185 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
185 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | if (isset($colConfig['namespace'])) { |
189 | - $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace']; |
|
189 | + $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace']; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | if (isset($colConfig['key_attribute_name'])) { |
@@ -198,33 +198,33 @@ discard block |
||
198 | 198 | if (isset($pConfig['xml_element'])) { |
199 | 199 | $colConfig = $pConfig['xml_element']; |
200 | 200 | if (isset($colConfig['cdata'])) { |
201 | - $pMetadata->xmlElementCData = (Boolean)$colConfig['cdata']; |
|
201 | + $pMetadata->xmlElementCData = (Boolean) $colConfig['cdata']; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | if (isset($colConfig['namespace'])) { |
205 | - $pMetadata->xmlNamespace = (string)$colConfig['namespace']; |
|
205 | + $pMetadata->xmlNamespace = (string) $colConfig['namespace']; |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
209 | 209 | if (isset($pConfig['xml_attribute'])) { |
210 | - $pMetadata->xmlAttribute = (Boolean)$pConfig['xml_attribute']; |
|
210 | + $pMetadata->xmlAttribute = (Boolean) $pConfig['xml_attribute']; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | if (isset($pConfig['xml_attribute_map'])) { |
214 | - $pMetadata->xmlAttributeMap = (Boolean)$pConfig['xml_attribute_map']; |
|
214 | + $pMetadata->xmlAttributeMap = (Boolean) $pConfig['xml_attribute_map']; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | if (isset($pConfig['xml_value'])) { |
218 | - $pMetadata->xmlValue = (Boolean)$pConfig['xml_value']; |
|
218 | + $pMetadata->xmlValue = (Boolean) $pConfig['xml_value']; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | if (isset($pConfig['xml_key_value_pairs'])) { |
222 | - $pMetadata->xmlKeyValuePairs = (Boolean)$pConfig['xml_key_value_pairs']; |
|
222 | + $pMetadata->xmlKeyValuePairs = (Boolean) $pConfig['xml_key_value_pairs']; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | //we need read_only before setter and getter set, because that method depends on flag being set |
226 | 226 | if (isset($pConfig['read_only'])) { |
227 | - $pMetadata->readOnly = (Boolean)$pConfig['read_only']; |
|
227 | + $pMetadata->readOnly = (Boolean) $pConfig['read_only']; |
|
228 | 228 | } else { |
229 | 229 | $pMetadata->readOnly = $pMetadata->readOnly || $readOnlyClass; |
230 | 230 | } |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | ); |
237 | 237 | |
238 | 238 | if (isset($pConfig['inline'])) { |
239 | - $pMetadata->inline = (Boolean)$pConfig['inline']; |
|
239 | + $pMetadata->inline = (Boolean) $pConfig['inline']; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | if (isset($pConfig['max_depth'])) { |
243 | - $pMetadata->maxDepth = (int)$pConfig['max_depth']; |
|
243 | + $pMetadata->maxDepth = (int) $pConfig['max_depth']; |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | - if (!$pMetadata->serializedName) { |
|
247 | + if ( ! $pMetadata->serializedName) { |
|
248 | 248 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
249 | 249 | } |
250 | 250 | |
@@ -252,11 +252,11 @@ discard block |
||
252 | 252 | $pConfig = $config['properties'][$pName]; |
253 | 253 | |
254 | 254 | if (isset($pConfig['name'])) { |
255 | - $pMetadata->name = (string)$pConfig['name']; |
|
255 | + $pMetadata->name = (string) $pConfig['name']; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
259 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
260 | 260 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
261 | 261 | ) { |
262 | 262 | $metadata->addPropertyMetadata($pMetadata); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | private function addClassProperties(ClassMetadata $metadata, array $config) |
290 | 290 | { |
291 | - if (isset($config['custom_accessor_order']) && !isset($config['accessor_order'])) { |
|
291 | + if (isset($config['custom_accessor_order']) && ! isset($config['accessor_order'])) { |
|
292 | 292 | $config['accessor_order'] = 'custom'; |
293 | 293 | } |
294 | 294 | |
@@ -297,11 +297,11 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | if (isset($config['xml_root_name'])) { |
300 | - $metadata->xmlRootName = (string)$config['xml_root_name']; |
|
300 | + $metadata->xmlRootName = (string) $config['xml_root_name']; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | if (isset($config['xml_root_namespace'])) { |
304 | - $metadata->xmlRootNamespace = (string)$config['xml_root_namespace']; |
|
304 | + $metadata->xmlRootNamespace = (string) $config['xml_root_namespace']; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | if (array_key_exists('xml_namespaces', $config)) { |
@@ -316,25 +316,25 @@ discard block |
||
316 | 316 | if (isset($config['discriminator']['disabled']) && true === $config['discriminator']['disabled']) { |
317 | 317 | $metadata->discriminatorDisabled = true; |
318 | 318 | } else { |
319 | - if (!isset($config['discriminator']['field_name'])) { |
|
319 | + if ( ! isset($config['discriminator']['field_name'])) { |
|
320 | 320 | throw new RuntimeException('The "field_name" attribute must be set for discriminators.'); |
321 | 321 | } |
322 | 322 | |
323 | - if (!isset($config['discriminator']['map']) || !\is_array($config['discriminator']['map'])) { |
|
323 | + if ( ! isset($config['discriminator']['map']) || ! \is_array($config['discriminator']['map'])) { |
|
324 | 324 | throw new RuntimeException('The "map" attribute must be set, and be an array for discriminators.'); |
325 | 325 | } |
326 | 326 | $groups = isset($config['discriminator']['groups']) ? $config['discriminator']['groups'] : array(); |
327 | 327 | $metadata->setDiscriminator($config['discriminator']['field_name'], $config['discriminator']['map'], $groups); |
328 | 328 | |
329 | 329 | if (isset($config['discriminator']['xml_attribute'])) { |
330 | - $metadata->xmlDiscriminatorAttribute = (bool)$config['discriminator']['xml_attribute']; |
|
330 | + $metadata->xmlDiscriminatorAttribute = (bool) $config['discriminator']['xml_attribute']; |
|
331 | 331 | } |
332 | 332 | if (isset($config['discriminator']['xml_element'])) { |
333 | 333 | if (isset($config['discriminator']['xml_element']['cdata'])) { |
334 | - $metadata->xmlDiscriminatorCData = (bool)$config['discriminator']['xml_element']['cdata']; |
|
334 | + $metadata->xmlDiscriminatorCData = (bool) $config['discriminator']['xml_element']['cdata']; |
|
335 | 335 | } |
336 | 336 | if (isset($config['discriminator']['xml_element']['namespace'])) { |
337 | - $metadata->xmlDiscriminatorNamespace = (string)$config['discriminator']['xml_element']['namespace']; |
|
337 | + $metadata->xmlDiscriminatorNamespace = (string) $config['discriminator']['xml_element']['namespace']; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
@@ -346,13 +346,13 @@ discard block |
||
346 | 346 | { |
347 | 347 | if (\is_string($config)) { |
348 | 348 | $config = array($config); |
349 | - } elseif (!\is_array($config)) { |
|
349 | + } elseif ( ! \is_array($config)) { |
|
350 | 350 | throw new RuntimeException(sprintf('callback methods expects a string, or an array of strings that represent method names, but got %s.', json_encode($config['pre_serialize']))); |
351 | 351 | } |
352 | 352 | |
353 | 353 | $methods = array(); |
354 | 354 | foreach ($config as $name) { |
355 | - if (!$class->hasMethod($name)) { |
|
355 | + if ( ! $class->hasMethod($name)) { |
|
356 | 356 | throw new RuntimeException(sprintf('The method %s does not exist in class %s.', $name, $class->name)); |
357 | 357 | } |
358 | 358 |
@@ -112,9 +112,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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]); |
@@ -52,7 +52,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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() |
@@ -95,8 +95,7 @@ |
||
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; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $context = $this->serializationContextFactory->createSerializationContext(); |
163 | 163 | } |
164 | 164 | |
165 | - if (!isset($this->serializationVisitors[$format])) { |
|
165 | + if ( ! isset($this->serializationVisitors[$format])) { |
|
166 | 166 | throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for serialization.', $format)); |
167 | 167 | } |
168 | 168 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $context = $this->deserializationContextFactory->createDeserializationContext(); |
182 | 182 | } |
183 | 183 | |
184 | - if (!isset($this->deserializationVisitors[$format])) { |
|
184 | + if ( ! isset($this->deserializationVisitors[$format])) { |
|
185 | 185 | throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for deserialization.', $format)); |
186 | 186 | } |
187 | 187 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $context = $this->serializationContextFactory->createSerializationContext(); |
203 | 203 | } |
204 | 204 | |
205 | - if (!isset($this->serializationVisitors['json'])) { |
|
205 | + if ( ! isset($this->serializationVisitors['json'])) { |
|
206 | 206 | throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for fromArray.', 'json')); |
207 | 207 | } |
208 | 208 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $result = $this->visit($navigator, $visitor, $context, $data, 'json', $type); |
215 | 215 | $result = $this->convertArrayObjects($result); |
216 | 216 | |
217 | - if (!\is_array($result)) { |
|
217 | + if ( ! \is_array($result)) { |
|
218 | 218 | throw new RuntimeException(sprintf( |
219 | 219 | 'The input data of type "%s" did not convert to an array, but got a result of type "%s".', |
220 | 220 | \is_object($data) ? \get_class($data) : \gettype($data), |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $context = $this->deserializationContextFactory->createDeserializationContext(); |
235 | 235 | } |
236 | 236 | |
237 | - if (!isset($this->deserializationVisitors['json'])) { |
|
237 | + if ( ! isset($this->deserializationVisitors['json'])) { |
|
238 | 238 | throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for fromArray.', 'json')); |
239 | 239 | } |
240 | 240 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | private function convertArrayObjects($data) |
266 | 266 | { |
267 | 267 | if ($data instanceof \ArrayObject || $data instanceof \stdClass) { |
268 | - $data = (array)$data; |
|
268 | + $data = (array) $data; |
|
269 | 269 | } |
270 | 270 | if (\is_array($data)) { |
271 | 271 | foreach ($data as $k => $v) { |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function translateName(PropertyMetadata $property):string |
43 | 43 | { |
44 | - $name = preg_replace('/[A-Z]+/', $this->separator . '\\0', $property->name); |
|
44 | + $name = preg_replace('/[A-Z]+/', $this->separator.'\\0', $property->name); |
|
45 | 45 | |
46 | 46 | if ($this->lowerCase) { |
47 | 47 | return strtolower($name); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $classMetadata = $context->getMetadataFactory()->getMetadataForClass('stdClass'); |
51 | 51 | $visitor->startVisitingObject($classMetadata, $stdClass, array('name' => 'stdClass'), $context); |
52 | 52 | |
53 | - foreach ((array)$stdClass as $name => $value) { |
|
53 | + foreach ((array) $stdClass as $name => $value) { |
|
54 | 54 | $metadata = new StaticPropertyMetadata('stdClass', $name, $value); |
55 | 55 | $visitor->visitProperty($metadata, $value); |
56 | 56 | } |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | |
36 | 36 | switch ($direction) { |
37 | 37 | case GraphNavigatorInterface::DIRECTION_DESERIALIZATION: |
38 | - return 'deserialize' . $type . 'From' . $format; |
|
38 | + return 'deserialize'.$type.'From'.$format; |
|
39 | 39 | |
40 | 40 | case GraphNavigatorInterface::DIRECTION_SERIALIZATION: |
41 | - return 'serialize' . $type . 'To' . $format; |
|
41 | + return 'serialize'.$type.'To'.$format; |
|
42 | 42 | |
43 | 43 | default: |
44 | 44 | throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigatorInterface::DIRECTION_??? constants.', json_encode($direction))); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function registerSubscribingHandler(SubscribingHandlerInterface $handler):void |
54 | 54 | { |
55 | 55 | foreach ($handler->getSubscribingMethods() as $methodData) { |
56 | - if (!isset($methodData['type'], $methodData['format'])) { |
|
56 | + if ( ! isset($methodData['type'], $methodData['format'])) { |
|
57 | 57 | throw new RuntimeException(sprintf('For each subscribing method a "type" and "format" attribute must be given, but only got "%s" for %s.', implode('" and "', array_keys($methodData)), \get_class($handler))); |
58 | 58 | } |
59 | 59 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function getHandler(int $direction, string $typeName, string $format) |
82 | 82 | { |
83 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
83 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
84 | 84 | return null; |
85 | 85 | } |
86 | 86 |