Passed
Push — master ( b281ee...ebe4ee )
by Asmir
05:07 queued 02:44
created
src/Handler/EnumHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         SerializationContext $context
46 46
     ) {
47 47
         if (isset($type['params'][1]) && 'value' === $type['params'][1]) {
48
-            if (!$enum instanceof \BackedEnum) {
48
+            if ( ! $enum instanceof \BackedEnum) {
49 49
                 throw new InvalidMetadataException(sprintf('The type "%s" is not a backed enum, thus you can not use "value" as serialization mode for its value.', get_class($enum)));
50 50
             }
51 51
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
         $caseValue = (string) $data;
68 68
 
69 69
         $ref = new \ReflectionEnum($enumType);
70
-        if (isset($type['params'][1]) && 'value' === $type['params'][1] || (!isset($type['params'][1]) && is_a($enumType, \BackedEnum::class, true))) {
71
-            if (!is_a($enumType, \BackedEnum::class, true)) {
70
+        if (isset($type['params'][1]) && 'value' === $type['params'][1] || ( ! isset($type['params'][1]) && is_a($enumType, \BackedEnum::class, true))) {
71
+            if ( ! is_a($enumType, \BackedEnum::class, true)) {
72 72
                 throw new InvalidMetadataException(sprintf('The type "%s" is not a backed enum, thus you can not use "value" as serialization mode for its value.', $enumType));
73 73
             }
74 74
 
75 75
             if ('int' === $ref->getBackingType()->getName()) {
76
-                if (!is_numeric($caseValue)) {
76
+                if ( ! is_numeric($caseValue)) {
77 77
                     throw new RuntimeException(sprintf('"%s" is not a valid backing value for enum "%s"', $caseValue, $enumType));
78 78
                 }
79 79
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
             return $enumType::from($caseValue);
84 84
         } else {
85
-            if (!$ref->hasCase($caseValue)) {
85
+            if ( ! $ref->hasCase($caseValue)) {
86 86
                 throw new InvalidMetadataException(sprintf('The type "%s" does not have the case "%s"', $ref->getName(), $caseValue));
87 87
             }
88 88
 
Please login to merge, or discard this patch.
src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -84,25 +84,25 @@  discard block
 block discarded – undo
84 84
         if ($type instanceof ArrayTypeNode) {
85 85
             $resolvedType = $this->resolveTypeFromTypeNode($type->type, $reflectionProperty);
86 86
 
87
-            return 'array<' . $resolvedType . '>';
87
+            return 'array<'.$resolvedType.'>';
88 88
         }
89 89
 
90 90
         // Generic array syntax: array<Product> | array<\Foo\Bar\Product> | array<int,Product>
91 91
         if ($type instanceof GenericTypeNode) {
92 92
             if ($this->isSimpleType($type->type, 'array')) {
93
-                $resolvedTypes = array_map(function (TypeNode $node) use ($reflectionProperty) {
93
+                $resolvedTypes = array_map(function(TypeNode $node) use ($reflectionProperty) {
94 94
                     return $this->resolveTypeFromTypeNode($node, $reflectionProperty);
95 95
                 }, $type->genericTypes);
96 96
 
97
-                return 'array<' . implode(',', $resolvedTypes) . '>';
97
+                return 'array<'.implode(',', $resolvedTypes).'>';
98 98
             }
99 99
 
100 100
             if ($this->isSimpleType($type->type, 'list')) {
101
-                $resolvedTypes = array_map(function (TypeNode $node) use ($reflectionProperty) {
101
+                $resolvedTypes = array_map(function(TypeNode $node) use ($reflectionProperty) {
102 102
                     return $this->resolveTypeFromTypeNode($node, $reflectionProperty);
103 103
                 }, $type->genericTypes);
104 104
 
105
-                return 'array<int, ' . implode(',', $resolvedTypes) . '>';
105
+                return 'array<int, '.implode(',', $resolvedTypes).'>';
106 106
             }
107 107
 
108 108
             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()));
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
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
             }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     private function filterNullFromTypes(array $types): array
171 171
     {
172
-        return array_values(array_filter(array_map(function (TypeNode $node) {
172
+        return array_values(array_filter(array_map(function(TypeNode $node) {
173 173
             return $this->isNullType($node) ? null : $node;
174 174
         }, $types)));
175 175
     }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     private function resolveTypeFromTypeNode(TypeNode $typeNode, \ReflectionProperty $reflectionProperty): string
214 214
     {
215
-        if (!($typeNode instanceof IdentifierTypeNode)) {
215
+        if ( ! ($typeNode instanceof IdentifierTypeNode)) {
216 216
             throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflectionProperty->getDeclaringClass()->getName(), $reflectionProperty->getName()));
217 217
         }
218 218
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
             return $typeHint;
226 226
         }
227 227
 
228
-        $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint;
228
+        $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint;
229 229
         if ($this->isClassOrInterface($expandedClassName)) {
230 230
             return $expandedClassName;
231 231
         }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 
260 260
     private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool
261 261
     {
262
-        $typeHintToSearchFor = '\\' . $typeHintToSearchFor;
262
+        $typeHintToSearchFor = '\\'.$typeHintToSearchFor;
263 263
 
264 264
         return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor;
265 265
     }
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements);
281 281
         for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) {
282 282
             foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) {
283
-                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement);
283
+                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement);
284 284
             }
285 285
         }
286 286
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
     private function resolveType(string $typeHint, \ReflectionProperty $reflectionProperty): string
315 315
     {
316
-        if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) {
316
+        if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) {
317 317
             $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflectionProperty), $reflectionProperty);
318 318
         }
319 319
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     private function resolveTypeFromDocblock(\ReflectionProperty $reflectionProperty): ?array
329 329
     {
330 330
         $docComment = $reflectionProperty->getDocComment();
331
-        if (!$docComment && PHP_VERSION_ID >= 80000 && $reflectionProperty->isPromoted()) {
331
+        if ( ! $docComment && PHP_VERSION_ID >= 80000 && $reflectionProperty->isPromoted()) {
332 332
             $docComment = $reflectionProperty->getDeclaringClass()->getConstructor()->getDocComment();
333 333
 
334 334
             $tokens = $this->lexer->tokenize($docComment);
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
             return $this->flattenParamTagValueTypes($reflectionProperty->getName(), $phpDocNode->getParamTagValues());
338 338
         }
339 339
 
340
-        if (!$docComment) {
340
+        if ( ! $docComment) {
341 341
             return null;
342 342
         }
343 343
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 
373 373
                     return sprintf('array<%s>', implode(
374 374
                         ',',
375
-                        array_map(static function (string $type) use ($reflectionProperty, $self) {
375
+                        array_map(static function(string $type) use ($reflectionProperty, $self) {
376 376
                             return $self->resolveType(trim($type), $reflectionProperty);
377 377
                         }, $types)
378 378
                     ));
Please login to merge, or discard this patch.
src/EventDispatcher/Subscriber/EnumSubscriber.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     {
14 14
         $type = $event->getType();
15 15
 
16
-        if (isset($type['name']) && ('enum' === $type['name'] || !is_a($type['name'], \UnitEnum::class, true))) {
16
+        if (isset($type['name']) && ('enum' === $type['name'] || ! is_a($type['name'], \UnitEnum::class, true))) {
17 17
             return;
18 18
         }
19 19
 
Please login to merge, or discard this patch.