@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | private function match($token) |
| 303 | 303 | { |
| 304 | - if ( ! $this->lexer->isNextToken($token) ) { |
|
| 304 | + if (!$this->lexer->isNextToken($token)) { |
|
| 305 | 305 | $this->syntaxError($this->lexer->getLiteral($token)); |
| 306 | 306 | } |
| 307 | 307 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | private function matchAny(array $tokens) |
| 322 | 322 | { |
| 323 | - if ( ! $this->lexer->isNextTokenAny($tokens)) { |
|
| 323 | + if (!$this->lexer->isNextTokenAny($tokens)) { |
|
| 324 | 324 | $this->syntaxError(implode(' or ', array_map([$this->lexer, 'getLiteral'], $tokens))); |
| 325 | 325 | } |
| 326 | 326 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | : sprintf("'%s' at position %s", $token['value'], $token['position']); |
| 350 | 350 | |
| 351 | 351 | if (strlen($this->context)) { |
| 352 | - $message .= ' in ' . $this->context; |
|
| 352 | + $message .= ' in '.$this->context; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | $message .= '.'; |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | self::$metadataParser->setTarget(Target::TARGET_CLASS); |
| 417 | 417 | |
| 418 | - foreach (self::$metadataParser->parse($docComment, 'class @' . $name) as $annotation) { |
|
| 418 | + foreach (self::$metadataParser->parse($docComment, 'class @'.$name) as $annotation) { |
|
| 419 | 419 | if ($annotation instanceof Target) { |
| 420 | 420 | $annotationBuilder->withTarget(AnnotationTarget::fromAnnotation($annotation)); |
| 421 | 421 | |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | $attribute = new Attribute(); |
| 460 | 460 | $attribute->required = (false !== strpos($propertyComment, '@Required')); |
| 461 | 461 | $attribute->name = $property->name; |
| 462 | - $attribute->type = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/',$propertyComment, $matches)) |
|
| 462 | + $attribute->type = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/', $propertyComment, $matches)) |
|
| 463 | 463 | ? $matches[1] |
| 464 | 464 | : 'mixed'; |
| 465 | 465 | |
@@ -467,18 +467,18 @@ discard block |
||
| 467 | 467 | |
| 468 | 468 | // checks if the property has @Enum |
| 469 | 469 | if (false !== strpos($propertyComment, '@Enum')) { |
| 470 | - $context = 'property ' . $class->name . "::\$" . $property->name; |
|
| 470 | + $context = 'property '.$class->name."::\$".$property->name; |
|
| 471 | 471 | |
| 472 | 472 | self::$metadataParser->setTarget(Target::TARGET_PROPERTY); |
| 473 | 473 | |
| 474 | 474 | foreach (self::$metadataParser->parse($propertyComment, $context) as $annotation) { |
| 475 | - if ( ! $annotation instanceof Enum) { |
|
| 475 | + if (!$annotation instanceof Enum) { |
|
| 476 | 476 | continue; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $propertyBuilder = $propertyBuilder->withEnum([ |
| 480 | 480 | 'value' => $annotation->value, |
| 481 | - 'literal' => ( ! empty($annotation->literal)) |
|
| 481 | + 'literal' => (!empty($annotation->literal)) |
|
| 482 | 482 | ? $annotation->literal |
| 483 | 483 | : $annotation->value, |
| 484 | 484 | ]); |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | |
| 609 | 609 | if ('\\' !== $name[0]) { |
| 610 | 610 | $pos = strpos($name, '\\'); |
| 611 | - $alias = (false === $pos)? $name : substr($name, 0, $pos); |
|
| 611 | + $alias = (false === $pos) ? $name : substr($name, 0, $pos); |
|
| 612 | 612 | $found = false; |
| 613 | 613 | $loweredAlias = strtolower($alias); |
| 614 | 614 | |
@@ -623,19 +623,19 @@ discard block |
||
| 623 | 623 | } elseif (isset($this->imports[$loweredAlias])) { |
| 624 | 624 | $found = true; |
| 625 | 625 | $name = (false !== $pos) |
| 626 | - ? $this->imports[$loweredAlias] . substr($name, $pos) |
|
| 626 | + ? $this->imports[$loweredAlias].substr($name, $pos) |
|
| 627 | 627 | : $this->imports[$loweredAlias]; |
| 628 | - } elseif ( ! isset($this->ignoredAnnotationNames[$name]) |
|
| 628 | + } elseif (!isset($this->ignoredAnnotationNames[$name]) |
|
| 629 | 629 | && isset($this->imports['__NAMESPACE__']) |
| 630 | - && $this->classExists($this->imports['__NAMESPACE__'] . '\\' . $name) |
|
| 630 | + && $this->classExists($this->imports['__NAMESPACE__'].'\\'.$name) |
|
| 631 | 631 | ) { |
| 632 | 632 | $name = $this->imports['__NAMESPACE__'].'\\'.$name; |
| 633 | 633 | $found = true; |
| 634 | - } elseif (! isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { |
|
| 634 | + } elseif (!isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { |
|
| 635 | 635 | $found = true; |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - if ( ! $found) { |
|
| 638 | + if (!$found) { |
|
| 639 | 639 | if ($this->isIgnoredAnnotation($name)) { |
| 640 | 640 | return false; |
| 641 | 641 | } |
@@ -644,9 +644,9 @@ discard block |
||
| 644 | 644 | } |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | - $name = ltrim($name,'\\'); |
|
| 647 | + $name = ltrim($name, '\\'); |
|
| 648 | 648 | |
| 649 | - if ( ! $this->classExists($name)) { |
|
| 649 | + if (!$this->classExists($name)) { |
|
| 650 | 650 | throw AnnotationException::semanticalError(sprintf('The annotation "@%s" in %s does not exist, or could not be auto-loaded.', $name, $this->context)); |
| 651 | 651 | } |
| 652 | 652 | |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | |
| 657 | 657 | |
| 658 | 658 | // collects the metadata annotation only if there is not yet |
| 659 | - if (! $this->metadata->has($name) && ! array_key_exists($name, $this->nonAnnotationClasses)) { |
|
| 659 | + if (!$this->metadata->has($name) && !array_key_exists($name, $this->nonAnnotationClasses)) { |
|
| 660 | 660 | $this->collectAnnotationMetadata($name); |
| 661 | 661 | } |
| 662 | 662 | |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | $enum = $property->getEnum(); |
| 693 | 693 | |
| 694 | 694 | // checks if the attribute is a valid enumerator |
| 695 | - if ($enum !== null && isset($values[$propertyName]) && ! in_array($values[$propertyName], $enum['value'])) { |
|
| 695 | + if ($enum !== null && isset($values[$propertyName]) && !in_array($values[$propertyName], $enum['value'])) { |
|
| 696 | 696 | throw AnnotationException::enumeratorError($propertyName, $name, $this->context, $enum['literal'], $values[$propertyName]); |
| 697 | 697 | } |
| 698 | 698 | } |
@@ -708,9 +708,9 @@ discard block |
||
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | // handle a not given attribute or null value |
| 711 | - if (! isset($values[$valueName])) { |
|
| 711 | + if (!isset($values[$valueName])) { |
|
| 712 | 712 | if ($property->isRequired()) { |
| 713 | - throw AnnotationException::requiredError($propertyName, $originalName, $this->context, 'a(n) ' . $type['value']); |
|
| 713 | + throw AnnotationException::requiredError($propertyName, $originalName, $this->context, 'a(n) '.$type['value']); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | continue; |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | |
| 719 | 719 | if ($type !== null && $type['type'] === 'array') { |
| 720 | 720 | // handle the case of a single value |
| 721 | - if ( ! is_array($values[$valueName])) { |
|
| 721 | + if (!is_array($values[$valueName])) { |
|
| 722 | 722 | $values[$valueName] = [$values[$valueName]]; |
| 723 | 723 | } |
| 724 | 724 | |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | $instance = new $name(); |
| 745 | 745 | |
| 746 | 746 | foreach ($values as $property => $value) { |
| 747 | - if (! isset($metadata->getProperties()[$property])) { |
|
| 747 | + if (!isset($metadata->getProperties()[$property])) { |
|
| 748 | 748 | if ('value' !== $property) { |
| 749 | 749 | throw AnnotationException::creationError( |
| 750 | 750 | sprintf( |
@@ -782,13 +782,13 @@ discard block |
||
| 782 | 782 | { |
| 783 | 783 | $values = []; |
| 784 | 784 | |
| 785 | - if ( ! $this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { |
|
| 785 | + if (!$this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { |
|
| 786 | 786 | return $values; |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | $this->match(DocLexer::T_OPEN_PARENTHESIS); |
| 790 | 790 | |
| 791 | - if ( ! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { |
|
| 791 | + if (!$this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { |
|
| 792 | 792 | $values = $this->Values(); |
| 793 | 793 | } |
| 794 | 794 | |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | $token = $this->lexer->lookahead; |
| 817 | 817 | $value = $this->Value(); |
| 818 | 818 | |
| 819 | - if ( ! is_object($value) && ! is_array($value)) { |
|
| 819 | + if (!is_object($value) && !is_array($value)) { |
|
| 820 | 820 | $this->syntaxError('Value', $token); |
| 821 | 821 | } |
| 822 | 822 | |
@@ -826,10 +826,10 @@ discard block |
||
| 826 | 826 | foreach ($values as $k => $value) { |
| 827 | 827 | if (is_object($value) && $value instanceof \stdClass) { |
| 828 | 828 | $values[$value->name] = $value->value; |
| 829 | - } else if ( ! isset($values['value'])){ |
|
| 829 | + } else if (!isset($values['value'])) { |
|
| 830 | 830 | $values['value'] = $value; |
| 831 | 831 | } else { |
| 832 | - if ( ! is_array($values['value'])) { |
|
| 832 | + if (!is_array($values['value'])) { |
|
| 833 | 833 | $values['value'] = [$values['value']]; |
| 834 | 834 | } |
| 835 | 835 | |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | { |
| 854 | 854 | $identifier = $this->Identifier(); |
| 855 | 855 | |
| 856 | - if ( ! defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { |
|
| 856 | + if (!defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { |
|
| 857 | 857 | list($className, $const) = explode('::', $identifier); |
| 858 | 858 | |
| 859 | 859 | $pos = strpos($className, '\\'); |
@@ -875,12 +875,12 @@ discard block |
||
| 875 | 875 | case isset($this->imports[$loweredAlias]): |
| 876 | 876 | $found = true; |
| 877 | 877 | $className = (false !== $pos) |
| 878 | - ? $this->imports[$loweredAlias] . substr($className, $pos) |
|
| 878 | + ? $this->imports[$loweredAlias].substr($className, $pos) |
|
| 879 | 879 | : $this->imports[$loweredAlias]; |
| 880 | 880 | break; |
| 881 | 881 | |
| 882 | 882 | default: |
| 883 | - if(isset($this->imports['__NAMESPACE__'])) { |
|
| 883 | + if (isset($this->imports['__NAMESPACE__'])) { |
|
| 884 | 884 | $ns = $this->imports['__NAMESPACE__']; |
| 885 | 885 | |
| 886 | 886 | if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | if ($found) { |
| 895 | - $identifier = $className . '::' . $const; |
|
| 895 | + $identifier = $className.'::'.$const; |
|
| 896 | 896 | } |
| 897 | 897 | } |
| 898 | 898 | |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | private function Identifier() |
| 918 | 918 | { |
| 919 | 919 | // check if we have an annotation |
| 920 | - if ( ! $this->lexer->isNextTokenAny(self::$classIdentifiers)) { |
|
| 920 | + if (!$this->lexer->isNextTokenAny(self::$classIdentifiers)) { |
|
| 921 | 921 | $this->syntaxError('namespace separator or identifier'); |
| 922 | 922 | } |
| 923 | 923 | |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | $this->match(DocLexer::T_NAMESPACE_SEPARATOR); |
| 932 | 932 | $this->matchAny(self::$classIdentifiers); |
| 933 | 933 | |
| 934 | - $className .= '\\' . $this->lexer->token['value']; |
|
| 934 | + $className .= '\\'.$this->lexer->token['value']; |
|
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | return $className; |
@@ -979,11 +979,11 @@ discard block |
||
| 979 | 979 | |
| 980 | 980 | case DocLexer::T_INTEGER: |
| 981 | 981 | $this->match(DocLexer::T_INTEGER); |
| 982 | - return (int)$this->lexer->token['value']; |
|
| 982 | + return (int) $this->lexer->token['value']; |
|
| 983 | 983 | |
| 984 | 984 | case DocLexer::T_FLOAT: |
| 985 | 985 | $this->match(DocLexer::T_FLOAT); |
| 986 | - return (float)$this->lexer->token['value']; |
|
| 986 | + return (float) $this->lexer->token['value']; |
|
| 987 | 987 | |
| 988 | 988 | case DocLexer::T_TRUE: |
| 989 | 989 | $this->match(DocLexer::T_TRUE); |
@@ -1111,9 +1111,9 @@ discard block |
||
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | 1113 | foreach (array_keys($this->ignoredAnnotationNamespaces) as $ignoredAnnotationNamespace) { |
| 1114 | - $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\') . '\\'; |
|
| 1114 | + $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\').'\\'; |
|
| 1115 | 1115 | |
| 1116 | - if (0 === stripos(rtrim($name, '\\') . '\\', $ignoredAnnotationNamespace)) { |
|
| 1116 | + if (0 === stripos(rtrim($name, '\\').'\\', $ignoredAnnotationNamespace)) { |
|
| 1117 | 1117 | return true; |
| 1118 | 1118 | } |
| 1119 | 1119 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | implode( |
| 24 | 24 | '", "', |
| 25 | 25 | array_map( |
| 26 | - static function (PropertyMetadata $property) : string { |
|
| 26 | + static function(PropertyMetadata $property) : string { |
|
| 27 | 27 | return $property->getName(); |
| 28 | 28 | }, |
| 29 | 29 | $properties |