@@ -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 | |
@@ -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]; |
@@ -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 | } |
@@ -99,17 +99,17 @@ |
||
| 99 | 99 | $explicitAlias = true; |
| 100 | 100 | $alias = ''; |
| 101 | 101 | } else if ($token === ',') { |
| 102 | - $statements[strtolower($alias)] = $groupRoot . $class; |
|
| 102 | + $statements[strtolower($alias)] = $groupRoot.$class; |
|
| 103 | 103 | $class = ''; |
| 104 | 104 | $alias = ''; |
| 105 | 105 | $explicitAlias = false; |
| 106 | 106 | } else if ($token === ';') { |
| 107 | - $statements[strtolower($alias)] = $groupRoot . $class; |
|
| 107 | + $statements[strtolower($alias)] = $groupRoot.$class; |
|
| 108 | 108 | break; |
| 109 | - } else if ($token === '{' ) { |
|
| 109 | + } else if ($token === '{') { |
|
| 110 | 110 | $groupRoot = $class; |
| 111 | 111 | $class = ''; |
| 112 | - } else if ($token === '}' ) { |
|
| 112 | + } else if ($token === '}') { |
|
| 113 | 113 | continue; |
| 114 | 114 | } else { |
| 115 | 115 | break; |
@@ -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 | |
@@ -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) { |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | ', ', |
| 103 | 103 | array_filter( |
| 104 | 104 | self::LABELS, |
| 105 | - function (int $target) : bool { |
|
| 105 | + function(int $target) : bool { |
|
| 106 | 106 | return ($this->target & $target) === $target; |
| 107 | 107 | }, |
| 108 | 108 | ARRAY_FILTER_USE_KEY |
@@ -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 |