@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | 'array_type'=>'string', |
| 153 | 153 | 'value' =>'array<string>' |
| 154 | 154 | ] |
| 155 | - ], |
|
| 155 | + ], |
|
| 156 | 156 | ], |
| 157 | 157 | Annotation\Attribute::class => [ |
| 158 | 158 | 'is_annotation' => true, |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | 'type' =>'boolean', |
| 182 | 182 | 'value' =>'boolean' |
| 183 | 183 | ] |
| 184 | - ], |
|
| 184 | + ], |
|
| 185 | 185 | ], |
| 186 | 186 | Annotation\Attributes::class => [ |
| 187 | 187 | 'is_annotation' => true, |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | 'array_type'=>Annotation\Attribute::class, |
| 200 | 200 | 'value' =>'array<' . Annotation\Attribute::class . '>' |
| 201 | 201 | ] |
| 202 | - ], |
|
| 202 | + ], |
|
| 203 | 203 | ], |
| 204 | 204 | Annotation\Enum::class => [ |
| 205 | 205 | 'is_annotation' => true, |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | 'type' => 'array', |
| 220 | 220 | 'required' => false, |
| 221 | 221 | ], |
| 222 | - ], |
|
| 222 | + ], |
|
| 223 | 223 | ], |
| 224 | 224 | ]; |
| 225 | 225 | |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | if (0 === (self::$annotationMetadata[$name]['targets'] & $target) && $target) { |
| 770 | 770 | throw AnnotationException::semanticalError( |
| 771 | 771 | sprintf('Annotation @%s is not allowed to be declared on %s. You may only use this annotation on these code elements: %s.', |
| 772 | - $originalName, $this->context, self::$annotationMetadata[$name]['targets_literal']) |
|
| 772 | + $originalName, $this->context, self::$annotationMetadata[$name]['targets_literal']) |
|
| 773 | 773 | ); |
| 774 | 774 | } |
| 775 | 775 | |
@@ -938,9 +938,9 @@ discard block |
||
| 938 | 938 | case !empty ($this->namespaces): |
| 939 | 939 | foreach ($this->namespaces as $ns) { |
| 940 | 940 | if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { |
| 941 | - $className = $ns.'\\'.$className; |
|
| 942 | - $found = true; |
|
| 943 | - break; |
|
| 941 | + $className = $ns.'\\'.$className; |
|
| 942 | + $found = true; |
|
| 943 | + break; |
|
| 944 | 944 | } |
| 945 | 945 | } |
| 946 | 946 | break; |
@@ -965,7 +965,7 @@ discard block |
||
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | if ($found) { |
| 968 | - $identifier = $className . '::' . $const; |
|
| 968 | + $identifier = $className . '::' . $const; |
|
| 969 | 969 | } |
| 970 | 970 | } |
| 971 | 971 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | 'type' =>'array', |
| 198 | 198 | 'required' =>true, |
| 199 | 199 | 'array_type'=>Annotation\Attribute::class, |
| 200 | - 'value' =>'array<' . Annotation\Attribute::class . '>' |
|
| 200 | + 'value' =>'array<'.Annotation\Attribute::class.'>' |
|
| 201 | 201 | ] |
| 202 | 202 | ], |
| 203 | 203 | ], |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | */ |
| 391 | 391 | private function match($token) |
| 392 | 392 | { |
| 393 | - if ( ! $this->lexer->isNextToken($token) ) { |
|
| 393 | + if (!$this->lexer->isNextToken($token)) { |
|
| 394 | 394 | $this->syntaxError($this->lexer->getLiteral($token)); |
| 395 | 395 | } |
| 396 | 396 | |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | */ |
| 410 | 410 | private function matchAny(array $tokens) |
| 411 | 411 | { |
| 412 | - if ( ! $this->lexer->isNextTokenAny($tokens)) { |
|
| 412 | + if (!$this->lexer->isNextTokenAny($tokens)) { |
|
| 413 | 413 | $this->syntaxError(implode(' or ', array_map([$this->lexer, 'getLiteral'], $tokens))); |
| 414 | 414 | } |
| 415 | 415 | |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | : sprintf("'%s' at position %s", $token['value'], $token['position']); |
| 439 | 439 | |
| 440 | 440 | if (strlen($this->context)) { |
| 441 | - $message .= ' in ' . $this->context; |
|
| 441 | + $message .= ' in '.$this->context; |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | $message .= '.'; |
@@ -490,10 +490,10 @@ discard block |
||
| 490 | 490 | 'attributes' => Annotation\Attributes::class |
| 491 | 491 | ]); |
| 492 | 492 | |
| 493 | - AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Enum.php'); |
|
| 494 | - AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Target.php'); |
|
| 495 | - AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Attribute.php'); |
|
| 496 | - AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Attributes.php'); |
|
| 493 | + AnnotationRegistry::registerFile(__DIR__.'/Annotation/Enum.php'); |
|
| 494 | + AnnotationRegistry::registerFile(__DIR__.'/Annotation/Target.php'); |
|
| 495 | + AnnotationRegistry::registerFile(__DIR__.'/Annotation/Attribute.php'); |
|
| 496 | + AnnotationRegistry::registerFile(__DIR__.'/Annotation/Attributes.php'); |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | $class = new \ReflectionClass($name); |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | if ($metadata['is_annotation']) { |
| 516 | 516 | self::$metadataParser->setTarget(Target::TARGET_CLASS); |
| 517 | 517 | |
| 518 | - foreach (self::$metadataParser->parse($docComment, 'class @' . $name) as $annotation) { |
|
| 518 | + foreach (self::$metadataParser->parse($docComment, 'class @'.$name) as $annotation) { |
|
| 519 | 519 | if ($annotation instanceof Target) { |
| 520 | 520 | $metadata['targets'] = $annotation->targets; |
| 521 | 521 | $metadata['targets_literal'] = $annotation->literal; |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | $attribute->required = (false !== strpos($propertyComment, '@Required')); |
| 546 | 546 | $attribute->name = $property->name; |
| 547 | - $attribute->type = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/',$propertyComment, $matches)) |
|
| 547 | + $attribute->type = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/', $propertyComment, $matches)) |
|
| 548 | 548 | ? $matches[1] |
| 549 | 549 | : 'mixed'; |
| 550 | 550 | |
@@ -552,17 +552,17 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | // checks if the property has @Enum |
| 554 | 554 | if (false !== strpos($propertyComment, '@Enum')) { |
| 555 | - $context = 'property ' . $class->name . "::\$" . $property->name; |
|
| 555 | + $context = 'property '.$class->name."::\$".$property->name; |
|
| 556 | 556 | |
| 557 | 557 | self::$metadataParser->setTarget(Target::TARGET_PROPERTY); |
| 558 | 558 | |
| 559 | 559 | foreach (self::$metadataParser->parse($propertyComment, $context) as $annotation) { |
| 560 | - if ( ! $annotation instanceof Enum) { |
|
| 560 | + if (!$annotation instanceof Enum) { |
|
| 561 | 561 | continue; |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | $metadata['enum'][$property->name]['value'] = $annotation->value; |
| 565 | - $metadata['enum'][$property->name]['literal'] = ( ! empty($annotation->literal)) |
|
| 565 | + $metadata['enum'][$property->name]['literal'] = (!empty($annotation->literal)) |
|
| 566 | 566 | ? $annotation->literal |
| 567 | 567 | : $annotation->value; |
| 568 | 568 | } |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | |
| 698 | 698 | if ('\\' !== $name[0]) { |
| 699 | 699 | $pos = strpos($name, '\\'); |
| 700 | - $alias = (false === $pos)? $name : substr($name, 0, $pos); |
|
| 700 | + $alias = (false === $pos) ? $name : substr($name, 0, $pos); |
|
| 701 | 701 | $found = false; |
| 702 | 702 | $loweredAlias = strtolower($alias); |
| 703 | 703 | |
@@ -712,20 +712,20 @@ discard block |
||
| 712 | 712 | } elseif (isset($this->imports[$loweredAlias])) { |
| 713 | 713 | $namespace = ltrim($this->imports[$loweredAlias], '\\'); |
| 714 | 714 | $name = (false !== $pos) |
| 715 | - ? $namespace . substr($name, $pos) |
|
| 715 | + ? $namespace.substr($name, $pos) |
|
| 716 | 716 | : $namespace; |
| 717 | 717 | $found = $this->classExists($name); |
| 718 | - } elseif ( ! isset($this->ignoredAnnotationNames[$name]) |
|
| 718 | + } elseif (!isset($this->ignoredAnnotationNames[$name]) |
|
| 719 | 719 | && isset($this->imports['__NAMESPACE__']) |
| 720 | - && $this->classExists($this->imports['__NAMESPACE__'] . '\\' . $name) |
|
| 720 | + && $this->classExists($this->imports['__NAMESPACE__'].'\\'.$name) |
|
| 721 | 721 | ) { |
| 722 | 722 | $name = $this->imports['__NAMESPACE__'].'\\'.$name; |
| 723 | 723 | $found = true; |
| 724 | - } elseif (! isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { |
|
| 724 | + } elseif (!isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { |
|
| 725 | 725 | $found = true; |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - if ( ! $found) { |
|
| 728 | + if (!$found) { |
|
| 729 | 729 | if ($this->isIgnoredAnnotation($name)) { |
| 730 | 730 | return false; |
| 731 | 731 | } |
@@ -734,9 +734,9 @@ discard block |
||
| 734 | 734 | } |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | - $name = ltrim($name,'\\'); |
|
| 737 | + $name = ltrim($name, '\\'); |
|
| 738 | 738 | |
| 739 | - if ( ! $this->classExists($name)) { |
|
| 739 | + if (!$this->classExists($name)) { |
|
| 740 | 740 | throw AnnotationException::semanticalError(sprintf('The annotation "@%s" in %s does not exist, or could not be auto-loaded.', $name, $this->context)); |
| 741 | 741 | } |
| 742 | 742 | |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | |
| 747 | 747 | |
| 748 | 748 | // collects the metadata annotation only if there is not yet |
| 749 | - if ( ! isset(self::$annotationMetadata[$name])) { |
|
| 749 | + if (!isset(self::$annotationMetadata[$name])) { |
|
| 750 | 750 | $this->collectAnnotationMetadata($name); |
| 751 | 751 | } |
| 752 | 752 | |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | // checks all declared attributes |
| 780 | 780 | foreach (self::$annotationMetadata[$name]['enum'] as $property => $enum) { |
| 781 | 781 | // checks if the attribute is a valid enumerator |
| 782 | - if (isset($values[$property]) && ! in_array($values[$property], $enum['value'])) { |
|
| 782 | + if (isset($values[$property]) && !in_array($values[$property], $enum['value'])) { |
|
| 783 | 783 | throw AnnotationException::enumeratorError($property, $name, $this->context, $enum['literal'], $values[$property]); |
| 784 | 784 | } |
| 785 | 785 | } |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | |
| 804 | 804 | if ($type['type'] === 'array') { |
| 805 | 805 | // handle the case of a single value |
| 806 | - if ( ! is_array($values[$property])) { |
|
| 806 | + if (!is_array($values[$property])) { |
|
| 807 | 807 | $values[$property] = [$values[$property]]; |
| 808 | 808 | } |
| 809 | 809 | |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | } |
| 836 | 836 | |
| 837 | 837 | // handle the case if the property has no annotations |
| 838 | - if ( ! $property = self::$annotationMetadata[$name]['default_property']) { |
|
| 838 | + if (!$property = self::$annotationMetadata[$name]['default_property']) { |
|
| 839 | 839 | throw AnnotationException::creationError(sprintf('The annotation @%s declared on %s does not accept any values, but got %s.', $originalName, $this->context, json_encode($values))); |
| 840 | 840 | } |
| 841 | 841 | } |
@@ -855,13 +855,13 @@ discard block |
||
| 855 | 855 | { |
| 856 | 856 | $values = []; |
| 857 | 857 | |
| 858 | - if ( ! $this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { |
|
| 858 | + if (!$this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { |
|
| 859 | 859 | return $values; |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | 862 | $this->match(DocLexer::T_OPEN_PARENTHESIS); |
| 863 | 863 | |
| 864 | - if ( ! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { |
|
| 864 | + if (!$this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { |
|
| 865 | 865 | $values = $this->Values(); |
| 866 | 866 | } |
| 867 | 867 | |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | $token = $this->lexer->lookahead; |
| 890 | 890 | $value = $this->Value(); |
| 891 | 891 | |
| 892 | - if ( ! is_object($value) && ! is_array($value)) { |
|
| 892 | + if (!is_object($value) && !is_array($value)) { |
|
| 893 | 893 | $this->syntaxError('Value', $token); |
| 894 | 894 | } |
| 895 | 895 | |
@@ -899,10 +899,10 @@ discard block |
||
| 899 | 899 | foreach ($values as $k => $value) { |
| 900 | 900 | if (is_object($value) && $value instanceof \stdClass) { |
| 901 | 901 | $values[$value->name] = $value->value; |
| 902 | - } else if ( ! isset($values['value'])){ |
|
| 902 | + } else if (!isset($values['value'])) { |
|
| 903 | 903 | $values['value'] = $value; |
| 904 | 904 | } else { |
| 905 | - if ( ! is_array($values['value'])) { |
|
| 905 | + if (!is_array($values['value'])) { |
|
| 906 | 906 | $values['value'] = [$values['value']]; |
| 907 | 907 | } |
| 908 | 908 | |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | { |
| 927 | 927 | $identifier = $this->Identifier(); |
| 928 | 928 | |
| 929 | - if ( ! defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { |
|
| 929 | + if (!defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { |
|
| 930 | 930 | list($className, $const) = explode('::', $identifier); |
| 931 | 931 | |
| 932 | 932 | $pos = strpos($className, '\\'); |
@@ -948,12 +948,12 @@ discard block |
||
| 948 | 948 | case isset($this->imports[$loweredAlias]): |
| 949 | 949 | $found = true; |
| 950 | 950 | $className = (false !== $pos) |
| 951 | - ? $this->imports[$loweredAlias] . substr($className, $pos) |
|
| 951 | + ? $this->imports[$loweredAlias].substr($className, $pos) |
|
| 952 | 952 | : $this->imports[$loweredAlias]; |
| 953 | 953 | break; |
| 954 | 954 | |
| 955 | 955 | default: |
| 956 | - if(isset($this->imports['__NAMESPACE__'])) { |
|
| 956 | + if (isset($this->imports['__NAMESPACE__'])) { |
|
| 957 | 957 | $ns = $this->imports['__NAMESPACE__']; |
| 958 | 958 | |
| 959 | 959 | if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { |
@@ -965,14 +965,14 @@ discard block |
||
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | if ($found) { |
| 968 | - $identifier = $className . '::' . $const; |
|
| 968 | + $identifier = $className.'::'.$const; |
|
| 969 | 969 | } |
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | /** |
| 973 | 973 | * Checks if identifier ends with ::class and remove the leading backslash if it exists. |
| 974 | 974 | */ |
| 975 | - if ($this->identifierEndsWithClassConstant($identifier) && ! $this->identifierStartsWithBackslash($identifier)) { |
|
| 975 | + if ($this->identifierEndsWithClassConstant($identifier) && !$this->identifierStartsWithBackslash($identifier)) { |
|
| 976 | 976 | return substr($identifier, 0, $this->getClassConstantPositionInIdentifier($identifier)); |
| 977 | 977 | } |
| 978 | 978 | if ($this->identifierEndsWithClassConstant($identifier) && $this->identifierStartsWithBackslash($identifier)) { |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | private function Identifier() |
| 1013 | 1013 | { |
| 1014 | 1014 | // check if we have an annotation |
| 1015 | - if ( ! $this->lexer->isNextTokenAny(self::$classIdentifiers)) { |
|
| 1015 | + if (!$this->lexer->isNextTokenAny(self::$classIdentifiers)) { |
|
| 1016 | 1016 | $this->syntaxError('namespace separator or identifier'); |
| 1017 | 1017 | } |
| 1018 | 1018 | |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | $this->match(DocLexer::T_NAMESPACE_SEPARATOR); |
| 1029 | 1029 | $this->matchAny(self::$classIdentifiers); |
| 1030 | 1030 | |
| 1031 | - $className .= '\\' . $this->lexer->token['value']; |
|
| 1031 | + $className .= '\\'.$this->lexer->token['value']; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | return $className; |
@@ -1076,11 +1076,11 @@ discard block |
||
| 1076 | 1076 | |
| 1077 | 1077 | case DocLexer::T_INTEGER: |
| 1078 | 1078 | $this->match(DocLexer::T_INTEGER); |
| 1079 | - return (int)$this->lexer->token['value']; |
|
| 1079 | + return (int) $this->lexer->token['value']; |
|
| 1080 | 1080 | |
| 1081 | 1081 | case DocLexer::T_FLOAT: |
| 1082 | 1082 | $this->match(DocLexer::T_FLOAT); |
| 1083 | - return (float)$this->lexer->token['value']; |
|
| 1083 | + return (float) $this->lexer->token['value']; |
|
| 1084 | 1084 | |
| 1085 | 1085 | case DocLexer::T_TRUE: |
| 1086 | 1086 | $this->match(DocLexer::T_TRUE); |
@@ -1208,9 +1208,9 @@ discard block |
||
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | foreach (array_keys($this->ignoredAnnotationNamespaces) as $ignoredAnnotationNamespace) { |
| 1211 | - $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\') . '\\'; |
|
| 1211 | + $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\').'\\'; |
|
| 1212 | 1212 | |
| 1213 | - if (0 === stripos(rtrim($name, '\\') . '\\', $ignoredAnnotationNamespace)) { |
|
| 1213 | + if (0 === stripos(rtrim($name, '\\').'\\', $ignoredAnnotationNamespace)) { |
|
| 1214 | 1214 | return true; |
| 1215 | 1215 | } |
| 1216 | 1216 | } |