@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public static function getDefaultMethodName(string $eventName): string |
32 | 32 | { |
33 | - return 'on' . str_replace(['_', '.'], '', $eventName); |
|
33 | + return 'on'.str_replace(['_', '.'], '', $eventName); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function addSubscriber(EventSubscriberInterface $subscriber): void |
57 | 57 | { |
58 | 58 | foreach ($subscriber->getSubscribedEvents() as $eventData) { |
59 | - if (!isset($eventData['event'])) { |
|
59 | + if ( ! isset($eventData['event'])) { |
|
60 | 60 | throw new InvalidArgumentException(sprintf('Each event must have a "event" key.')); |
61 | 61 | } |
62 | 62 | |
@@ -71,33 +71,33 @@ discard block |
||
71 | 71 | |
72 | 72 | public function hasListeners(string $eventName, string $class, string $format): bool |
73 | 73 | { |
74 | - if (!isset($this->listeners[$eventName])) { |
|
74 | + if ( ! isset($this->listeners[$eventName])) { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
78 | - if (!isset($this->classListeners[$eventName][$class][$format])) { |
|
78 | + if ( ! isset($this->classListeners[$eventName][$class][$format])) { |
|
79 | 79 | $this->classListeners[$eventName][$class][$format] = $this->initializeListeners($eventName, $class, $format); |
80 | 80 | } |
81 | 81 | |
82 | - return !!$this->classListeners[$eventName][$class][$format]; |
|
82 | + return ! ! $this->classListeners[$eventName][$class][$format]; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function dispatch(string $eventName, string $class, string $format, Event $event): void |
86 | 86 | { |
87 | - if (!isset($this->listeners[$eventName])) { |
|
87 | + if ( ! isset($this->listeners[$eventName])) { |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | |
91 | 91 | $object = $event instanceof ObjectEvent ? $event->getObject() : null; |
92 | 92 | $realClass = is_object($object) ? get_class($object) : ''; |
93 | - $objectClass = $realClass !== $class ? $realClass . $class : $class; |
|
93 | + $objectClass = $realClass !== $class ? $realClass.$class : $class; |
|
94 | 94 | |
95 | - if (!isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
95 | + if ( ! isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
96 | 96 | $this->classListeners[$eventName][$objectClass][$format] = $this->initializeListeners($eventName, $class, $format); |
97 | 97 | } |
98 | 98 | |
99 | 99 | foreach ($this->classListeners[$eventName][$objectClass][$format] as $listener) { |
100 | - if (!empty($listener[3]) && !($object instanceof $listener[3])) { |
|
100 | + if ( ! empty($listener[3]) && ! ($object instanceof $listener[3])) { |
|
101 | 101 | continue; |
102 | 102 | } |
103 | 103 |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | // If the set type name is not an actual class, but a faked type for which a custom handler exists, we do not |
41 | 41 | // modify it with this subscriber. Also, we forgo autoloading here as an instance of this type is already created, |
42 | 42 | // so it must be loaded if its a real class. |
43 | - $virtualType = !class_exists($type['name'], false); |
|
43 | + $virtualType = ! class_exists($type['name'], false); |
|
44 | 44 | |
45 | 45 | if ( |
46 | 46 | $object instanceof PersistentCollection |
47 | 47 | || $object instanceof MongoDBPersistentCollection |
48 | 48 | || $object instanceof PHPCRPersistentCollection |
49 | 49 | ) { |
50 | - if (!$virtualType) { |
|
50 | + if ( ! $virtualType) { |
|
51 | 51 | $event->setType('ArrayCollection'); |
52 | 52 | } |
53 | 53 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | |
57 | 57 | if ( |
58 | 58 | ($this->skipVirtualTypeInit && $virtualType) || |
59 | - (!$object instanceof Proxy && !$object instanceof LazyLoadingInterface) |
|
59 | + ( ! $object instanceof Proxy && ! $object instanceof LazyLoadingInterface) |
|
60 | 60 | ) { |
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
64 | 64 | // do not initialize the proxy if is going to be excluded by-class by some exclusion strategy |
65 | - if (false === $this->initializeExcluded && !$virtualType) { |
|
65 | + if (false === $this->initializeExcluded && ! $virtualType) { |
|
66 | 66 | $context = $event->getContext(); |
67 | 67 | $exclusionStrategy = $context->getExclusionStrategy(); |
68 | 68 | $metadata = $context->getMetadataFactory()->getMetadataForClass(get_parent_class($object)); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $object->__load(); |
78 | 78 | } |
79 | 79 | |
80 | - if (!$virtualType) { |
|
80 | + if ( ! $virtualType) { |
|
81 | 81 | $event->setType(get_parent_class($object), $type['params']); |
82 | 82 | } |
83 | 83 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $type = $event->getType(); |
88 | 88 | // is a virtual type? then there is no need to change the event name |
89 | - if (!class_exists($type['name'], false)) { |
|
89 | + if ( ! class_exists($type['name'], false)) { |
|
90 | 90 | return; |
91 | 91 | } |
92 | 92 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | if (false !== stripos($data, '<!doctype')) { |
86 | 86 | $internalSubset = $this->getDomDocumentTypeEntitySubset($data); |
87 | - if (!in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
87 | + if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
88 | 88 | throw new InvalidArgumentException(sprintf( |
89 | 89 | 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.', |
90 | 90 | $internalSubset |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $nodes = $data->xpath($entryName); |
210 | 210 | } |
211 | 211 | |
212 | - if (null === $nodes || !\count($nodes)) { |
|
212 | + if (null === $nodes || ! \count($nodes)) { |
|
213 | 213 | return []; |
214 | 214 | } |
215 | 215 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $nodes = $data->children($namespace)->$entryName; |
238 | 238 | foreach ($nodes as $v) { |
239 | 239 | $attrs = $v->attributes(); |
240 | - if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
240 | + if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
241 | 241 | throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute)); |
242 | 242 | } |
243 | 243 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
268 | 268 | |
269 | 269 | // Check XML element with namespace for discriminatorFieldName |
270 | - case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
270 | + case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
271 | 271 | return (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
272 | 272 | |
273 | 273 | // Check XML element for discriminatorFieldName |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $name = $metadata->serializedName; |
298 | 298 | |
299 | 299 | if (true === $metadata->inline) { |
300 | - if (!$metadata->type) { |
|
300 | + if ( ! $metadata->type) { |
|
301 | 301 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
302 | 302 | } |
303 | 303 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | if ($metadata->xmlAttribute) { |
308 | 308 | $attributes = $data->attributes($metadata->xmlNamespace); |
309 | 309 | if (isset($attributes[$name])) { |
310 | - if (!$metadata->type) { |
|
310 | + if ( ! $metadata->type) { |
|
311 | 311 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
312 | 312 | } |
313 | 313 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | } |
319 | 319 | |
320 | 320 | if ($metadata->xmlValue) { |
321 | - if (!$metadata->type) { |
|
321 | + if ( ! $metadata->type) { |
|
322 | 322 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
323 | 323 | } |
324 | 324 | |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | |
328 | 328 | if ($metadata->xmlCollection) { |
329 | 329 | $enclosingElem = $data; |
330 | - if (!$metadata->xmlCollectionInline) { |
|
330 | + if ( ! $metadata->xmlCollectionInline) { |
|
331 | 331 | $enclosingElem = $data->children($metadata->xmlNamespace)->$name; |
332 | 332 | } |
333 | 333 | |
334 | 334 | $this->setCurrentMetadata($metadata); |
335 | - if (!$metadata->type) { |
|
335 | + if ( ! $metadata->type) { |
|
336 | 336 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
337 | 337 | } |
338 | 338 | |
@@ -344,13 +344,13 @@ discard block |
||
344 | 344 | |
345 | 345 | if ($metadata->xmlNamespace) { |
346 | 346 | $node = $data->children($metadata->xmlNamespace)->$name; |
347 | - if (!$node->count()) { |
|
347 | + if ( ! $node->count()) { |
|
348 | 348 | throw new NotAcceptableException(); |
349 | 349 | } |
350 | 350 | } elseif ('' === $metadata->xmlNamespace) { |
351 | 351 | // See #1087 - element must be like: <element xmlns="" /> - https://www.w3.org/TR/REC-xml-names/#iri-use |
352 | 352 | // Use of an empty string in a namespace declaration turns it into an "undeclaration". |
353 | - $nodes = $data->xpath('./' . $name); |
|
353 | + $nodes = $data->xpath('./'.$name); |
|
354 | 354 | if (empty($nodes)) { |
355 | 355 | throw new NotAcceptableException(); |
356 | 356 | } |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | if (isset($namespaces[''])) { |
362 | 362 | $prefix = uniqid('ns-'); |
363 | 363 | $data->registerXPathNamespace($prefix, $namespaces['']); |
364 | - $nodes = $data->xpath('./' . $prefix . ':' . $name); |
|
364 | + $nodes = $data->xpath('./'.$prefix.':'.$name); |
|
365 | 365 | } else { |
366 | - $nodes = $data->xpath('./' . $name); |
|
366 | + $nodes = $data->xpath('./'.$name); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | if (empty($nodes)) { |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $this->setCurrentMetadata($metadata); |
378 | 378 | } |
379 | 379 | |
380 | - if (!$metadata->type) { |
|
380 | + if ( ! $metadata->type) { |
|
381 | 381 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
382 | 382 | } |
383 | 383 |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | if ($this->nestedGroups) { |
55 | 55 | $groups = $this->getGroupsFor($navigatorContext); |
56 | 56 | |
57 | - if (!$property->groups) { |
|
58 | - return !in_array(self::DEFAULT_GROUP, $groups); |
|
57 | + if ( ! $property->groups) { |
|
58 | + return ! in_array(self::DEFAULT_GROUP, $groups); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | return $this->shouldSkipUsingGroups($property, $groups); |
62 | 62 | } else { |
63 | - if (!$property->groups) { |
|
64 | - return !isset($this->groups[self::DEFAULT_GROUP]); |
|
63 | + if ( ! $property->groups) { |
|
64 | + return ! isset($this->groups[self::DEFAULT_GROUP]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | foreach ($property->groups as $group) { |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | |
88 | 88 | public function getGroupsFor(Context $navigatorContext): array |
89 | 89 | { |
90 | - if (!$this->nestedGroups) { |
|
90 | + if ( ! $this->nestedGroups) { |
|
91 | 91 | return array_keys($this->groups); |
92 | 92 | } |
93 | 93 | |
94 | 94 | $paths = $navigatorContext->getCurrentPath(); |
95 | 95 | $groups = $this->groups; |
96 | 96 | foreach ($paths as $index => $path) { |
97 | - if (!array_key_exists($path, $groups)) { |
|
97 | + if ( ! array_key_exists($path, $groups)) { |
|
98 | 98 | if ($index > 0) { |
99 | 99 | $groups = [self::DEFAULT_GROUP]; |
100 | 100 | } else { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | $groups = $groups[$path]; |
108 | - if (!array_filter($groups, 'is_string')) { |
|
108 | + if ( ! array_filter($groups, 'is_string')) { |
|
109 | 109 | $groups += [self::DEFAULT_GROUP]; |
110 | 110 | } |
111 | 111 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getPropertyDocblockTypeHint(\ReflectionProperty $reflectionProperty): ?string |
55 | 55 | { |
56 | - if (!$reflectionProperty->getDocComment()) { |
|
56 | + if ( ! $reflectionProperty->getDocComment()) { |
|
57 | 57 | return null; |
58 | 58 | } |
59 | 59 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | // The PhpDoc contains multiple non-null types which produces ambiguity when deserializing. |
75 | 75 | if (count($typesWithoutNull) > 1) { |
76 | - $typeHint = implode('|', array_map(static function (TypeNode $type) { |
|
76 | + $typeHint = implode('|', array_map(static function(TypeNode $type) { |
|
77 | 77 | return (string) $type; |
78 | 78 | }, $types)); |
79 | 79 | |
@@ -92,20 +92,20 @@ discard block |
||
92 | 92 | if ($type instanceof ArrayTypeNode) { |
93 | 93 | $resolvedType = $this->resolveTypeFromTypeNode($type->type, $reflectionProperty); |
94 | 94 | |
95 | - return 'array<' . $resolvedType . '>'; |
|
95 | + return 'array<'.$resolvedType.'>'; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // Generic array syntax: array<Product> | array<\Foo\Bar\Product> | array<int,Product> |
99 | 99 | if ($type instanceof GenericTypeNode) { |
100 | - if (!$this->isSimpleType($type->type, 'array')) { |
|
100 | + if ( ! $this->isSimpleType($type->type, 'array')) { |
|
101 | 101 | throw new \InvalidArgumentException(sprintf("Can't use non-array generic type %s for collection in %s:%s", (string) $type->type, $reflectionProperty->getDeclaringClass()->getName(), $reflectionProperty->getName())); |
102 | 102 | } |
103 | 103 | |
104 | - $resolvedTypes = array_map(function (TypeNode $node) use ($reflectionProperty) { |
|
104 | + $resolvedTypes = array_map(function(TypeNode $node) use ($reflectionProperty) { |
|
105 | 105 | return $this->resolveTypeFromTypeNode($node, $reflectionProperty); |
106 | 106 | }, $type->genericTypes); |
107 | 107 | |
108 | - return 'array<' . implode(',', $resolvedTypes) . '>'; |
|
108 | + return 'array<'.implode(',', $resolvedTypes).'>'; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | // Primitives and class names: Collection | \Foo\Bar\Product | string |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | return []; |
126 | 126 | } |
127 | 127 | |
128 | - return array_merge(...array_map(static function (VarTagValueNode $node) { |
|
128 | + return array_merge(...array_map(static function(VarTagValueNode $node) { |
|
129 | 129 | if ($node->type instanceof UnionTypeNode) { |
130 | 130 | return $node->type->types; |
131 | 131 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | private function filterNullFromTypes(array $types): array |
145 | 145 | { |
146 | - return array_values(array_filter(array_map(function (TypeNode $node) { |
|
146 | + return array_values(array_filter(array_map(function(TypeNode $node) { |
|
147 | 147 | return $this->isNullType($node) ? null : $node; |
148 | 148 | }, $types))); |
149 | 149 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | private function resolveTypeFromTypeNode(TypeNode $typeNode, \ReflectionProperty $reflectionProperty): string |
188 | 188 | { |
189 | - if (!($typeNode instanceof IdentifierTypeNode)) { |
|
189 | + if ( ! ($typeNode instanceof IdentifierTypeNode)) { |
|
190 | 190 | throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflectionProperty->getDeclaringClass()->getName(), $reflectionProperty->getName())); |
191 | 191 | } |
192 | 192 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | return $typeHint; |
200 | 200 | } |
201 | 201 | |
202 | - $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint; |
|
202 | + $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint; |
|
203 | 203 | if ($this->isClassOrInterface($expandedClassName)) { |
204 | 204 | return $expandedClassName; |
205 | 205 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool |
227 | 227 | { |
228 | - $typeHintToSearchFor = '\\' . $typeHintToSearchFor; |
|
228 | + $typeHintToSearchFor = '\\'.$typeHintToSearchFor; |
|
229 | 229 | |
230 | 230 | return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor; |
231 | 231 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements); |
247 | 247 | for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) { |
248 | 248 | foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) { |
249 | - $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement); |
|
249 | + $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | private function resolveType(string $typeHint, \ReflectionProperty $reflectionProperty): string |
281 | 281 | { |
282 | - if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) { |
|
282 | + if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) { |
|
283 | 283 | $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflectionProperty), $reflectionProperty); |
284 | 284 | } |
285 | 285 |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | switch ($type['name']) { |
141 | 141 | case 'NULL': |
142 | - if (!$this->shouldSerializeNull && !$this->isRootNullAllowed()) { |
|
142 | + if ( ! $this->shouldSerializeNull && ! $this->isRootNullAllowed()) { |
|
143 | 143 | throw new NotAcceptableException(); |
144 | 144 | } |
145 | 145 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | case 'resource': |
170 | 170 | $msg = 'Resources are not supported in serialized data.'; |
171 | 171 | if (null !== $path = $this->context->getPath()) { |
172 | - $msg .= ' Path: ' . $path; |
|
172 | + $msg .= ' Path: '.$path; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | throw new RuntimeException($msg); |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | throw new ExcludedClassException(); |
236 | 236 | } |
237 | 237 | |
238 | - if (!is_object($data)) { |
|
239 | - throw new InvalidArgumentException('Value at ' . $this->context->getPath() . ' is expected to be an object of class ' . $type['name'] . ' but is of type ' . gettype($data)); |
|
238 | + if ( ! is_object($data)) { |
|
239 | + throw new InvalidArgumentException('Value at '.$this->context->getPath().' is expected to be an object of class '.$type['name'].' but is of type '.gettype($data)); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | $this->context->pushClassMetadata($metadata); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | private function getAccessorStrategy(): AccessorStrategyInterface |
218 | 218 | { |
219 | - if (!$this->accessorStrategy) { |
|
219 | + if ( ! $this->accessorStrategy) { |
|
220 | 220 | $this->accessorStrategy = new DefaultAccessorStrategy($this->expressionEvaluator); |
221 | 221 | } |
222 | 222 | |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | |
261 | 261 | public function setCacheDir(string $dir): self |
262 | 262 | { |
263 | - if (!is_dir($dir)) { |
|
263 | + if ( ! is_dir($dir)) { |
|
264 | 264 | $this->createDir($dir); |
265 | 265 | } |
266 | 266 | |
267 | - if (!is_writable($dir)) { |
|
267 | + if ( ! is_writable($dir)) { |
|
268 | 268 | throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir)); |
269 | 269 | } |
270 | 270 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | public function setMetadataDirs(array $namespacePrefixToDirMap): self |
387 | 387 | { |
388 | 388 | foreach ($namespacePrefixToDirMap as $dir) { |
389 | - if (!is_dir($dir)) { |
|
389 | + if ( ! is_dir($dir)) { |
|
390 | 390 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
391 | 391 | } |
392 | 392 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | */ |
425 | 425 | public function addMetadataDir(string $dir, string $namespacePrefix = ''): self |
426 | 426 | { |
427 | - if (!is_dir($dir)) { |
|
427 | + if ( ! is_dir($dir)) { |
|
428 | 428 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
429 | 429 | } |
430 | 430 | |
@@ -463,11 +463,11 @@ discard block |
||
463 | 463 | */ |
464 | 464 | public function replaceMetadataDir(string $dir, string $namespacePrefix = ''): self |
465 | 465 | { |
466 | - if (!is_dir($dir)) { |
|
466 | + if ( ! is_dir($dir)) { |
|
467 | 467 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
468 | 468 | } |
469 | 469 | |
470 | - if (!isset($this->metadataDirs[$namespacePrefix])) { |
|
470 | + if ( ! isset($this->metadataDirs[$namespacePrefix])) { |
|
471 | 471 | throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix)); |
472 | 472 | } |
473 | 473 | |
@@ -566,19 +566,19 @@ discard block |
||
566 | 566 | if (null !== $this->metadataCache) { |
567 | 567 | $metadataFactory->setCache($this->metadataCache); |
568 | 568 | } elseif (null !== $this->cacheDir) { |
569 | - $this->createDir($this->cacheDir . '/metadata'); |
|
570 | - $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata')); |
|
569 | + $this->createDir($this->cacheDir.'/metadata'); |
|
570 | + $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata')); |
|
571 | 571 | } |
572 | 572 | |
573 | - if (!$this->handlersConfigured) { |
|
573 | + if ( ! $this->handlersConfigured) { |
|
574 | 574 | $this->addDefaultHandlers(); |
575 | 575 | } |
576 | 576 | |
577 | - if (!$this->listenersConfigured) { |
|
577 | + if ( ! $this->listenersConfigured) { |
|
578 | 578 | $this->addDefaultListeners(); |
579 | 579 | } |
580 | 580 | |
581 | - if (!$this->visitorsAdded) { |
|
581 | + if ( ! $this->visitorsAdded) { |
|
582 | 582 | $this->addDefaultSerializationVisitors(); |
583 | 583 | $this->addDefaultDeserializationVisitors(); |
584 | 584 | } |
@@ -645,12 +645,12 @@ discard block |
||
645 | 645 | private function decorateAnnotationReader(Reader $annotationReader): Reader |
646 | 646 | { |
647 | 647 | if (null !== $this->cacheDir) { |
648 | - $this->createDir($this->cacheDir . '/annotations'); |
|
648 | + $this->createDir($this->cacheDir.'/annotations'); |
|
649 | 649 | if (class_exists(FilesystemAdapter::class)) { |
650 | - $annotationsCache = new FilesystemAdapter('', 0, $this->cacheDir . '/annotations'); |
|
650 | + $annotationsCache = new FilesystemAdapter('', 0, $this->cacheDir.'/annotations'); |
|
651 | 651 | $annotationReader = new PsrCachedReader($annotationReader, $annotationsCache, $this->debug); |
652 | 652 | } else { |
653 | - $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations'); |
|
653 | + $annotationsCache = new FilesystemCache($this->cacheDir.'/annotations'); |
|
654 | 654 | $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug); |
655 | 655 | } |
656 | 656 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | private function buildAnnotation(array $attributes): ?object |
57 | 57 | { |
58 | - if (!isset($attributes[0])) { |
|
58 | + if ( ! isset($attributes[0])) { |
|
59 | 59 | return null; |
60 | 60 | } |
61 | 61 |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | { |
11 | 11 | private function loadAnnotationParameters(array $vars): void |
12 | 12 | { |
13 | - if (!array_key_exists('values', $vars)) { |
|
13 | + if ( ! array_key_exists('values', $vars)) { |
|
14 | 14 | $values = []; |
15 | - } elseif (!is_array($vars['values'])) { |
|
15 | + } elseif ( ! is_array($vars['values'])) { |
|
16 | 16 | $values = ['value' => $vars['values']]; |
17 | 17 | } else { |
18 | 18 | $values = $vars['values']; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | foreach ($vars as $key => $value) { |
33 | - if (!property_exists(static::class, $key)) { |
|
33 | + if ( ! property_exists(static::class, $key)) { |
|
34 | 34 | throw new InvalidArgumentException(sprintf('Unknown property "%s" on annotation "%s".', $key, static::class)); |
35 | 35 | } |
36 | 36 |