@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function __construct(Reader $reader, $cacheDir, $debug = false, $umask = 0002) |
| 57 | 57 | { |
| 58 | - if ( ! is_int($umask)) { |
|
| 58 | + if (!is_int($umask)) { |
|
| 59 | 59 | throw new \InvalidArgumentException(sprintf( |
| 60 | 60 | 'The parameter umask must be an integer, was: %s', |
| 61 | 61 | gettype($umask) |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function getClassAnnotations(\ReflectionClass $class) |
| 80 | 80 | { |
| 81 | - if ( ! isset($this->classNameHashes[$class->name])) { |
|
| 81 | + if (!isset($this->classNameHashes[$class->name])) { |
|
| 82 | 82 | $this->classNameHashes[$class->name] = sha1($class->name); |
| 83 | 83 | } |
| 84 | 84 | $key = $this->classNameHashes[$class->name]; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | public function getPropertyAnnotations(\ReflectionProperty $property) |
| 114 | 114 | { |
| 115 | 115 | $class = $property->getDeclaringClass(); |
| 116 | - if ( ! isset($this->classNameHashes[$class->name])) { |
|
| 116 | + if (!isset($this->classNameHashes[$class->name])) { |
|
| 117 | 117 | $this->classNameHashes[$class->name] = sha1($class->name); |
| 118 | 118 | } |
| 119 | 119 | $key = $this->classNameHashes[$class->name].'$'.$property->getName(); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | public function getMethodAnnotations(\ReflectionMethod $method) |
| 149 | 149 | { |
| 150 | 150 | $class = $method->getDeclaringClass(); |
| 151 | - if ( ! isset($this->classNameHashes[$class->name])) { |
|
| 151 | + if (!isset($this->classNameHashes[$class->name])) { |
|
| 152 | 152 | $this->classNameHashes[$class->name] = sha1($class->name); |
| 153 | 153 | } |
| 154 | 154 | $key = $this->classNameHashes[$class->name].'#'.$method->getName(); |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $namespace = preg_quote($class->getNamespaceName()); |
| 39 | - $content = preg_replace('/^.*?(\bnamespace\s+' . $namespace . '\s*[;{].*)$/s', '\\1', $content); |
|
| 40 | - $tokenizer = new TokenParser('<?php ' . $content); |
|
| 39 | + $content = preg_replace('/^.*?(\bnamespace\s+'.$namespace.'\s*[;{].*)$/s', '\\1', $content); |
|
| 40 | + $tokenizer = new TokenParser('<?php '.$content); |
|
| 41 | 41 | |
| 42 | 42 | $statements = $tokenizer->parseUseStatements($class->getNamespaceName()); |
| 43 | 43 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | private function getFileContent($filename, $lineNumber) |
| 56 | 56 | { |
| 57 | - if ( ! is_file($filename)) { |
|
| 57 | + if (!is_file($filename)) { |
|
| 58 | 58 | return null; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public static function syntaxError($message) |
| 24 | 24 | { |
| 25 | - return new self('[Syntax Error] ' . $message); |
|
| 25 | + return new self('[Syntax Error] '.$message); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public static function semanticalError($message) |
| 36 | 36 | { |
| 37 | - return new self('[Semantical Error] ' . $message); |
|
| 37 | + return new self('[Semantical Error] '.$message); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public static function creationError($message) |
| 51 | 51 | { |
| 52 | - return new self('[Creation Error] ' . $message); |
|
| 52 | + return new self('[Creation Error] '.$message); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public static function typeError($message) |
| 65 | 65 | { |
| 66 | - return new self('[Type Error] ' . $message); |
|
| 66 | + return new self('[Type Error] '.$message); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | return self::semanticalError(sprintf( |
| 82 | 82 | "Couldn't find constant %s%s.", |
| 83 | 83 | $identifier, |
| 84 | - $context ? ', ' . $context : '' |
|
| 84 | + $context ? ', '.$context : '' |
|
| 85 | 85 | )); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $annotationName, |
| 107 | 107 | $context, |
| 108 | 108 | $expected, |
| 109 | - is_object($actual) ? 'an instance of ' . get_class($actual) : gettype($actual) |
|
| 109 | + is_object($actual) ? 'an instance of '.get_class($actual) : gettype($actual) |
|
| 110 | 110 | )); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public static function registerUniqueLoader(callable $callable) : void |
| 125 | 125 | { |
| 126 | - if ( ! in_array($callable, self::$loaders, true) ) { |
|
| 126 | + if (!in_array($callable, self::$loaders, true)) { |
|
| 127 | 127 | self::registerLoader($callable); |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | foreach (self::$autoloadNamespaces AS $namespace => $dirs) { |
| 145 | 145 | if (\strpos($class, $namespace) === 0) { |
| 146 | - $file = \str_replace('\\', \DIRECTORY_SEPARATOR, $class) . '.php'; |
|
| 146 | + $file = \str_replace('\\', \DIRECTORY_SEPARATOR, $class).'.php'; |
|
| 147 | 147 | |
| 148 | 148 | if ($dirs === null) { |
| 149 | 149 | if ($path = stream_resolve_include_path($file)) { |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | return true; |
| 152 | 152 | } |
| 153 | 153 | } else { |
| 154 | - foreach((array) $dirs AS $dir) { |
|
| 155 | - if (is_file($dir . \DIRECTORY_SEPARATOR . $file)) { |
|
| 156 | - require $dir . \DIRECTORY_SEPARATOR . $file; |
|
| 154 | + foreach ((array) $dirs AS $dir) { |
|
| 155 | + if (is_file($dir.\DIRECTORY_SEPARATOR.$file)) { |
|
| 156 | + require $dir.\DIRECTORY_SEPARATOR.$file; |
|
| 157 | 157 | return true; |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function __construct(array $values) |
| 40 | 40 | { |
| 41 | - if ( ! isset($values['literal'])) { |
|
| 41 | + if (!isset($values['literal'])) { |
|
| 42 | 42 | $values['literal'] = []; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | foreach ($values['value'] as $var) { |
| 46 | - if( ! is_scalar($var)) { |
|
| 46 | + if (!is_scalar($var)) { |
|
| 47 | 47 | throw new \InvalidArgumentException(sprintf( |
| 48 | 48 | '@Enum supports only scalar values "%s" given.', |
| 49 | 49 | is_object($var) ? get_class($var) : gettype($var) |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | foreach ($values['literal'] as $key => $var) { |
| 55 | - if( ! in_array($key, $values['value'])) { |
|
| 55 | + if (!in_array($key, $values['value'])) { |
|
| 56 | 56 | throw new \InvalidArgumentException(sprintf( |
| 57 | 57 | 'Undefined enumerator value "%s" for literal "%s".', |
| 58 | - $key , $var |
|
| 58 | + $key, $var |
|
| 59 | 59 | )); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function __construct(array $values) |
| 59 | 59 | { |
| 60 | - if (!isset($values['value'])){ |
|
| 60 | + if (!isset($values['value'])) { |
|
| 61 | 61 | $values['value'] = null; |
| 62 | 62 | } |
| 63 | - if (is_string($values['value'])){ |
|
| 63 | + if (is_string($values['value'])) { |
|
| 64 | 64 | $values['value'] = [$values['value']]; |
| 65 | 65 | } |
| 66 | - if (!is_array($values['value'])){ |
|
| 66 | + if (!is_array($values['value'])) { |
|
| 67 | 67 | throw new \InvalidArgumentException( |
| 68 | 68 | sprintf('@Target expects either a string value, or an array of strings, "%s" given.', |
| 69 | 69 | is_object($values['value']) ? get_class($values['value']) : gettype($values['value']) |
@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | $bitmask = 0; |
| 75 | 75 | foreach ($values['value'] as $literal) { |
| 76 | - if(!isset(self::$map[$literal])){ |
|
| 76 | + if (!isset(self::$map[$literal])) { |
|
| 77 | 77 | throw new \InvalidArgumentException( |
| 78 | 78 | sprintf('Invalid Target "%s". Available targets: [%s]', |
| 79 | - $literal, implode(', ', array_keys(self::$map))) |
|
| 79 | + $literal, implode(', ', array_keys(self::$map))) |
|
| 80 | 80 | ); |
| 81 | 81 | } |
| 82 | 82 | $bitmask |= self::$map[$literal]; |
@@ -241,9 +241,9 @@ |
||
| 241 | 241 | return $this->loadedFilemtimes[$filename]; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $parent = $class->getParentClass(); |
|
| 244 | + $parent = $class->getParentClass(); |
|
| 245 | 245 | |
| 246 | - $lastModification = max(array_merge( |
|
| 246 | + $lastModification = max(array_merge( |
|
| 247 | 247 | [$filename ? filemtime($filename) : 0], |
| 248 | 248 | array_map([$this, 'getTraitLastModificationTime'], $class->getTraits()), |
| 249 | 249 | array_map([$this, 'getLastModification'], $class->getInterfaces()), |
@@ -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 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | 'type' =>'array', |
| 186 | 186 | 'required' =>true, |
| 187 | 187 | 'array_type'=>Annotation\Attribute::class, |
| 188 | - 'value' =>'array<' . Annotation\Attribute::class . '>' |
|
| 188 | + 'value' =>'array<'.Annotation\Attribute::class.'>' |
|
| 189 | 189 | ] |
| 190 | 190 | ], |
| 191 | 191 | ], |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | private function match(int $token): bool |
| 379 | 379 | { |
| 380 | - if ( ! $this->lexer->isNextToken($token) ) { |
|
| 380 | + if (!$this->lexer->isNextToken($token)) { |
|
| 381 | 381 | throw $this->syntaxError($this->lexer->getLiteral($token)); |
| 382 | 382 | } |
| 383 | 383 | |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | private function matchAny(array $tokens): bool |
| 396 | 396 | { |
| 397 | - if ( ! $this->lexer->isNextTokenAny($tokens)) { |
|
| 397 | + if (!$this->lexer->isNextTokenAny($tokens)) { |
|
| 398 | 398 | throw $this->syntaxError(implode(' or ', array_map([$this->lexer, 'getLiteral'], $tokens))); |
| 399 | 399 | } |
| 400 | 400 | |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | : sprintf("'%s' at position %s", $token['value'], $token['position']); |
| 420 | 420 | |
| 421 | 421 | if (strlen($this->context)) { |
| 422 | - $message .= ' in ' . $this->context; |
|
| 422 | + $message .= ' in '.$this->context; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | $message .= '.'; |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | if ($metadata['is_annotation']) { |
| 495 | 495 | self::$metadataParser->setTarget(Target::TARGET_CLASS); |
| 496 | 496 | |
| 497 | - foreach (self::$metadataParser->parse($docComment, 'class @' . $name) as $annotation) { |
|
| 497 | + foreach (self::$metadataParser->parse($docComment, 'class @'.$name) as $annotation) { |
|
| 498 | 498 | if ($annotation instanceof Target) { |
| 499 | 499 | $metadata['targets'] = $annotation->targets; |
| 500 | 500 | $metadata['targets_literal'] = $annotation->literal; |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | $attribute->required = (false !== strpos($propertyComment, '@Required')); |
| 525 | 525 | $attribute->name = $property->name; |
| 526 | - $attribute->type = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/',$propertyComment, $matches)) |
|
| 526 | + $attribute->type = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/', $propertyComment, $matches)) |
|
| 527 | 527 | ? $matches[1] |
| 528 | 528 | : 'mixed'; |
| 529 | 529 | |
@@ -531,17 +531,17 @@ discard block |
||
| 531 | 531 | |
| 532 | 532 | // checks if the property has @Enum |
| 533 | 533 | if (false !== strpos($propertyComment, '@Enum')) { |
| 534 | - $context = 'property ' . $class->name . "::\$" . $property->name; |
|
| 534 | + $context = 'property '.$class->name."::\$".$property->name; |
|
| 535 | 535 | |
| 536 | 536 | self::$metadataParser->setTarget(Target::TARGET_PROPERTY); |
| 537 | 537 | |
| 538 | 538 | foreach (self::$metadataParser->parse($propertyComment, $context) as $annotation) { |
| 539 | - if ( ! $annotation instanceof Enum) { |
|
| 539 | + if (!$annotation instanceof Enum) { |
|
| 540 | 540 | continue; |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | $metadata['enum'][$property->name]['value'] = $annotation->value; |
| 544 | - $metadata['enum'][$property->name]['literal'] = ( ! empty($annotation->literal)) |
|
| 544 | + $metadata['enum'][$property->name]['literal'] = (!empty($annotation->literal)) |
|
| 545 | 545 | ? $annotation->literal |
| 546 | 546 | : $annotation->value; |
| 547 | 547 | } |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | |
| 674 | 674 | if ('\\' !== $name[0]) { |
| 675 | 675 | $pos = strpos($name, '\\'); |
| 676 | - $alias = (false === $pos)? $name : substr($name, 0, $pos); |
|
| 676 | + $alias = (false === $pos) ? $name : substr($name, 0, $pos); |
|
| 677 | 677 | $found = false; |
| 678 | 678 | $loweredAlias = strtolower($alias); |
| 679 | 679 | |
@@ -688,20 +688,20 @@ discard block |
||
| 688 | 688 | } elseif (isset($this->imports[$loweredAlias])) { |
| 689 | 689 | $namespace = ltrim($this->imports[$loweredAlias], '\\'); |
| 690 | 690 | $name = (false !== $pos) |
| 691 | - ? $namespace . substr($name, $pos) |
|
| 691 | + ? $namespace.substr($name, $pos) |
|
| 692 | 692 | : $namespace; |
| 693 | 693 | $found = $this->classExists($name); |
| 694 | - } elseif ( ! isset($this->ignoredAnnotationNames[$name]) |
|
| 694 | + } elseif (!isset($this->ignoredAnnotationNames[$name]) |
|
| 695 | 695 | && isset($this->imports['__NAMESPACE__']) |
| 696 | - && $this->classExists($this->imports['__NAMESPACE__'] . '\\' . $name) |
|
| 696 | + && $this->classExists($this->imports['__NAMESPACE__'].'\\'.$name) |
|
| 697 | 697 | ) { |
| 698 | 698 | $name = $this->imports['__NAMESPACE__'].'\\'.$name; |
| 699 | 699 | $found = true; |
| 700 | - } elseif (! isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { |
|
| 700 | + } elseif (!isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { |
|
| 701 | 701 | $found = true; |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - if ( ! $found) { |
|
| 704 | + if (!$found) { |
|
| 705 | 705 | if ($this->isIgnoredAnnotation($name)) { |
| 706 | 706 | return false; |
| 707 | 707 | } |
@@ -710,9 +710,9 @@ discard block |
||
| 710 | 710 | } |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | - $name = ltrim($name,'\\'); |
|
| 713 | + $name = ltrim($name, '\\'); |
|
| 714 | 714 | |
| 715 | - if ( ! $this->classExists($name)) { |
|
| 715 | + if (!$this->classExists($name)) { |
|
| 716 | 716 | throw AnnotationException::semanticalError(sprintf('The annotation "@%s" in %s does not exist, or could not be auto-loaded.', $name, $this->context)); |
| 717 | 717 | } |
| 718 | 718 | |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | |
| 723 | 723 | |
| 724 | 724 | // collects the metadata annotation only if there is not yet |
| 725 | - if ( ! isset(self::$annotationMetadata[$name])) { |
|
| 725 | + if (!isset(self::$annotationMetadata[$name])) { |
|
| 726 | 726 | $this->collectAnnotationMetadata($name); |
| 727 | 727 | } |
| 728 | 728 | |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | // checks all declared attributes |
| 756 | 756 | foreach (self::$annotationMetadata[$name]['enum'] as $property => $enum) { |
| 757 | 757 | // checks if the attribute is a valid enumerator |
| 758 | - if (isset($values[$property]) && ! in_array($values[$property], $enum['value'])) { |
|
| 758 | + if (isset($values[$property]) && !in_array($values[$property], $enum['value'])) { |
|
| 759 | 759 | throw AnnotationException::enumeratorError($property, $name, $this->context, $enum['literal'], $values[$property]); |
| 760 | 760 | } |
| 761 | 761 | } |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | |
| 780 | 780 | if ($type['type'] === 'array') { |
| 781 | 781 | // handle the case of a single value |
| 782 | - if ( ! is_array($values[$property])) { |
|
| 782 | + if (!is_array($values[$property])) { |
|
| 783 | 783 | $values[$property] = [$values[$property]]; |
| 784 | 784 | } |
| 785 | 785 | |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | // handle the case if the property has no annotations |
| 814 | - if ( ! $property = self::$annotationMetadata[$name]['default_property']) { |
|
| 814 | + if (!$property = self::$annotationMetadata[$name]['default_property']) { |
|
| 815 | 815 | throw AnnotationException::creationError(sprintf('The annotation @%s declared on %s does not accept any values, but got %s.', $originalName, $this->context, json_encode($values))); |
| 816 | 816 | } |
| 817 | 817 | } |
@@ -832,13 +832,13 @@ discard block |
||
| 832 | 832 | { |
| 833 | 833 | $values = []; |
| 834 | 834 | |
| 835 | - if ( ! $this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { |
|
| 835 | + if (!$this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { |
|
| 836 | 836 | return $values; |
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | $this->match(DocLexer::T_OPEN_PARENTHESIS); |
| 840 | 840 | |
| 841 | - if ( ! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { |
|
| 841 | + if (!$this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { |
|
| 842 | 842 | $values = $this->Values(); |
| 843 | 843 | } |
| 844 | 844 | |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | $token = $this->lexer->lookahead; |
| 868 | 868 | $value = $this->Value(); |
| 869 | 869 | |
| 870 | - if ( ! is_object($value) && ! is_array($value)) { |
|
| 870 | + if (!is_object($value) && !is_array($value)) { |
|
| 871 | 871 | throw $this->syntaxError('Value', $token); |
| 872 | 872 | } |
| 873 | 873 | |
@@ -877,10 +877,10 @@ discard block |
||
| 877 | 877 | foreach ($values as $k => $value) { |
| 878 | 878 | if (is_object($value) && $value instanceof stdClass) { |
| 879 | 879 | $values[$value->name] = $value->value; |
| 880 | - } else if ( ! isset($values['value'])){ |
|
| 880 | + } else if (!isset($values['value'])) { |
|
| 881 | 881 | $values['value'] = $value; |
| 882 | 882 | } else { |
| 883 | - if ( ! is_array($values['value'])) { |
|
| 883 | + if (!is_array($values['value'])) { |
|
| 884 | 884 | $values['value'] = [$values['value']]; |
| 885 | 885 | } |
| 886 | 886 | |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | { |
| 905 | 905 | $identifier = $this->Identifier(); |
| 906 | 906 | |
| 907 | - if ( ! defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { |
|
| 907 | + if (!defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { |
|
| 908 | 908 | list($className, $const) = explode('::', $identifier); |
| 909 | 909 | |
| 910 | 910 | $pos = strpos($className, '\\'); |
@@ -926,12 +926,12 @@ discard block |
||
| 926 | 926 | case isset($this->imports[$loweredAlias]): |
| 927 | 927 | $found = true; |
| 928 | 928 | $className = (false !== $pos) |
| 929 | - ? $this->imports[$loweredAlias] . substr($className, $pos) |
|
| 929 | + ? $this->imports[$loweredAlias].substr($className, $pos) |
|
| 930 | 930 | : $this->imports[$loweredAlias]; |
| 931 | 931 | break; |
| 932 | 932 | |
| 933 | 933 | default: |
| 934 | - if(isset($this->imports['__NAMESPACE__'])) { |
|
| 934 | + if (isset($this->imports['__NAMESPACE__'])) { |
|
| 935 | 935 | $ns = $this->imports['__NAMESPACE__']; |
| 936 | 936 | |
| 937 | 937 | if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { |
@@ -943,14 +943,14 @@ discard block |
||
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | if ($found) { |
| 946 | - $identifier = $className . '::' . $const; |
|
| 946 | + $identifier = $className.'::'.$const; |
|
| 947 | 947 | } |
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | /** |
| 951 | 951 | * Checks if identifier ends with ::class and remove the leading backslash if it exists. |
| 952 | 952 | */ |
| 953 | - if ($this->identifierEndsWithClassConstant($identifier) && ! $this->identifierStartsWithBackslash($identifier)) { |
|
| 953 | + if ($this->identifierEndsWithClassConstant($identifier) && !$this->identifierStartsWithBackslash($identifier)) { |
|
| 954 | 954 | return substr($identifier, 0, $this->getClassConstantPositionInIdentifier($identifier)); |
| 955 | 955 | } |
| 956 | 956 | if ($this->identifierEndsWithClassConstant($identifier) && $this->identifierStartsWithBackslash($identifier)) { |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | private function Identifier(): string |
| 991 | 991 | { |
| 992 | 992 | // check if we have an annotation |
| 993 | - if ( ! $this->lexer->isNextTokenAny(self::$classIdentifiers)) { |
|
| 993 | + if (!$this->lexer->isNextTokenAny(self::$classIdentifiers)) { |
|
| 994 | 994 | throw $this->syntaxError('namespace separator or identifier'); |
| 995 | 995 | } |
| 996 | 996 | |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | $this->match(DocLexer::T_NAMESPACE_SEPARATOR); |
| 1007 | 1007 | $this->matchAny(self::$classIdentifiers); |
| 1008 | 1008 | |
| 1009 | - $className .= '\\' . $this->lexer->token['value']; |
|
| 1009 | + $className .= '\\'.$this->lexer->token['value']; |
|
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | return $className; |
@@ -1058,11 +1058,11 @@ discard block |
||
| 1058 | 1058 | |
| 1059 | 1059 | case DocLexer::T_INTEGER: |
| 1060 | 1060 | $this->match(DocLexer::T_INTEGER); |
| 1061 | - return (int)$this->lexer->token['value']; |
|
| 1061 | + return (int) $this->lexer->token['value']; |
|
| 1062 | 1062 | |
| 1063 | 1063 | case DocLexer::T_FLOAT: |
| 1064 | 1064 | $this->match(DocLexer::T_FLOAT); |
| 1065 | - return (float)$this->lexer->token['value']; |
|
| 1065 | + return (float) $this->lexer->token['value']; |
|
| 1066 | 1066 | |
| 1067 | 1067 | case DocLexer::T_TRUE: |
| 1068 | 1068 | $this->match(DocLexer::T_TRUE); |
@@ -1187,9 +1187,9 @@ discard block |
||
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | 1189 | foreach (array_keys($this->ignoredAnnotationNamespaces) as $ignoredAnnotationNamespace) { |
| 1190 | - $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\') . '\\'; |
|
| 1190 | + $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\').'\\'; |
|
| 1191 | 1191 | |
| 1192 | - if (0 === stripos(rtrim($name, '\\') . '\\', $ignoredAnnotationNamespace)) { |
|
| 1192 | + if (0 === stripos(rtrim($name, '\\').'\\', $ignoredAnnotationNamespace)) { |
|
| 1193 | 1193 | return true; |
| 1194 | 1194 | } |
| 1195 | 1195 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); |
| 142 | 142 | $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); |
| 143 | 143 | |
| 144 | - return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName()); |
|
| 144 | + return $this->parser->parse($class->getDocComment(), 'class '.$class->getName()); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | public function getPropertyAnnotations(ReflectionProperty $property) |
| 167 | 167 | { |
| 168 | 168 | $class = $property->getDeclaringClass(); |
| 169 | - $context = 'property ' . $class->getName() . "::\$" . $property->getName(); |
|
| 169 | + $context = 'property '.$class->getName()."::\$".$property->getName(); |
|
| 170 | 170 | |
| 171 | 171 | $this->parser->setTarget(Target::TARGET_PROPERTY); |
| 172 | 172 | $this->parser->setImports($this->getPropertyImports($property)); |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | public function getMethodAnnotations(ReflectionMethod $method) |
| 199 | 199 | { |
| 200 | 200 | $class = $method->getDeclaringClass(); |
| 201 | - $context = 'method ' . $class->getName() . '::' . $method->getName() . '()'; |
|
| 201 | + $context = 'method '.$class->getName().'::'.$method->getName().'()'; |
|
| 202 | 202 | |
| 203 | 203 | $this->parser->setTarget(Target::TARGET_METHOD); |
| 204 | 204 | $this->parser->setImports($this->getMethodImports($method)); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | private function collectParsingMetadata(ReflectionClass $class) |
| 319 | 319 | { |
| 320 | 320 | $ignoredAnnotationNames = self::$globalIgnoredNames; |
| 321 | - $annotations = $this->preParser->parse($class->getDocComment(), 'class ' . $class->name); |
|
| 321 | + $annotations = $this->preParser->parse($class->getDocComment(), 'class '.$class->name); |
|
| 322 | 322 | |
| 323 | 323 | foreach ($annotations as $annotation) { |
| 324 | 324 | if ($annotation instanceof IgnoreAnnotation) { |