@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | */ |
374 | 374 | private function match($token) |
375 | 375 | { |
376 | - if ( ! $this->lexer->isNextToken($token) ) { |
|
376 | + if (!$this->lexer->isNextToken($token)) { |
|
377 | 377 | $this->syntaxError($this->lexer->getLiteral($token)); |
378 | 378 | } |
379 | 379 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | */ |
393 | 393 | private function matchAny(array $tokens) |
394 | 394 | { |
395 | - if ( ! $this->lexer->isNextTokenAny($tokens)) { |
|
395 | + if (!$this->lexer->isNextTokenAny($tokens)) { |
|
396 | 396 | $this->syntaxError(implode(' or ', array_map([$this->lexer, 'getLiteral'], $tokens))); |
397 | 397 | } |
398 | 398 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | : sprintf("'%s' at position %s", $token['value'], $token['position']); |
422 | 422 | |
423 | 423 | if (strlen($this->context)) { |
424 | - $message .= ' in ' . $this->context; |
|
424 | + $message .= ' in '.$this->context; |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | $message .= '.'; |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | if ($metadata['is_annotation']) { |
488 | 488 | self::$metadataParser->setTarget(Target::TARGET_CLASS); |
489 | 489 | |
490 | - foreach (self::$metadataParser->parse($docComment, 'class @' . $name) as $annotation) { |
|
490 | + foreach (self::$metadataParser->parse($docComment, 'class @'.$name) as $annotation) { |
|
491 | 491 | if ($annotation instanceof Target) { |
492 | 492 | $metadata['targets'] = $annotation->targets; |
493 | 493 | $metadata['targets_literal'] = $annotation->literal; |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | |
517 | 517 | $attribute->required = (false !== strpos($propertyComment, '@Required')); |
518 | 518 | $attribute->name = $property->name; |
519 | - $attribute->type = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/',$propertyComment, $matches)) |
|
519 | + $attribute->type = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/', $propertyComment, $matches)) |
|
520 | 520 | ? $matches[1] |
521 | 521 | : 'mixed'; |
522 | 522 | |
@@ -524,17 +524,17 @@ discard block |
||
524 | 524 | |
525 | 525 | // checks if the property has @Enum |
526 | 526 | if (false !== strpos($propertyComment, '@Enum')) { |
527 | - $context = 'property ' . $class->name . "::\$" . $property->name; |
|
527 | + $context = 'property '.$class->name."::\$".$property->name; |
|
528 | 528 | |
529 | 529 | self::$metadataParser->setTarget(Target::TARGET_PROPERTY); |
530 | 530 | |
531 | 531 | foreach (self::$metadataParser->parse($propertyComment, $context) as $annotation) { |
532 | - if ( ! $annotation instanceof Enum) { |
|
532 | + if (!$annotation instanceof Enum) { |
|
533 | 533 | continue; |
534 | 534 | } |
535 | 535 | |
536 | 536 | $metadata['enum'][$property->name]['value'] = $annotation->value; |
537 | - $metadata['enum'][$property->name]['literal'] = ( ! empty($annotation->literal)) |
|
537 | + $metadata['enum'][$property->name]['literal'] = (!empty($annotation->literal)) |
|
538 | 538 | ? $annotation->literal |
539 | 539 | : $annotation->value; |
540 | 540 | } |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | |
663 | 663 | if ('\\' !== $name[0]) { |
664 | 664 | $pos = strpos($name, '\\'); |
665 | - $alias = (false === $pos)? $name : substr($name, 0, $pos); |
|
665 | + $alias = (false === $pos) ? $name : substr($name, 0, $pos); |
|
666 | 666 | $found = false; |
667 | 667 | $loweredAlias = strtolower($alias); |
668 | 668 | |
@@ -677,19 +677,19 @@ discard block |
||
677 | 677 | } elseif (isset($this->imports[$loweredAlias])) { |
678 | 678 | $found = true; |
679 | 679 | $name = (false !== $pos) |
680 | - ? $this->imports[$loweredAlias] . substr($name, $pos) |
|
680 | + ? $this->imports[$loweredAlias].substr($name, $pos) |
|
681 | 681 | : $this->imports[$loweredAlias]; |
682 | - } elseif ( ! isset($this->ignoredAnnotationNames[$name]) |
|
682 | + } elseif (!isset($this->ignoredAnnotationNames[$name]) |
|
683 | 683 | && isset($this->imports['__NAMESPACE__']) |
684 | - && $this->classExists($this->imports['__NAMESPACE__'] . '\\' . $name) |
|
684 | + && $this->classExists($this->imports['__NAMESPACE__'].'\\'.$name) |
|
685 | 685 | ) { |
686 | 686 | $name = $this->imports['__NAMESPACE__'].'\\'.$name; |
687 | 687 | $found = true; |
688 | - } elseif (! isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { |
|
688 | + } elseif (!isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { |
|
689 | 689 | $found = true; |
690 | 690 | } |
691 | 691 | |
692 | - if ( ! $found) { |
|
692 | + if (!$found) { |
|
693 | 693 | if ($this->isIgnoredAnnotation($name)) { |
694 | 694 | return false; |
695 | 695 | } |
@@ -698,9 +698,9 @@ discard block |
||
698 | 698 | } |
699 | 699 | } |
700 | 700 | |
701 | - $name = ltrim($name,'\\'); |
|
701 | + $name = ltrim($name, '\\'); |
|
702 | 702 | |
703 | - if ( ! $this->classExists($name)) { |
|
703 | + if (!$this->classExists($name)) { |
|
704 | 704 | throw AnnotationException::semanticalError(sprintf('The annotation "@%s" in %s does not exist, or could not be auto-loaded.', $name, $this->context)); |
705 | 705 | } |
706 | 706 | |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | |
711 | 711 | |
712 | 712 | // collects the metadata annotation only if there is not yet |
713 | - if ( ! isset(self::$annotationMetadata[$name])) { |
|
713 | + if (!isset(self::$annotationMetadata[$name])) { |
|
714 | 714 | $this->collectAnnotationMetadata($name); |
715 | 715 | } |
716 | 716 | |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | // checks all declared attributes |
744 | 744 | foreach (self::$annotationMetadata[$name]['enum'] as $property => $enum) { |
745 | 745 | // checks if the attribute is a valid enumerator |
746 | - if (isset($values[$property]) && ! in_array($values[$property], $enum['value'])) { |
|
746 | + if (isset($values[$property]) && !in_array($values[$property], $enum['value'])) { |
|
747 | 747 | throw AnnotationException::enumeratorError($property, $name, $this->context, $enum['literal'], $values[$property]); |
748 | 748 | } |
749 | 749 | } |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | |
768 | 768 | if ($type['type'] === 'array') { |
769 | 769 | // handle the case of a single value |
770 | - if ( ! is_array($values[$property])) { |
|
770 | + if (!is_array($values[$property])) { |
|
771 | 771 | $values[$property] = [$values[$property]]; |
772 | 772 | } |
773 | 773 | |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | } |
808 | 808 | |
809 | 809 | // handle the case if the property has no annotations |
810 | - if ( ! $property = self::$annotationMetadata[$name]['default_property']) { |
|
810 | + if (!$property = self::$annotationMetadata[$name]['default_property']) { |
|
811 | 811 | throw AnnotationException::creationError(sprintf('The annotation @%s declared on %s does not accept any values, but got %s.', $originalName, $this->context, json_encode($values))); |
812 | 812 | } |
813 | 813 | |
@@ -826,13 +826,13 @@ discard block |
||
826 | 826 | { |
827 | 827 | $values = []; |
828 | 828 | |
829 | - if ( ! $this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { |
|
829 | + if (!$this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { |
|
830 | 830 | return $values; |
831 | 831 | } |
832 | 832 | |
833 | 833 | $this->match(DocLexer::T_OPEN_PARENTHESIS); |
834 | 834 | |
835 | - if ( ! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { |
|
835 | + if (!$this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { |
|
836 | 836 | $values = $this->Values(); |
837 | 837 | } |
838 | 838 | |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | $token = $this->lexer->lookahead; |
861 | 861 | $value = $this->Value(); |
862 | 862 | |
863 | - if ( ! is_object($value) && ! is_array($value)) { |
|
863 | + if (!is_object($value) && !is_array($value)) { |
|
864 | 864 | $this->syntaxError('Value', $token); |
865 | 865 | } |
866 | 866 | |
@@ -870,10 +870,10 @@ discard block |
||
870 | 870 | foreach ($values as $k => $value) { |
871 | 871 | if (is_object($value) && $value instanceof \stdClass) { |
872 | 872 | $values[$value->name] = $value->value; |
873 | - } else if ( ! isset($values['value'])){ |
|
873 | + } else if (!isset($values['value'])) { |
|
874 | 874 | $values['value'] = $value; |
875 | 875 | } else { |
876 | - if ( ! is_array($values['value'])) { |
|
876 | + if (!is_array($values['value'])) { |
|
877 | 877 | $values['value'] = [$values['value']]; |
878 | 878 | } |
879 | 879 | |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | { |
898 | 898 | $identifier = $this->Identifier(); |
899 | 899 | |
900 | - if ( ! defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { |
|
900 | + if (!defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { |
|
901 | 901 | list($className, $const) = explode('::', $identifier); |
902 | 902 | |
903 | 903 | $pos = strpos($className, '\\'); |
@@ -919,12 +919,12 @@ discard block |
||
919 | 919 | case isset($this->imports[$loweredAlias]): |
920 | 920 | $found = true; |
921 | 921 | $className = (false !== $pos) |
922 | - ? $this->imports[$loweredAlias] . substr($className, $pos) |
|
922 | + ? $this->imports[$loweredAlias].substr($className, $pos) |
|
923 | 923 | : $this->imports[$loweredAlias]; |
924 | 924 | break; |
925 | 925 | |
926 | 926 | default: |
927 | - if(isset($this->imports['__NAMESPACE__'])) { |
|
927 | + if (isset($this->imports['__NAMESPACE__'])) { |
|
928 | 928 | $ns = $this->imports['__NAMESPACE__']; |
929 | 929 | |
930 | 930 | if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | } |
937 | 937 | |
938 | 938 | if ($found) { |
939 | - $identifier = $className . '::' . $const; |
|
939 | + $identifier = $className.'::'.$const; |
|
940 | 940 | } |
941 | 941 | } |
942 | 942 | |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | private function Identifier() |
962 | 962 | { |
963 | 963 | // check if we have an annotation |
964 | - if ( ! $this->lexer->isNextTokenAny(self::$classIdentifiers)) { |
|
964 | + if (!$this->lexer->isNextTokenAny(self::$classIdentifiers)) { |
|
965 | 965 | $this->syntaxError('namespace separator or identifier'); |
966 | 966 | } |
967 | 967 | |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | $this->match(DocLexer::T_NAMESPACE_SEPARATOR); |
976 | 976 | $this->matchAny(self::$classIdentifiers); |
977 | 977 | |
978 | - $className .= '\\' . $this->lexer->token['value']; |
|
978 | + $className .= '\\'.$this->lexer->token['value']; |
|
979 | 979 | } |
980 | 980 | |
981 | 981 | return $className; |
@@ -1023,11 +1023,11 @@ discard block |
||
1023 | 1023 | |
1024 | 1024 | case DocLexer::T_INTEGER: |
1025 | 1025 | $this->match(DocLexer::T_INTEGER); |
1026 | - return (int)$this->lexer->token['value']; |
|
1026 | + return (int) $this->lexer->token['value']; |
|
1027 | 1027 | |
1028 | 1028 | case DocLexer::T_FLOAT: |
1029 | 1029 | $this->match(DocLexer::T_FLOAT); |
1030 | - return (float)$this->lexer->token['value']; |
|
1030 | + return (float) $this->lexer->token['value']; |
|
1031 | 1031 | |
1032 | 1032 | case DocLexer::T_TRUE: |
1033 | 1033 | $this->match(DocLexer::T_TRUE); |
@@ -1155,9 +1155,9 @@ discard block |
||
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | foreach (array_keys($this->ignoredAnnotationNamespaces) as $ignoredAnnotationNamespace) { |
1158 | - $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\') . '\\'; |
|
1158 | + $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\').'\\'; |
|
1159 | 1159 | |
1160 | - if (0 === stripos(rtrim($name, '\\') . '\\', $ignoredAnnotationNamespace)) { |
|
1160 | + if (0 === stripos(rtrim($name, '\\').'\\', $ignoredAnnotationNamespace)) { |
|
1161 | 1161 | return true; |
1162 | 1162 | } |
1163 | 1163 | } |