@@ -116,17 +116,17 @@ |
||
| 116 | 116 | $explicitAlias = true; |
| 117 | 117 | $alias = ''; |
| 118 | 118 | } else if ($token === ',') { |
| 119 | - $statements[strtolower($alias)] = $groupRoot . $class; |
|
| 119 | + $statements[strtolower($alias)] = $groupRoot.$class; |
|
| 120 | 120 | $class = ''; |
| 121 | 121 | $alias = ''; |
| 122 | 122 | $explicitAlias = false; |
| 123 | 123 | } else if ($token === ';') { |
| 124 | - $statements[strtolower($alias)] = $groupRoot . $class; |
|
| 124 | + $statements[strtolower($alias)] = $groupRoot.$class; |
|
| 125 | 125 | break; |
| 126 | - } else if ($token === '{' ) { |
|
| 126 | + } else if ($token === '{') { |
|
| 127 | 127 | $groupRoot = $class; |
| 128 | 128 | $class = ''; |
| 129 | - } else if ($token === '}' ) { |
|
| 129 | + } else if ($token === '}') { |
|
| 130 | 130 | continue; |
| 131 | 131 | } else { |
| 132 | 132 | break; |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function __construct(array $values) |
| 77 | 77 | { |
| 78 | - if (!isset($values['value'])){ |
|
| 78 | + if (!isset($values['value'])) { |
|
| 79 | 79 | $values['value'] = null; |
| 80 | 80 | } |
| 81 | - if (is_string($values['value'])){ |
|
| 81 | + if (is_string($values['value'])) { |
|
| 82 | 82 | $values['value'] = [$values['value']]; |
| 83 | 83 | } |
| 84 | - if (!is_array($values['value'])){ |
|
| 84 | + if (!is_array($values['value'])) { |
|
| 85 | 85 | throw new \InvalidArgumentException( |
| 86 | 86 | sprintf('@Target expects either a string value, or an array of strings, "%s" given.', |
| 87 | 87 | is_object($values['value']) ? get_class($values['value']) : gettype($values['value']) |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $bitmask = 0; |
| 93 | 93 | foreach ($values['value'] as $literal) { |
| 94 | - if(!isset(self::$map[$literal])){ |
|
| 94 | + if (!isset(self::$map[$literal])) { |
|
| 95 | 95 | throw new \InvalidArgumentException( |
| 96 | 96 | sprintf('Invalid Target "%s". Available targets: [%s]', |
| 97 | - $literal, implode(', ', array_keys(self::$map))) |
|
| 97 | + $literal, implode(', ', array_keys(self::$map))) |
|
| 98 | 98 | ); |
| 99 | 99 | } |
| 100 | 100 | $bitmask |= self::$map[$literal]; |
@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function __construct(array $values) |
| 58 | 58 | { |
| 59 | - if ( ! isset($values['literal'])) { |
|
| 59 | + if (!isset($values['literal'])) { |
|
| 60 | 60 | $values['literal'] = []; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | foreach ($values['value'] as $var) { |
| 64 | - if( ! is_scalar($var)) { |
|
| 64 | + if (!is_scalar($var)) { |
|
| 65 | 65 | throw new \InvalidArgumentException(sprintf( |
| 66 | 66 | '@Enum supports only scalar values "%s" given.', |
| 67 | 67 | is_object($var) ? get_class($var) : gettype($var) |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | foreach ($values['literal'] as $key => $var) { |
| 73 | - if( ! in_array($key, $values['value'])) { |
|
| 73 | + if (!in_array($key, $values['value'])) { |
|
| 74 | 74 | throw new \InvalidArgumentException(sprintf( |
| 75 | 75 | 'Undefined enumerator value "%s" for literal "%s".', |
| 76 | - $key , $var |
|
| 76 | + $key, $var |
|
| 77 | 77 | )); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public static function syntaxError($message) |
| 41 | 41 | { |
| 42 | - return new self('[Syntax Error] ' . $message); |
|
| 42 | + return new self('[Syntax Error] '.$message); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public static function semanticalError($message) |
| 53 | 53 | { |
| 54 | - return new self('[Semantical Error] ' . $message); |
|
| 54 | + return new self('[Semantical Error] '.$message); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public static function creationError($message) |
| 68 | 68 | { |
| 69 | - return new self('[Creation Error] ' . $message); |
|
| 69 | + return new self('[Creation Error] '.$message); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public static function typeError($message) |
| 82 | 82 | { |
| 83 | - return new self('[Type Error] ' . $message); |
|
| 83 | + return new self('[Type Error] '.$message); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | return self::semanticalError(sprintf( |
| 99 | 99 | "Couldn't find constant %s%s.", |
| 100 | 100 | $identifier, |
| 101 | - $context ? ', ' . $context : '' |
|
| 101 | + $context ? ', '.$context : '' |
|
| 102 | 102 | )); |
| 103 | 103 | } |
| 104 | 104 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $annotationName, |
| 124 | 124 | $context, |
| 125 | 125 | $expected, |
| 126 | - is_object($actual) ? 'an instance of ' . get_class($actual) : gettype($actual) |
|
| 126 | + is_object($actual) ? 'an instance of '.get_class($actual) : gettype($actual) |
|
| 127 | 127 | )); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -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) { |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $namespace = preg_quote($class->getNamespaceName()); |
| 56 | - $content = preg_replace('/^.*?(\bnamespace\s+' . $namespace . '\s*[;{].*)$/s', '\\1', $content); |
|
| 57 | - $tokenizer = new TokenParser('<?php ' . $content); |
|
| 56 | + $content = preg_replace('/^.*?(\bnamespace\s+'.$namespace.'\s*[;{].*)$/s', '\\1', $content); |
|
| 57 | + $tokenizer = new TokenParser('<?php '.$content); |
|
| 58 | 58 | |
| 59 | 59 | $statements = $tokenizer->parseUseStatements($class->getNamespaceName()); |
| 60 | 60 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | private function getFileContent($filename, $lineNumber) |
| 73 | 73 | { |
| 74 | - if ( ! is_file($filename)) { |
|
| 74 | + if (!is_file($filename)) { |
|
| 75 | 75 | return null; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | ', ', |
| 107 | 107 | array_filter( |
| 108 | 108 | self::LABELS, |
| 109 | - function (int $target) : bool { |
|
| 109 | + function(int $target) : bool { |
|
| 110 | 110 | return ($this->target & $target) === $target; |
| 111 | 111 | }, |
| 112 | 112 | 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 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $this->usesConstructor = $hasConstructor; |
| 46 | 46 | $this->properties = array_combine( |
| 47 | 47 | array_map( |
| 48 | - static function (PropertyMetadata $property) : string { |
|
| 48 | + static function(PropertyMetadata $property) : string { |
|
| 49 | 49 | return $property->getName(); |
| 50 | 50 | }, |
| 51 | 51 | $properties |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $defaultProperties = array_filter( |
| 57 | 57 | $properties, |
| 58 | - static function (PropertyMetadata $property) : bool { |
|
| 58 | + static function(PropertyMetadata $property) : bool { |
|
| 59 | 59 | return $property->isDefault(); |
| 60 | 60 | } |
| 61 | 61 | ); |