@@ -59,7 +59,7 @@ |
||
| 59 | 59 | [ |
| 60 | 60 | 'type' => 'array', |
| 61 | 61 | 'array_type' =>Attribute::class, |
| 62 | - 'value' =>'array<' . Attribute::class . '>', |
|
| 62 | + 'value' =>'array<'.Attribute::class.'>', |
|
| 63 | 63 | ], |
| 64 | 64 | true, |
| 65 | 65 | true |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | // Checks if the property has type[] |
| 526 | - if (false !== $pos = strrpos($type, '[')) { |
|
| 526 | + if (false !== $pos = strrpos($type, '[')) { |
|
| 527 | 527 | $arrayType = substr($type, 0, $pos); |
| 528 | 528 | |
| 529 | 529 | $metadata->withType([ |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | if (($metadata->getTarget()->unwrap() & $target) === 0 && $target) { |
| 676 | 676 | throw AnnotationException::semanticalError( |
| 677 | 677 | sprintf('Annotation @%s is not allowed to be declared on %s. You may only use this annotation on these code elements: %s.', |
| 678 | - $originalName, $this->context, $metadata->getTarget()->describe()) |
|
| 678 | + $originalName, $this->context, $metadata->getTarget()->describe()) |
|
| 679 | 679 | ); |
| 680 | 680 | } |
| 681 | 681 | |
@@ -860,9 +860,9 @@ discard block |
||
| 860 | 860 | case !empty ($this->namespaces): |
| 861 | 861 | foreach ($this->namespaces as $ns) { |
| 862 | 862 | if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { |
| 863 | - $className = $ns.'\\'.$className; |
|
| 864 | - $found = true; |
|
| 865 | - break; |
|
| 863 | + $className = $ns.'\\'.$className; |
|
| 864 | + $found = true; |
|
| 865 | + break; |
|
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | 868 | break; |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | if ($found) { |
| 890 | - $identifier = $className . '::' . $const; |
|
| 890 | + $identifier = $className . '::' . $const; |
|
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | |
@@ -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 | |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $attribute->required = (false !== strpos($propertyComment, '@Required')); |
| 462 | 462 | $attribute->default = $default; |
| 463 | 463 | $attribute->name = $property->name; |
| 464 | - $attribute->type = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/',$propertyComment, $matches)) |
|
| 464 | + $attribute->type = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/', $propertyComment, $matches)) |
|
| 465 | 465 | ? $matches[1] |
| 466 | 466 | : 'mixed'; |
| 467 | 467 | |
@@ -469,18 +469,18 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | // checks if the property has @Enum |
| 471 | 471 | if (false !== strpos($propertyComment, '@Enum')) { |
| 472 | - $context = 'property ' . $class->name . "::\$" . $property->name; |
|
| 472 | + $context = 'property '.$class->name."::\$".$property->name; |
|
| 473 | 473 | |
| 474 | 474 | self::$metadataParser->setTarget(Target::TARGET_PROPERTY); |
| 475 | 475 | |
| 476 | 476 | foreach (self::$metadataParser->parse($propertyComment, $context) as $annotation) { |
| 477 | - if ( ! $annotation instanceof Enum) { |
|
| 477 | + if (!$annotation instanceof Enum) { |
|
| 478 | 478 | continue; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | $propertyBuilder = $propertyBuilder->withEnum([ |
| 482 | 482 | 'value' => $annotation->value, |
| 483 | - 'literal' => ( ! empty($annotation->literal)) |
|
| 483 | + 'literal' => (!empty($annotation->literal)) |
|
| 484 | 484 | ? $annotation->literal |
| 485 | 485 | : $annotation->value, |
| 486 | 486 | ]); |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $propertiesBuilders[] = $propertyBuilder; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - if (! $defaultFound && count($propertiesBuilders) !== 0) { |
|
| 493 | + if (!$defaultFound && count($propertiesBuilders) !== 0) { |
|
| 494 | 494 | $propertiesBuilders[0]->withBeingDefault(); |
| 495 | 495 | } |
| 496 | 496 | |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | if ('\\' !== $name[0]) { |
| 628 | 628 | $pos = strpos($name, '\\'); |
| 629 | - $alias = (false === $pos)? $name : substr($name, 0, $pos); |
|
| 629 | + $alias = (false === $pos) ? $name : substr($name, 0, $pos); |
|
| 630 | 630 | $found = false; |
| 631 | 631 | $loweredAlias = strtolower($alias); |
| 632 | 632 | |
@@ -641,19 +641,19 @@ discard block |
||
| 641 | 641 | } elseif (isset($this->imports[$loweredAlias])) { |
| 642 | 642 | $found = true; |
| 643 | 643 | $name = (false !== $pos) |
| 644 | - ? $this->imports[$loweredAlias] . substr($name, $pos) |
|
| 644 | + ? $this->imports[$loweredAlias].substr($name, $pos) |
|
| 645 | 645 | : $this->imports[$loweredAlias]; |
| 646 | - } elseif ( ! isset($this->ignoredAnnotationNames[$name]) |
|
| 646 | + } elseif (!isset($this->ignoredAnnotationNames[$name]) |
|
| 647 | 647 | && isset($this->imports['__NAMESPACE__']) |
| 648 | - && $this->classExists($this->imports['__NAMESPACE__'] . '\\' . $name) |
|
| 648 | + && $this->classExists($this->imports['__NAMESPACE__'].'\\'.$name) |
|
| 649 | 649 | ) { |
| 650 | 650 | $name = $this->imports['__NAMESPACE__'].'\\'.$name; |
| 651 | 651 | $found = true; |
| 652 | - } elseif (! isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { |
|
| 652 | + } elseif (!isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { |
|
| 653 | 653 | $found = true; |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | - if ( ! $found) { |
|
| 656 | + if (!$found) { |
|
| 657 | 657 | if ($this->isIgnoredAnnotation($name)) { |
| 658 | 658 | return false; |
| 659 | 659 | } |
@@ -662,9 +662,9 @@ discard block |
||
| 662 | 662 | } |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | - $name = ltrim($name,'\\'); |
|
| 665 | + $name = ltrim($name, '\\'); |
|
| 666 | 666 | |
| 667 | - if ( ! $this->classExists($name)) { |
|
| 667 | + if (!$this->classExists($name)) { |
|
| 668 | 668 | throw AnnotationException::semanticalError(sprintf('The annotation "@%s" in %s does not exist, or could not be auto-loaded.', $name, $this->context)); |
| 669 | 669 | } |
| 670 | 670 | |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | |
| 676 | 676 | // collects the metadata annotation only if there is not yet |
| 677 | - if (! $this->metadata->has($name) && ! array_key_exists($name, $this->nonAnnotationClasses)) { |
|
| 677 | + if (!$this->metadata->has($name) && !array_key_exists($name, $this->nonAnnotationClasses)) { |
|
| 678 | 678 | $this->collectAnnotationMetadata($name); |
| 679 | 679 | } |
| 680 | 680 | |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | $enum = $property->getEnum(); |
| 711 | 711 | |
| 712 | 712 | // checks if the attribute is a valid enumerator |
| 713 | - if ($enum !== null && isset($values[$propertyName]) && ! in_array($values[$propertyName], $enum['value'])) { |
|
| 713 | + if ($enum !== null && isset($values[$propertyName]) && !in_array($values[$propertyName], $enum['value'])) { |
|
| 714 | 714 | throw AnnotationException::enumeratorError($propertyName, $name, $this->context, $enum['literal'], $values[$propertyName]); |
| 715 | 715 | } |
| 716 | 716 | } |
@@ -726,9 +726,9 @@ discard block |
||
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | // handle a not given attribute or null value |
| 729 | - if (! isset($values[$valueName])) { |
|
| 729 | + if (!isset($values[$valueName])) { |
|
| 730 | 730 | if ($property->isRequired()) { |
| 731 | - throw AnnotationException::requiredError($propertyName, $originalName, $this->context, 'a(n) ' . $type['value']); |
|
| 731 | + throw AnnotationException::requiredError($propertyName, $originalName, $this->context, 'a(n) '.$type['value']); |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | continue; |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | |
| 737 | 737 | if ($type !== null && $type['type'] === 'array') { |
| 738 | 738 | // handle the case of a single value |
| 739 | - if ( ! is_array($values[$valueName])) { |
|
| 739 | + if (!is_array($values[$valueName])) { |
|
| 740 | 740 | $values[$valueName] = [$values[$valueName]]; |
| 741 | 741 | } |
| 742 | 742 | |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | $instance = new $name(); |
| 763 | 763 | |
| 764 | 764 | foreach ($values as $property => $value) { |
| 765 | - if (! isset($metadata->getProperties()[$property])) { |
|
| 765 | + if (!isset($metadata->getProperties()[$property])) { |
|
| 766 | 766 | if ('value' !== $property) { |
| 767 | 767 | throw AnnotationException::creationError( |
| 768 | 768 | sprintf( |
@@ -800,13 +800,13 @@ discard block |
||
| 800 | 800 | { |
| 801 | 801 | $values = []; |
| 802 | 802 | |
| 803 | - if ( ! $this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { |
|
| 803 | + if (!$this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { |
|
| 804 | 804 | return $values; |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | $this->match(DocLexer::T_OPEN_PARENTHESIS); |
| 808 | 808 | |
| 809 | - if ( ! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { |
|
| 809 | + if (!$this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { |
|
| 810 | 810 | $values = $this->Values(); |
| 811 | 811 | } |
| 812 | 812 | |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | $token = $this->lexer->lookahead; |
| 835 | 835 | $value = $this->Value(); |
| 836 | 836 | |
| 837 | - if ( ! is_object($value) && ! is_array($value)) { |
|
| 837 | + if (!is_object($value) && !is_array($value)) { |
|
| 838 | 838 | $this->syntaxError('Value', $token); |
| 839 | 839 | } |
| 840 | 840 | |
@@ -844,10 +844,10 @@ discard block |
||
| 844 | 844 | foreach ($values as $k => $value) { |
| 845 | 845 | if (is_object($value) && $value instanceof \stdClass) { |
| 846 | 846 | $values[$value->name] = $value->value; |
| 847 | - } else if ( ! isset($values['value'])){ |
|
| 847 | + } else if (!isset($values['value'])) { |
|
| 848 | 848 | $values['value'] = $value; |
| 849 | 849 | } else { |
| 850 | - if ( ! is_array($values['value'])) { |
|
| 850 | + if (!is_array($values['value'])) { |
|
| 851 | 851 | $values['value'] = [$values['value']]; |
| 852 | 852 | } |
| 853 | 853 | |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | { |
| 872 | 872 | $identifier = $this->Identifier(); |
| 873 | 873 | |
| 874 | - if ( ! defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { |
|
| 874 | + if (!defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { |
|
| 875 | 875 | list($className, $const) = explode('::', $identifier); |
| 876 | 876 | |
| 877 | 877 | $pos = strpos($className, '\\'); |
@@ -893,12 +893,12 @@ discard block |
||
| 893 | 893 | case isset($this->imports[$loweredAlias]): |
| 894 | 894 | $found = true; |
| 895 | 895 | $className = (false !== $pos) |
| 896 | - ? $this->imports[$loweredAlias] . substr($className, $pos) |
|
| 896 | + ? $this->imports[$loweredAlias].substr($className, $pos) |
|
| 897 | 897 | : $this->imports[$loweredAlias]; |
| 898 | 898 | break; |
| 899 | 899 | |
| 900 | 900 | default: |
| 901 | - if(isset($this->imports['__NAMESPACE__'])) { |
|
| 901 | + if (isset($this->imports['__NAMESPACE__'])) { |
|
| 902 | 902 | $ns = $this->imports['__NAMESPACE__']; |
| 903 | 903 | |
| 904 | 904 | if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | if ($found) { |
| 913 | - $identifier = $className . '::' . $const; |
|
| 913 | + $identifier = $className.'::'.$const; |
|
| 914 | 914 | } |
| 915 | 915 | } |
| 916 | 916 | |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | private function Identifier() |
| 936 | 936 | { |
| 937 | 937 | // check if we have an annotation |
| 938 | - if ( ! $this->lexer->isNextTokenAny(self::$classIdentifiers)) { |
|
| 938 | + if (!$this->lexer->isNextTokenAny(self::$classIdentifiers)) { |
|
| 939 | 939 | $this->syntaxError('namespace separator or identifier'); |
| 940 | 940 | } |
| 941 | 941 | |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | $this->match(DocLexer::T_NAMESPACE_SEPARATOR); |
| 950 | 950 | $this->matchAny(self::$classIdentifiers); |
| 951 | 951 | |
| 952 | - $className .= '\\' . $this->lexer->token['value']; |
|
| 952 | + $className .= '\\'.$this->lexer->token['value']; |
|
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | return $className; |
@@ -997,11 +997,11 @@ discard block |
||
| 997 | 997 | |
| 998 | 998 | case DocLexer::T_INTEGER: |
| 999 | 999 | $this->match(DocLexer::T_INTEGER); |
| 1000 | - return (int)$this->lexer->token['value']; |
|
| 1000 | + return (int) $this->lexer->token['value']; |
|
| 1001 | 1001 | |
| 1002 | 1002 | case DocLexer::T_FLOAT: |
| 1003 | 1003 | $this->match(DocLexer::T_FLOAT); |
| 1004 | - return (float)$this->lexer->token['value']; |
|
| 1004 | + return (float) $this->lexer->token['value']; |
|
| 1005 | 1005 | |
| 1006 | 1006 | case DocLexer::T_TRUE: |
| 1007 | 1007 | $this->match(DocLexer::T_TRUE); |
@@ -1129,9 +1129,9 @@ discard block |
||
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | 1131 | foreach (array_keys($this->ignoredAnnotationNamespaces) as $ignoredAnnotationNamespace) { |
| 1132 | - $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\') . '\\'; |
|
| 1132 | + $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\').'\\'; |
|
| 1133 | 1133 | |
| 1134 | - if (0 === stripos(rtrim($name, '\\') . '\\', $ignoredAnnotationNamespace)) { |
|
| 1134 | + if (0 === stripos(rtrim($name, '\\').'\\', $ignoredAnnotationNamespace)) { |
|
| 1135 | 1135 | return true; |
| 1136 | 1136 | } |
| 1137 | 1137 | } |