@@ -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 |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | switch ($type['name']) { |
136 | 136 | case 'NULL': |
137 | - if (!$this->shouldSerializeNull && !$this->isRootNullAllowed()) { |
|
137 | + if ( ! $this->shouldSerializeNull && ! $this->isRootNullAllowed()) { |
|
138 | 138 | throw new NotAcceptableException(); |
139 | 139 | } |
140 | 140 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | case 'resource': |
165 | 165 | $msg = 'Resources are not supported in serialized data.'; |
166 | 166 | if (null !== $path = $this->context->getPath()) { |
167 | - $msg .= ' Path: ' . $path; |
|
167 | + $msg .= ' Path: '.$path; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | throw new RuntimeException($msg); |
@@ -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 |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | private function flattenVarTagValueTypes(array $varTagValues): array |
123 | 123 | { |
124 | - return array_merge(...array_map(static function (VarTagValueNode $node) { |
|
124 | + return array_merge(...array_map(static function(VarTagValueNode $node) { |
|
125 | 125 | if ($node->type instanceof UnionTypeNode) { |
126 | 126 | return $node->type->types; |
127 | 127 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | private function filterNullFromTypes(array $types): array |
141 | 141 | { |
142 | - return array_filter(array_map(function (TypeNode $node) { |
|
142 | + return array_filter(array_map(function(TypeNode $node) { |
|
143 | 143 | return $this->isNullType($node) ? null : $node; |
144 | 144 | }, $types)); |
145 | 145 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | private function resolveTypeFromTypeNode(TypeNode $typeNode, \ReflectionProperty $reflectionProperty): string |
184 | 184 | { |
185 | - if (!($typeNode instanceof IdentifierTypeNode)) { |
|
185 | + if ( ! ($typeNode instanceof IdentifierTypeNode)) { |
|
186 | 186 | throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflectionProperty->getDeclaringClass()->getName(), $reflectionProperty->getName())); |
187 | 187 | } |
188 | 188 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | return $typeHint; |
196 | 196 | } |
197 | 197 | |
198 | - $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint; |
|
198 | + $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint; |
|
199 | 199 | if ($this->isClassOrInterface($expandedClassName)) { |
200 | 200 | return $expandedClassName; |
201 | 201 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool |
223 | 223 | { |
224 | - $typeHintToSearchFor = '\\' . $typeHintToSearchFor; |
|
224 | + $typeHintToSearchFor = '\\'.$typeHintToSearchFor; |
|
225 | 225 | |
226 | 226 | return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor; |
227 | 227 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements); |
243 | 243 | for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) { |
244 | 244 | foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) { |
245 | - $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement); |
|
245 | + $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement); |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | private function resolveType(string $typeHint, \ReflectionProperty $reflectionProperty): string |
277 | 277 | { |
278 | - if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) { |
|
278 | + if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) { |
|
279 | 279 | $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflectionProperty), $reflectionProperty); |
280 | 280 | } |
281 | 281 |