@@ -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 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function getClassAnnotations(ReflectionClass $class) |
| 47 | 47 | { |
| 48 | - return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName()); |
|
| 48 | + return $this->parser->parse($class->getDocComment(), 'class '.$class->getName()); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function getMethodAnnotations(ReflectionMethod $method) |
| 55 | 55 | { |
| 56 | - return $this->parser->parse($method->getDocComment(), 'method ' . $method->getDeclaringClass()->name . '::' . $method->getName() . '()'); |
|
| 56 | + return $this->parser->parse($method->getDocComment(), 'method '.$method->getDeclaringClass()->name.'::'.$method->getName().'()'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function getPropertyAnnotations(ReflectionProperty $property) |
| 63 | 63 | { |
| 64 | - return $this->parser->parse($property->getDocComment(), 'property ' . $property->getDeclaringClass()->name . '::$' . $property->getName()); |
|
| 64 | + return $this->parser->parse($property->getDocComment(), 'property '.$property->getDeclaringClass()->name.'::$'.$property->getName()); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function __construct(array $values) |
| 42 | 42 | { |
| 43 | - if (! isset($values['literal'])) { |
|
| 43 | + if (!isset($values['literal'])) { |
|
| 44 | 44 | $values['literal'] = []; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | foreach ($values['value'] as $var) { |
| 48 | - if (! is_scalar($var)) { |
|
| 48 | + if (!is_scalar($var)) { |
|
| 49 | 49 | throw new InvalidArgumentException(sprintf( |
| 50 | 50 | '@Enum supports only scalar values "%s" given.', |
| 51 | 51 | is_object($var) ? get_class($var) : gettype($var) |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | foreach ($values['literal'] as $key => $var) { |
| 57 | - if (! in_array($key, $values['value'])) { |
|
| 57 | + if (!in_array($key, $values['value'])) { |
|
| 58 | 58 | throw new InvalidArgumentException(sprintf( |
| 59 | 59 | 'Undefined enumerator value "%s" for literal "%s".', |
| 60 | 60 | $key, |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function __construct(array $values) |
| 62 | 62 | { |
| 63 | - if (! isset($values['value'])) { |
|
| 63 | + if (!isset($values['value'])) { |
|
| 64 | 64 | $values['value'] = null; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $values['value'] = [$values['value']]; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if (! is_array($values['value'])) { |
|
| 71 | + if (!is_array($values['value'])) { |
|
| 72 | 72 | throw new InvalidArgumentException( |
| 73 | 73 | sprintf( |
| 74 | 74 | '@Target expects either a string value, or an array of strings, "%s" given.', |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $bitmask = 0; |
| 81 | 81 | foreach ($values['value'] as $literal) { |
| 82 | - if (! isset(self::$map[$literal])) { |
|
| 82 | + if (!isset(self::$map[$literal])) { |
|
| 83 | 83 | throw new InvalidArgumentException( |
| 84 | 84 | sprintf( |
| 85 | 85 | 'Invalid Target "%s". Available targets: [%s]', |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | $values['value'] = [$values['value']]; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if (! is_array($values['value'])) { |
|
| 34 | + if (!is_array($values['value'])) { |
|
| 35 | 35 | throw new RuntimeException(sprintf('@IgnoreAnnotation expects either a string name, or an array of strings, but got %s.', json_encode($values['value']))); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | public function getPropertyAnnotations(ReflectionProperty $property) |
| 84 | 84 | { |
| 85 | 85 | $class = $property->getDeclaringClass(); |
| 86 | - $cacheKey = $class->getName() . '$' . $property->getName(); |
|
| 86 | + $cacheKey = $class->getName().'$'.$property->getName(); |
|
| 87 | 87 | |
| 88 | 88 | if (isset($this->loadedAnnotations[$cacheKey])) { |
| 89 | 89 | return $this->loadedAnnotations[$cacheKey]; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | public function getMethodAnnotations(ReflectionMethod $method) |
| 118 | 118 | { |
| 119 | 119 | $class = $method->getDeclaringClass(); |
| 120 | - $cacheKey = $class->getName() . '#' . $method->getName(); |
|
| 120 | + $cacheKey = $class->getName().'#'.$method->getName(); |
|
| 121 | 121 | |
| 122 | 122 | if (isset($this->loadedAnnotations[$cacheKey])) { |
| 123 | 123 | return $this->loadedAnnotations[$cacheKey]; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | private function fetchFromCache($cacheKey, ReflectionClass $class) |
| 167 | 167 | { |
| 168 | 168 | if (($data = $this->cache->fetch($cacheKey)) !== false) { |
| 169 | - if (! $this->debug || $this->isCacheFresh($cacheKey, $class)) { |
|
| 169 | + if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) { |
|
| 170 | 170 | return $data; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | private function saveToCache($cacheKey, $value) |
| 186 | 186 | { |
| 187 | 187 | $this->cache->save($cacheKey, $value); |
| 188 | - if (! $this->debug) { |
|
| 188 | + if (!$this->debug) { |
|
| 189 | 189 | return; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $this->cache->save('[C]' . $cacheKey, time()); |
|
| 192 | + $this->cache->save('[C]'.$cacheKey, time()); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | return true; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - return $this->cache->fetch('[C]' . $cacheKey) >= $lastModification; |
|
| 209 | + return $this->cache->fetch('[C]'.$cacheKey) >= $lastModification; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | $parent = $class->getParentClass(); |
| 226 | 226 | |
| 227 | - $lastModification = max(array_merge( |
|
| 227 | + $lastModification = max(array_merge( |
|
| 228 | 228 | [$filename ? filemtime($filename) : 0], |
| 229 | 229 | array_map([$this, 'getTraitLastModificationTime'], $class->getTraits()), |
| 230 | 230 | array_map([$this, 'getLastModification'], $class->getInterfaces()), |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function __construct(Reader $reader, $cacheDir, $debug = false, $umask = 0002) |
| 65 | 65 | { |
| 66 | - if (! is_int($umask)) { |
|
| 66 | + if (!is_int($umask)) { |
|
| 67 | 67 | throw new InvalidArgumentException(sprintf( |
| 68 | 68 | 'The parameter umask must be an integer, was: %s', |
| 69 | 69 | gettype($umask) |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $this->reader = $reader; |
| 74 | 74 | $this->umask = $umask; |
| 75 | 75 | |
| 76 | - if (! is_dir($cacheDir) && ! @mkdir($cacheDir, 0777 & (~$this->umask), true)) { |
|
| 76 | + if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777 & (~$this->umask), true)) { |
|
| 77 | 77 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist and could not be created.', $cacheDir)); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function getClassAnnotations(ReflectionClass $class) |
| 88 | 88 | { |
| 89 | - if (! isset($this->classNameHashes[$class->name])) { |
|
| 89 | + if (!isset($this->classNameHashes[$class->name])) { |
|
| 90 | 90 | $this->classNameHashes[$class->name] = sha1($class->name); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | return $this->loadedAnnotations[$key]; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php'; |
|
| 100 | - if (! is_file($path)) { |
|
| 99 | + $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php'; |
|
| 100 | + if (!is_file($path)) { |
|
| 101 | 101 | $annot = $this->reader->getClassAnnotations($class); |
| 102 | 102 | $this->saveCacheFile($path, $annot); |
| 103 | 103 | |
@@ -126,18 +126,18 @@ discard block |
||
| 126 | 126 | public function getPropertyAnnotations(ReflectionProperty $property) |
| 127 | 127 | { |
| 128 | 128 | $class = $property->getDeclaringClass(); |
| 129 | - if (! isset($this->classNameHashes[$class->name])) { |
|
| 129 | + if (!isset($this->classNameHashes[$class->name])) { |
|
| 130 | 130 | $this->classNameHashes[$class->name] = sha1($class->name); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $key = $this->classNameHashes[$class->name] . '$' . $property->getName(); |
|
| 133 | + $key = $this->classNameHashes[$class->name].'$'.$property->getName(); |
|
| 134 | 134 | |
| 135 | 135 | if (isset($this->loadedAnnotations[$key])) { |
| 136 | 136 | return $this->loadedAnnotations[$key]; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php'; |
|
| 140 | - if (! is_file($path)) { |
|
| 139 | + $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php'; |
|
| 140 | + if (!is_file($path)) { |
|
| 141 | 141 | $annot = $this->reader->getPropertyAnnotations($property); |
| 142 | 142 | $this->saveCacheFile($path, $annot); |
| 143 | 143 | |
@@ -166,18 +166,18 @@ discard block |
||
| 166 | 166 | public function getMethodAnnotations(ReflectionMethod $method) |
| 167 | 167 | { |
| 168 | 168 | $class = $method->getDeclaringClass(); |
| 169 | - if (! isset($this->classNameHashes[$class->name])) { |
|
| 169 | + if (!isset($this->classNameHashes[$class->name])) { |
|
| 170 | 170 | $this->classNameHashes[$class->name] = sha1($class->name); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - $key = $this->classNameHashes[$class->name] . '#' . $method->getName(); |
|
| 173 | + $key = $this->classNameHashes[$class->name].'#'.$method->getName(); |
|
| 174 | 174 | |
| 175 | 175 | if (isset($this->loadedAnnotations[$key])) { |
| 176 | 176 | return $this->loadedAnnotations[$key]; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php'; |
|
| 180 | - if (! is_file($path)) { |
|
| 179 | + $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php'; |
|
| 180 | + if (!is_file($path)) { |
|
| 181 | 181 | $annot = $this->reader->getMethodAnnotations($method); |
| 182 | 182 | $this->saveCacheFile($path, $annot); |
| 183 | 183 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | private function saveCacheFile($path, $data) |
| 212 | 212 | { |
| 213 | - if (! is_writable($this->dir)) { |
|
| 213 | + if (!is_writable($this->dir)) { |
|
| 214 | 214 | throw new InvalidArgumentException(sprintf('The directory "%s" is not writable. Both, the webserver and the console user need access. You can manage access rights for multiple users with "chmod +a". If your system does not support this, check out the acl package.', $this->dir)); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | @chmod($tempfile, 0666 & (~$this->umask)); |
| 224 | 224 | |
| 225 | - $written = file_put_contents($tempfile, '<?php return unserialize(' . var_export(serialize($data), true) . ');'); |
|
| 225 | + $written = file_put_contents($tempfile, '<?php return unserialize('.var_export(serialize($data), true).');'); |
|
| 226 | 226 | |
| 227 | 227 | if ($written === false) { |
| 228 | 228 | throw new RuntimeException(sprintf('Unable to write cached file to: %s', $tempfile)); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $statements = []; |
| 103 | 103 | $explicitAlias = false; |
| 104 | 104 | while (($token = $this->next())) { |
| 105 | - if (! $explicitAlias && $token[0] === T_STRING) { |
|
| 105 | + if (!$explicitAlias && $token[0] === T_STRING) { |
|
| 106 | 106 | $class .= $token[1]; |
| 107 | 107 | $alias = $token[1]; |
| 108 | 108 | } elseif ($explicitAlias && $token[0] === T_STRING) { |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | $explicitAlias = true; |
| 120 | 120 | $alias = ''; |
| 121 | 121 | } elseif ($token === ',') { |
| 122 | - $statements[strtolower($alias)] = $groupRoot . $class; |
|
| 122 | + $statements[strtolower($alias)] = $groupRoot.$class; |
|
| 123 | 123 | $class = ''; |
| 124 | 124 | $alias = ''; |
| 125 | 125 | $explicitAlias = false; |
| 126 | 126 | } elseif ($token === ';') { |
| 127 | - $statements[strtolower($alias)] = $groupRoot . $class; |
|
| 127 | + $statements[strtolower($alias)] = $groupRoot.$class; |
|
| 128 | 128 | break; |
| 129 | 129 | } elseif ($token === '{') { |
| 130 | 130 | $groupRoot = $class; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); |
| 140 | 140 | $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); |
| 141 | 141 | |
| 142 | - return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName()); |
|
| 142 | + return $this->parser->parse($class->getDocComment(), 'class '.$class->getName()); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | public function getPropertyAnnotations(ReflectionProperty $property) |
| 165 | 165 | { |
| 166 | 166 | $class = $property->getDeclaringClass(); |
| 167 | - $context = 'property ' . $class->getName() . '::$' . $property->getName(); |
|
| 167 | + $context = 'property '.$class->getName().'::$'.$property->getName(); |
|
| 168 | 168 | |
| 169 | 169 | $this->parser->setTarget(Target::TARGET_PROPERTY); |
| 170 | 170 | $this->parser->setImports($this->getPropertyImports($property)); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | public function getMethodAnnotations(ReflectionMethod $method) |
| 197 | 197 | { |
| 198 | 198 | $class = $method->getDeclaringClass(); |
| 199 | - $context = 'method ' . $class->getName() . '::' . $method->getName() . '()'; |
|
| 199 | + $context = 'method '.$class->getName().'::'.$method->getName().'()'; |
|
| 200 | 200 | |
| 201 | 201 | $this->parser->setTarget(Target::TARGET_METHOD); |
| 202 | 202 | $this->parser->setImports($this->getMethodImports($method)); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | foreach ($class->getTraits() as $trait) { |
| 272 | 272 | if ( |
| 273 | - ! $trait->hasMethod($method->getName()) |
|
| 273 | + !$trait->hasMethod($method->getName()) |
|
| 274 | 274 | || $trait->getFileName() !== $method->getFileName() |
| 275 | 275 | ) { |
| 276 | 276 | continue; |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $traitImports = []; |
| 296 | 296 | |
| 297 | 297 | foreach ($class->getTraits() as $trait) { |
| 298 | - if (! $trait->hasProperty($property->getName())) { |
|
| 298 | + if (!$trait->hasProperty($property->getName())) { |
|
| 299 | 299 | continue; |
| 300 | 300 | } |
| 301 | 301 | |
@@ -311,10 +311,10 @@ discard block |
||
| 311 | 311 | private function collectParsingMetadata(ReflectionClass $class) |
| 312 | 312 | { |
| 313 | 313 | $ignoredAnnotationNames = self::$globalIgnoredNames; |
| 314 | - $annotations = $this->preParser->parse($class->getDocComment(), 'class ' . $class->name); |
|
| 314 | + $annotations = $this->preParser->parse($class->getDocComment(), 'class '.$class->name); |
|
| 315 | 315 | |
| 316 | 316 | foreach ($annotations as $annotation) { |
| 317 | - if (! ($annotation instanceof IgnoreAnnotation)) { |
|
| 317 | + if (!($annotation instanceof IgnoreAnnotation)) { |
|
| 318 | 318 | continue; |
| 319 | 319 | } |
| 320 | 320 | |