| @@ -521,7 +521,7 @@ discard block | ||
| 521 | 521 | } | 
| 522 | 522 | |
| 523 | 523 | // Checks if the property has type[] | 
| 524 | -         if (false !== $pos = strrpos($type, '[')) { | |
| 524 | +            if (false !== $pos = strrpos($type, '[')) { | |
| 525 | 525 | $arrayType = substr($type, 0, $pos); | 
| 526 | 526 | |
| 527 | 527 | return $metadata->withType([ | 
| @@ -670,7 +670,7 @@ discard block | ||
| 670 | 670 |          if (($this->metadata->get($name)->getTarget()->unwrap() & $target) === 0 && $target) { | 
| 671 | 671 | throw AnnotationException::semanticalError( | 
| 672 | 672 |                  sprintf('Annotation @%s is not allowed to be declared on %s. You may only use this annotation on these code elements: %s.', | 
| 673 | - $originalName, $this->context, $this->metadata->get($name)->getTarget()->describe()) | |
| 673 | + $originalName, $this->context, $this->metadata->get($name)->getTarget()->describe()) | |
| 674 | 674 | ); | 
| 675 | 675 | } | 
| 676 | 676 | |
| @@ -855,9 +855,9 @@ discard block | ||
| 855 | 855 | case !empty ($this->namespaces): | 
| 856 | 856 |                      foreach ($this->namespaces as $ns) { | 
| 857 | 857 |                          if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { | 
| 858 | - $className = $ns.'\\'.$className; | |
| 859 | - $found = true; | |
| 860 | - break; | |
| 858 | + $className = $ns.'\\'.$className; | |
| 859 | + $found = true; | |
| 860 | + break; | |
| 861 | 861 | } | 
| 862 | 862 | } | 
| 863 | 863 | break; | 
| @@ -882,7 +882,7 @@ discard block | ||
| 882 | 882 | } | 
| 883 | 883 | |
| 884 | 884 |              if ($found) { | 
| 885 | - $identifier = $className . '::' . $const; | |
| 885 | + $identifier = $className . '::' . $const; | |
| 886 | 886 | } | 
| 887 | 887 | } | 
| 888 | 888 | |
| @@ -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 = $annotationBuilder->withTarget(AnnotationTarget::fromAnnotation($annotation)); | 
| 421 | 421 | |
| @@ -432,7 +432,7 @@ discard block | ||
| 432 | 432 | } | 
| 433 | 433 | |
| 434 | 434 | // if there is no constructor we will inject values into public properties | 
| 435 | -        if (! $useConstructor) { | |
| 435 | +        if (!$useConstructor) { | |
| 436 | 436 | // collect all public properties | 
| 437 | 437 |              foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $i => $property) { | 
| 438 | 438 | $propertyBuilder = new PropertyMetadataBuilder($property->getName()); | 
| @@ -452,7 +452,7 @@ discard block | ||
| 452 | 452 | $attribute = new Attribute(); | 
| 453 | 453 | $attribute->required = (false !== strpos($propertyComment, '@Required')); | 
| 454 | 454 | $attribute->name = $property->name; | 
| 455 | -                $attribute->type     = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/',$propertyComment, $matches)) | |
| 455 | +                $attribute->type     = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/', $propertyComment, $matches)) | |
| 456 | 456 | ? $matches[1] | 
| 457 | 457 | : 'mixed'; | 
| 458 | 458 | |
| @@ -460,18 +460,18 @@ discard block | ||
| 460 | 460 | |
| 461 | 461 | // checks if the property has @Enum | 
| 462 | 462 |                  if (false !== strpos($propertyComment, '@Enum')) { | 
| 463 | - $context = 'property ' . $class->name . "::\$" . $property->name; | |
| 463 | + $context = 'property '.$class->name."::\$".$property->name; | |
| 464 | 464 | |
| 465 | 465 | self::$metadataParser->setTarget(Target::TARGET_PROPERTY); | 
| 466 | 466 | |
| 467 | 467 |                      foreach (self::$metadataParser->parse($propertyComment, $context) as $annotation) { | 
| 468 | -                        if ( ! $annotation instanceof Enum) { | |
| 468 | +                        if (!$annotation instanceof Enum) { | |
| 469 | 469 | continue; | 
| 470 | 470 | } | 
| 471 | 471 | |
| 472 | 472 | $propertyBuilder = $propertyBuilder->withEnum([ | 
| 473 | 473 | 'value' => $annotation->value, | 
| 474 | - 'literal' => ( ! empty($annotation->literal)) | |
| 474 | + 'literal' => (!empty($annotation->literal)) | |
| 475 | 475 | ? $annotation->literal | 
| 476 | 476 | : $annotation->value, | 
| 477 | 477 | ]); | 
| @@ -599,7 +599,7 @@ discard block | ||
| 599 | 599 | |
| 600 | 600 |          if ('\\' !== $name[0]) { | 
| 601 | 601 | $pos = strpos($name, '\\'); | 
| 602 | - $alias = (false === $pos)? $name : substr($name, 0, $pos); | |
| 602 | + $alias = (false === $pos) ? $name : substr($name, 0, $pos); | |
| 603 | 603 | $found = false; | 
| 604 | 604 | $loweredAlias = strtolower($alias); | 
| 605 | 605 | |
| @@ -614,19 +614,19 @@ discard block | ||
| 614 | 614 |              } elseif (isset($this->imports[$loweredAlias])) { | 
| 615 | 615 | $found = true; | 
| 616 | 616 | $name = (false !== $pos) | 
| 617 | - ? $this->imports[$loweredAlias] . substr($name, $pos) | |
| 617 | + ? $this->imports[$loweredAlias].substr($name, $pos) | |
| 618 | 618 | : $this->imports[$loweredAlias]; | 
| 619 | - } elseif ( ! isset($this->ignoredAnnotationNames[$name]) | |
| 619 | + } elseif (!isset($this->ignoredAnnotationNames[$name]) | |
| 620 | 620 | && isset($this->imports['__NAMESPACE__']) | 
| 621 | - && $this->classExists($this->imports['__NAMESPACE__'] . '\\' . $name) | |
| 621 | + && $this->classExists($this->imports['__NAMESPACE__'].'\\'.$name) | |
| 622 | 622 |              ) { | 
| 623 | 623 | $name = $this->imports['__NAMESPACE__'].'\\'.$name; | 
| 624 | 624 | $found = true; | 
| 625 | -            } elseif (! isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { | |
| 625 | +            } elseif (!isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { | |
| 626 | 626 | $found = true; | 
| 627 | 627 | } | 
| 628 | 628 | |
| 629 | -            if ( ! $found) { | |
| 629 | +            if (!$found) { | |
| 630 | 630 |                  if ($this->isIgnoredAnnotation($name)) { | 
| 631 | 631 | return false; | 
| 632 | 632 | } | 
| @@ -635,9 +635,9 @@ discard block | ||
| 635 | 635 | } | 
| 636 | 636 | } | 
| 637 | 637 | |
| 638 | - $name = ltrim($name,'\\'); | |
| 638 | + $name = ltrim($name, '\\'); | |
| 639 | 639 | |
| 640 | -        if ( ! $this->classExists($name)) { | |
| 640 | +        if (!$this->classExists($name)) { | |
| 641 | 641 |              throw AnnotationException::semanticalError(sprintf('The annotation "@%s" in %s does not exist, or could not be auto-loaded.', $name, $this->context)); | 
| 642 | 642 | } | 
| 643 | 643 | |
| @@ -647,7 +647,7 @@ discard block | ||
| 647 | 647 | |
| 648 | 648 | |
| 649 | 649 | // collects the metadata annotation only if there is not yet | 
| 650 | -        if (! $this->metadata->has($name) && ! array_key_exists($name, $this->nonAnnotationClasses)) { | |
| 650 | +        if (!$this->metadata->has($name) && !array_key_exists($name, $this->nonAnnotationClasses)) { | |
| 651 | 651 | $this->collectAnnotationMetadata($name); | 
| 652 | 652 | } | 
| 653 | 653 | |
| @@ -682,7 +682,7 @@ discard block | ||
| 682 | 682 | $enum = $property->getEnum(); | 
| 683 | 683 | |
| 684 | 684 | // checks if the attribute is a valid enumerator | 
| 685 | -            if ($enum !== null && isset($values[$propertyName]) && ! in_array($values[$propertyName], $enum['value'])) { | |
| 685 | +            if ($enum !== null && isset($values[$propertyName]) && !in_array($values[$propertyName], $enum['value'])) { | |
| 686 | 686 | throw AnnotationException::enumeratorError($propertyName, $name, $this->context, $enum['literal'], $values[$propertyName]); | 
| 687 | 687 | } | 
| 688 | 688 | } | 
| @@ -698,9 +698,9 @@ discard block | ||
| 698 | 698 | } | 
| 699 | 699 | |
| 700 | 700 | // handle a not given attribute or null value | 
| 701 | -            if (! isset($values[$valueName])) { | |
| 701 | +            if (!isset($values[$valueName])) { | |
| 702 | 702 |                  if ($property->isRequired()) { | 
| 703 | - throw AnnotationException::requiredError($propertyName, $originalName, $this->context, 'a(n) ' . $type['value']); | |
| 703 | + throw AnnotationException::requiredError($propertyName, $originalName, $this->context, 'a(n) '.$type['value']); | |
| 704 | 704 | } | 
| 705 | 705 | |
| 706 | 706 | continue; | 
| @@ -708,7 +708,7 @@ discard block | ||
| 708 | 708 | |
| 709 | 709 |              if ($type !== null && $type['type'] === 'array') { | 
| 710 | 710 | // handle the case of a single value | 
| 711 | -                if ( ! is_array($values[$valueName])) { | |
| 711 | +                if (!is_array($values[$valueName])) { | |
| 712 | 712 | $values[$valueName] = [$values[$valueName]]; | 
| 713 | 713 | } | 
| 714 | 714 | |
| @@ -734,7 +734,7 @@ discard block | ||
| 734 | 734 | $instance = new $name(); | 
| 735 | 735 | |
| 736 | 736 |          foreach ($values as $property => $value) { | 
| 737 | -            if (! isset($this->metadata->get($name)->getProperties()[$property])) { | |
| 737 | +            if (!isset($this->metadata->get($name)->getProperties()[$property])) { | |
| 738 | 738 |                  if ('value' !== $property) { | 
| 739 | 739 | throw AnnotationException::creationError( | 
| 740 | 740 | sprintf( | 
| @@ -772,13 +772,13 @@ discard block | ||
| 772 | 772 |      { | 
| 773 | 773 | $values = []; | 
| 774 | 774 | |
| 775 | -        if ( ! $this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { | |
| 775 | +        if (!$this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { | |
| 776 | 776 | return $values; | 
| 777 | 777 | } | 
| 778 | 778 | |
| 779 | 779 | $this->match(DocLexer::T_OPEN_PARENTHESIS); | 
| 780 | 780 | |
| 781 | -        if ( ! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { | |
| 781 | +        if (!$this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { | |
| 782 | 782 | $values = $this->Values(); | 
| 783 | 783 | } | 
| 784 | 784 | |
| @@ -806,7 +806,7 @@ discard block | ||
| 806 | 806 | $token = $this->lexer->lookahead; | 
| 807 | 807 | $value = $this->Value(); | 
| 808 | 808 | |
| 809 | -            if ( ! is_object($value) && ! is_array($value)) { | |
| 809 | +            if (!is_object($value) && !is_array($value)) { | |
| 810 | 810 |                  $this->syntaxError('Value', $token); | 
| 811 | 811 | } | 
| 812 | 812 | |
| @@ -816,10 +816,10 @@ discard block | ||
| 816 | 816 |          foreach ($values as $k => $value) { | 
| 817 | 817 |              if (is_object($value) && $value instanceof \stdClass) { | 
| 818 | 818 | $values[$value->name] = $value->value; | 
| 819 | -            } else if ( ! isset($values['value'])){ | |
| 819 | +            } else if (!isset($values['value'])) { | |
| 820 | 820 | $values['value'] = $value; | 
| 821 | 821 |              } else { | 
| 822 | -                if ( ! is_array($values['value'])) { | |
| 822 | +                if (!is_array($values['value'])) { | |
| 823 | 823 | $values['value'] = [$values['value']]; | 
| 824 | 824 | } | 
| 825 | 825 | |
| @@ -843,7 +843,7 @@ discard block | ||
| 843 | 843 |      { | 
| 844 | 844 | $identifier = $this->Identifier(); | 
| 845 | 845 | |
| 846 | -        if ( ! defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { | |
| 846 | +        if (!defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { | |
| 847 | 847 |              list($className, $const) = explode('::', $identifier); | 
| 848 | 848 | |
| 849 | 849 | $pos = strpos($className, '\\'); | 
| @@ -865,12 +865,12 @@ discard block | ||
| 865 | 865 | case isset($this->imports[$loweredAlias]): | 
| 866 | 866 | $found = true; | 
| 867 | 867 | $className = (false !== $pos) | 
| 868 | - ? $this->imports[$loweredAlias] . substr($className, $pos) | |
| 868 | + ? $this->imports[$loweredAlias].substr($className, $pos) | |
| 869 | 869 | : $this->imports[$loweredAlias]; | 
| 870 | 870 | break; | 
| 871 | 871 | |
| 872 | 872 | default: | 
| 873 | -                    if(isset($this->imports['__NAMESPACE__'])) { | |
| 873 | +                    if (isset($this->imports['__NAMESPACE__'])) { | |
| 874 | 874 | $ns = $this->imports['__NAMESPACE__']; | 
| 875 | 875 | |
| 876 | 876 |                          if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { | 
| @@ -882,7 +882,7 @@ discard block | ||
| 882 | 882 | } | 
| 883 | 883 | |
| 884 | 884 |              if ($found) { | 
| 885 | - $identifier = $className . '::' . $const; | |
| 885 | + $identifier = $className.'::'.$const; | |
| 886 | 886 | } | 
| 887 | 887 | } | 
| 888 | 888 | |
| @@ -907,7 +907,7 @@ discard block | ||
| 907 | 907 | private function Identifier() | 
| 908 | 908 |      { | 
| 909 | 909 | // check if we have an annotation | 
| 910 | -        if ( ! $this->lexer->isNextTokenAny(self::$classIdentifiers)) { | |
| 910 | +        if (!$this->lexer->isNextTokenAny(self::$classIdentifiers)) { | |
| 911 | 911 |              $this->syntaxError('namespace separator or identifier'); | 
| 912 | 912 | } | 
| 913 | 913 | |
| @@ -921,7 +921,7 @@ discard block | ||
| 921 | 921 | $this->match(DocLexer::T_NAMESPACE_SEPARATOR); | 
| 922 | 922 | $this->matchAny(self::$classIdentifiers); | 
| 923 | 923 | |
| 924 | - $className .= '\\' . $this->lexer->token['value']; | |
| 924 | + $className .= '\\'.$this->lexer->token['value']; | |
| 925 | 925 | } | 
| 926 | 926 | |
| 927 | 927 | return $className; | 
| @@ -969,11 +969,11 @@ discard block | ||
| 969 | 969 | |
| 970 | 970 | case DocLexer::T_INTEGER: | 
| 971 | 971 | $this->match(DocLexer::T_INTEGER); | 
| 972 | - return (int)$this->lexer->token['value']; | |
| 972 | + return (int) $this->lexer->token['value']; | |
| 973 | 973 | |
| 974 | 974 | case DocLexer::T_FLOAT: | 
| 975 | 975 | $this->match(DocLexer::T_FLOAT); | 
| 976 | - return (float)$this->lexer->token['value']; | |
| 976 | + return (float) $this->lexer->token['value']; | |
| 977 | 977 | |
| 978 | 978 | case DocLexer::T_TRUE: | 
| 979 | 979 | $this->match(DocLexer::T_TRUE); | 
| @@ -1101,9 +1101,9 @@ discard block | ||
| 1101 | 1101 | } | 
| 1102 | 1102 | |
| 1103 | 1103 |          foreach (array_keys($this->ignoredAnnotationNamespaces) as $ignoredAnnotationNamespace) { | 
| 1104 | - $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\') . '\\'; | |
| 1104 | + $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\').'\\'; | |
| 1105 | 1105 | |
| 1106 | -            if (0 === stripos(rtrim($name, '\\') . '\\', $ignoredAnnotationNamespace)) { | |
| 1106 | +            if (0 === stripos(rtrim($name, '\\').'\\', $ignoredAnnotationNamespace)) { | |
| 1107 | 1107 | return true; | 
| 1108 | 1108 | } | 
| 1109 | 1109 | } | 
| @@ -48,7 +48,7 @@ | ||
| 48 | 48 | */ | 
| 49 | 49 | public function get(string $name) : AnnotationMetadata | 
| 50 | 50 |      { | 
| 51 | -        if (! isset($this->metadata[$name])) { | |
| 51 | +        if (!isset($this->metadata[$name])) { | |
| 52 | 52 | throw MetadataDoesNotExist::new($name); | 
| 53 | 53 | } | 
| 54 | 54 | |
| @@ -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 |