Completed
Push — master ( 01e67d...72a24a )
by Marcin
17s queued 15s
created
src/Metadata/Driver/AttributeDriver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     protected function getClassAnnotations(\ReflectionClass $class): array
13 13
     {
14 14
         return array_map(
15
-            static function (\ReflectionAttribute $attribute): object {
15
+            static function(\ReflectionAttribute $attribute): object {
16 16
                 return $attribute->newInstance();
17 17
             },
18 18
             $class->getAttributes()
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     protected function getMethodAnnotations(\ReflectionMethod $method): array
26 26
     {
27 27
         return array_map(
28
-            static function (\ReflectionAttribute $attribute): object {
28
+            static function(\ReflectionAttribute $attribute): object {
29 29
                 return $attribute->newInstance();
30 30
             },
31 31
             $method->getAttributes()
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     protected function getPropertyAnnotations(\ReflectionProperty $property): array
39 39
     {
40 40
         return array_map(
41
-            static function (\ReflectionAttribute $attribute): object {
41
+            static function(\ReflectionAttribute $attribute): object {
42 42
                 return $attribute->newInstance();
43 43
             },
44 44
             $property->getAttributes()
Please login to merge, or discard this patch.
src/Metadata/Driver/TypedPropertiesDriver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
      */
124 124
     private function shouldTypeHint(?ReflectionType $reflectionType): bool
125 125
     {
126
-        if (!$reflectionType instanceof ReflectionNamedType) {
126
+        if ( ! $reflectionType instanceof ReflectionNamedType) {
127 127
             return false;
128 128
         }
129 129
 
Please login to merge, or discard this patch.
src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -108,25 +108,25 @@  discard block
 block discarded – undo
108 108
         if ($type instanceof ArrayTypeNode) {
109 109
             $resolvedType = $this->resolveTypeFromTypeNode($type->type, $reflector);
110 110
 
111
-            return 'array<' . $resolvedType . '>';
111
+            return 'array<'.$resolvedType.'>';
112 112
         }
113 113
 
114 114
         // Generic array syntax: array<Product> | array<\Foo\Bar\Product> | array<int,Product>
115 115
         if ($type instanceof GenericTypeNode) {
116 116
             if ($this->isSimpleType($type->type, 'array')) {
117
-                $resolvedTypes = array_map(function (TypeNode $node) use ($reflector) {
117
+                $resolvedTypes = array_map(function(TypeNode $node) use ($reflector) {
118 118
                     return $this->resolveTypeFromTypeNode($node, $reflector);
119 119
                 }, $type->genericTypes);
120 120
 
121
-                return 'array<' . implode(',', $resolvedTypes) . '>';
121
+                return 'array<'.implode(',', $resolvedTypes).'>';
122 122
             }
123 123
 
124 124
             if ($this->isSimpleType($type->type, 'list')) {
125
-                $resolvedTypes = array_map(function (TypeNode $node) use ($reflector) {
125
+                $resolvedTypes = array_map(function(TypeNode $node) use ($reflector) {
126 126
                     return $this->resolveTypeFromTypeNode($node, $reflector);
127 127
                 }, $type->genericTypes);
128 128
 
129
-                return 'array<int, ' . implode(',', $resolvedTypes) . '>';
129
+                return 'array<int, '.implode(',', $resolvedTypes).'>';
130 130
             }
131 131
 
132 132
             throw new \InvalidArgumentException(sprintf("Can't use non-array generic type %s for collection in %s:%s", (string) $type->type, $reflector->getDeclaringClass()->getName(), $reflector->getName()));
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             return [];
150 150
         }
151 151
 
152
-        return array_merge(...array_map(static function ($node) {
152
+        return array_merge(...array_map(static function($node) {
153 153
             if ($node->type instanceof UnionTypeNode) {
154 154
                 return $node->type->types;
155 155
             }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      */
194 194
     private function filterNullFromTypes(array $types): array
195 195
     {
196
-        return array_values(array_filter(array_map(function (TypeNode $node) {
196
+        return array_values(array_filter(array_map(function(TypeNode $node) {
197 197
             return $this->isNullType($node) ? null : $node;
198 198
         }, $types)));
199 199
     }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     private function resolveTypeFromTypeNode(TypeNode $typeNode, $reflector): string
238 238
     {
239
-        if (!($typeNode instanceof IdentifierTypeNode)) {
239
+        if ( ! ($typeNode instanceof IdentifierTypeNode)) {
240 240
             throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflector->getDeclaringClass()->getName(), $reflector->getName()));
241 241
         }
242 242
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             return $typeHint;
253 253
         }
254 254
 
255
-        $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint;
255
+        $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint;
256 256
         if ($this->isClassOrInterface($expandedClassName)) {
257 257
             return $expandedClassName;
258 258
         }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
     private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool
288 288
     {
289
-        $typeHintToSearchFor = '\\' . $typeHintToSearchFor;
289
+        $typeHintToSearchFor = '\\'.$typeHintToSearchFor;
290 290
 
291 291
         return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor;
292 292
     }
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements);
308 308
         for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) {
309 309
             foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) {
310
-                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement);
310
+                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement);
311 311
             }
312 312
         }
313 313
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      */
347 347
     private function resolveType(string $typeHint, $reflector): string
348 348
     {
349
-        if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) {
349
+        if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) {
350 350
             $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflector), $reflector);
351 351
         }
352 352
 
@@ -364,15 +364,15 @@  discard block
 block discarded – undo
364 364
     private function resolveTypeFromDocblock($reflector): array
365 365
     {
366 366
         $docComment = $reflector->getDocComment();
367
-        if (!$docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) {
367
+        if ( ! $docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) {
368 368
             $constructor = $reflector->getDeclaringClass()->getConstructor();
369
-            if (!$constructor) {
369
+            if ( ! $constructor) {
370 370
                 return [];
371 371
             }
372 372
 
373 373
             $docComment = $constructor->getDocComment();
374 374
 
375
-            if (!$docComment) {
375
+            if ( ! $docComment) {
376 376
                 return [];
377 377
             }
378 378
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             return $this->flattenParamTagValueTypes($reflector->getName(), $phpDocNode->getParamTagValues());
383 383
         }
384 384
 
385
-        if (!$docComment) {
385
+        if ( ! $docComment) {
386 386
             return [];
387 387
         }
388 388
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 
427 427
                     return sprintf('array<%s>', implode(
428 428
                         ',',
429
-                        array_map(static function (string $type) use ($reflector, $self) {
429
+                        array_map(static function(string $type) use ($reflector, $self) {
430 430
                             return $self->resolveType(trim($type), $reflector);
431 431
                         }, $types)
432 432
                     ));
Please login to merge, or discard this patch.
src/Type/Parser.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     {
38 38
         $this->lexer->moveNext();
39 39
 
40
-        if (!$this->lexer->token) {
40
+        if ( ! $this->lexer->token) {
41 41
             throw new SyntaxError(
42 42
                 'Syntax error, unexpected end of stream'
43 43
             );
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             }
60 60
 
61 61
             return $this->visitSimpleType();
62
-        } elseif (!$this->root && Lexer::T_ARRAY_START === $this->lexer->token->type) {
62
+        } elseif ( ! $this->root && Lexer::T_ARRAY_START === $this->lexer->token->type) {
63 63
             return $this->visitArrayType();
64 64
         }
65 65
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $this->match(Lexer::T_TYPE_START);
88 88
 
89 89
         $params = [];
90
-        if (!$this->lexer->isNextToken(Lexer::T_TYPE_END)) {
90
+        if ( ! $this->lexer->isNextToken(Lexer::T_TYPE_END)) {
91 91
             while (true) {
92 92
                 $params[] = $this->visit();
93 93
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
          */
116 116
 
117 117
         $params = [];
118
-        if (!$this->lexer->isNextToken(Lexer::T_ARRAY_END)) {
118
+        if ( ! $this->lexer->isNextToken(Lexer::T_ARRAY_END)) {
119 119
             while (true) {
120 120
                 $params[] = $this->visit();
121 121
                 if ($this->lexer->isNextToken(Lexer::T_ARRAY_END)) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
     private function match(int $token): void
135 135
     {
136
-        if (!$this->lexer->lookahead) {
136
+        if ( ! $this->lexer->lookahead) {
137 137
             throw new SyntaxError(
138 138
                 sprintf('Syntax error, unexpected end of stream, expected %s', $this->getConstant($token))
139 139
             );
Please login to merge, or discard this patch.
src/Annotation/Type.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
     public function __construct($values = [], $name = null)
23 23
     {
24
-        if ((null !== $name) && !is_string($name) && !(is_object($name) && method_exists($name, '__toString'))) {
24
+        if ((null !== $name) && ! is_string($name) && ! (is_object($name) && method_exists($name, '__toString'))) {
25 25
             throw new \RuntimeException(
26 26
                 'Type must be either string, null or object implements __toString() method.'
27 27
             );
Please login to merge, or discard this patch.
src/Metadata/Driver/YamlDriver.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function getAllClassNames(): array
72 72
     {
73
-        if (!$this->locator instanceof AdvancedFileLocatorInterface) {
73
+        if ( ! $this->locator instanceof AdvancedFileLocatorInterface) {
74 74
             throw new RuntimeException(
75 75
                 sprintf(
76 76
                     'Locator "%s" must be an instance of "AdvancedFileLocatorInterface".',
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     {
94 94
         $config = Yaml::parseFile($file, Yaml::PARSE_CONSTANT);
95 95
 
96
-        if (!isset($config[$name = $class->name])) {
96
+        if ( ! isset($config[$name = $class->name])) {
97 97
             throw new InvalidMetadataException(
98 98
                 sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file)
99 99
             );
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
                     );
131 131
                     unset($propertySettings['exp']);
132 132
                 } else {
133
-                    if (!$class->hasMethod($methodName)) {
133
+                    if ( ! $class->hasMethod($methodName)) {
134 134
                         throw new InvalidMetadataException(
135
-                            'The method ' . $methodName . ' not found in class ' . $class->name
135
+                            'The method '.$methodName.' not found in class '.$class->name
136 136
                         );
137 137
                     }
138 138
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             }
145 145
         }
146 146
 
147
-        if (!$excludeAll) {
147
+        if ( ! $excludeAll) {
148 148
             foreach ($class->getProperties() as $property) {
149 149
                 if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
150 150
                     continue;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
                 $pName = $property->getName();
154 154
                 $propertiesMetadata[] = new PropertyMetadata($name, $pName);
155
-                $propertiesData[] =  !empty($config['properties']) && true === array_key_exists($pName, $config['properties'])
155
+                $propertiesData[] = ! empty($config['properties']) && true === array_key_exists($pName, $config['properties'])
156 156
                     ? (array) $config['properties'][$pName]
157 157
                     : null;
158 158
             }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                     || isset($propertiesData[$propertyKey]);
165 165
 
166 166
                 $pConfig = $propertiesData[$propertyKey];
167
-                if (!empty($pConfig)) {
167
+                if ( ! empty($pConfig)) {
168 168
                     if (isset($pConfig['exclude'])) {
169 169
                         $isExclude = (bool) $pConfig['exclude'];
170 170
                     }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
                     }
195 195
 
196 196
                     if (isset($pConfig['expose_if'])) {
197
-                        $pMetadata->excludeIf = $this->parseExpression('!(' . $pConfig['expose_if'] . ')');
197
+                        $pMetadata->excludeIf = $this->parseExpression('!('.$pConfig['expose_if'].')');
198 198
                     }
199 199
 
200 200
                     if (isset($pConfig['serialized_name'])) {
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
                     }
303 303
                 }
304 304
 
305
-                if (!$pMetadata->serializedName) {
305
+                if ( ! $pMetadata->serializedName) {
306 306
                     $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata);
307 307
                 }
308 308
 
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
                     $metadata->isMap = $metadata->isMap || PropertyMetadata::isCollectionMap($pMetadata->type);
312 312
                 }
313 313
 
314
-                if (!empty($pConfig) && !empty($pConfig['name'])) {
314
+                if ( ! empty($pConfig) && ! empty($pConfig['name'])) {
315 315
                     $pMetadata->name = (string) $pConfig['name'];
316 316
                 }
317 317
 
318 318
                 if (
319
-                    (ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude)
319
+                    (ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude)
320 320
                     || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose)
321 321
                 ) {
322 322
                     $metadata->addPropertyMetadata($pMetadata);
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 
362 362
     private function addClassProperties(ClassMetadata $metadata, array $config): void
363 363
     {
364
-        if (isset($config['custom_accessor_order']) && !isset($config['accessor_order'])) {
364
+        if (isset($config['custom_accessor_order']) && ! isset($config['accessor_order'])) {
365 365
             $config['accessor_order'] = 'custom';
366 366
         }
367 367
 
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
             if (isset($config['discriminator']['disabled']) && true === $config['discriminator']['disabled']) {
392 392
                 $metadata->discriminatorDisabled = true;
393 393
             } else {
394
-                if (!isset($config['discriminator']['field_name'])) {
394
+                if ( ! isset($config['discriminator']['field_name'])) {
395 395
                     throw new InvalidMetadataException('The "field_name" attribute must be set for discriminators.');
396 396
                 }
397 397
 
398
-                if (!isset($config['discriminator']['map']) || !is_array($config['discriminator']['map'])) {
398
+                if ( ! isset($config['discriminator']['map']) || ! is_array($config['discriminator']['map'])) {
399 399
                     throw new InvalidMetadataException(
400 400
                         'The "map" attribute must be set, and be an array for discriminators.'
401 401
                     );
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     {
433 433
         if (is_string($config)) {
434 434
             $config = [$config];
435
-        } elseif (!is_array($config)) {
435
+        } elseif ( ! is_array($config)) {
436 436
             throw new InvalidMetadataException(
437 437
                 sprintf(
438 438
                     'callback methods expects a string, or an array of strings that represent method names, but got %s.',
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 
444 444
         $methods = [];
445 445
         foreach ($config as $name) {
446
-            if (!$class->hasMethod($name)) {
446
+            if ( ! $class->hasMethod($name)) {
447 447
                 throw new InvalidMetadataException(
448 448
                     sprintf('The method %s does not exist in class %s.', $name, $class->name)
449 449
                 );
Please login to merge, or discard this patch.