@@ -367,6 +367,10 @@ |
||
| 367 | 367 | return $file; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | + /** |
|
| 371 | + * @param string $class |
|
| 372 | + * @param string $ext |
|
| 373 | + */ |
|
| 370 | 374 | private function findFileWithExtension($class, $ext) |
| 371 | 375 | { |
| 372 | 376 | // PSR-4 lookup |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | private function findFileWithExtension($class, $ext) |
| 371 | 371 | { |
| 372 | 372 | // PSR-4 lookup |
| 373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
| 373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
| 374 | 374 | |
| 375 | 375 | $first = $class[0]; |
| 376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
| 382 | 382 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
| 383 | 383 | $length = $this->prefixLengthsPsr4[$first][$search]; |
| 384 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { |
|
| 384 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $length))) { |
|
| 385 | 385 | return $file; |
| 386 | 386 | } |
| 387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | // PSR-4 fallback dirs |
| 393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
| 394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
| 394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
| 395 | 395 | return $file; |
| 396 | 396 | } |
| 397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
| 403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
| 404 | 404 | } else { |
| 405 | 405 | // PEAR-like class name |
| 406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
| 406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
| 410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
| 411 | 411 | if (0 === strpos($class, $prefix)) { |
| 412 | 412 | foreach ($dirs as $dir) { |
| 413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
| 414 | 414 | return $file; |
| 415 | 415 | } |
| 416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | // PSR-0 fallback dirs |
| 422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
| 423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
| 424 | 424 | return $file; |
| 425 | 425 | } |
| 426 | 426 | } |
@@ -51,7 +51,6 @@ |
||
| 51 | 51 | * interface is passed as alias then every time that interface is requested the provided service will be returned. |
| 52 | 52 | * |
| 53 | 53 | * @param object $service |
| 54 | - * @param string $alias |
|
| 55 | 54 | * |
| 56 | 55 | * @return void |
| 57 | 56 | */ |
@@ -43,6 +43,9 @@ |
||
| 43 | 43 | /** @var string The version vector. */ |
| 44 | 44 | private $version = ''; |
| 45 | 45 | |
| 46 | + /** |
|
| 47 | + * @param string $version |
|
| 48 | + */ |
|
| 46 | 49 | public function __construct($version = null, Description $description = null) |
| 47 | 50 | { |
| 48 | 51 | Assert::nullOrStringNotEmpty($version); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $matches = []; |
| 65 | - if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { |
|
| 65 | + if (!preg_match('/^('.self::REGEX_VECTOR.')\s*(.+)?$/sux', $body, $matches)) { |
|
| 66 | 66 | return new static( |
| 67 | 67 | null, |
| 68 | 68 | null !== $descriptionFactory ? $descriptionFactory->create($body, $context) : null |
@@ -92,6 +92,6 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function __toString() |
| 94 | 94 | { |
| 95 | - return $this->version . ($this->description ? ' ' . $this->description->render() : ''); |
|
| 95 | + return $this->version.($this->description ? ' '.$this->description->render() : ''); |
|
| 96 | 96 | } |
| 97 | 97 | } |
@@ -12,8 +12,6 @@ |
||
| 12 | 12 | |
| 13 | 13 | namespace phpDocumentor\Reflection\DocBlock\Tags; |
| 14 | 14 | |
| 15 | -use phpDocumentor\Reflection\DocBlock\Tag; |
|
| 16 | - |
|
| 17 | 15 | /** |
| 18 | 16 | * Reflection class for a {@}example tag in a Docblock. |
| 19 | 17 | */ |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | public function getContent() |
| 37 | 37 | { |
| 38 | 38 | if (null === $this->description) { |
| 39 | - $filePath = '"' . $this->filePath . '"'; |
|
| 39 | + $filePath = '"'.$this->filePath.'"'; |
|
| 40 | 40 | if ($this->isURI) { |
| 41 | 41 | $filePath = $this->isUriRelative($this->filePath) |
| 42 | 42 | ? str_replace('%2F', '/', rawurlencode($this->filePath)) |
| 43 | 43 | :$this->filePath; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - $this->description = $filePath . ' ' . parent::getContent(); |
|
| 46 | + $this->description = $filePath.' '.parent::getContent(); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return $this->description; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public static function create($body) |
| 56 | 56 | { |
| 57 | 57 | // File component: File path in quotes or File URI / Source information |
| 58 | - if (! preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) { |
|
| 58 | + if (!preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) { |
|
| 59 | 59 | return null; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | // Starting line / Number of lines / Description |
| 75 | 75 | if (preg_match('/^([1-9]\d*)\s*(?:((?1))\s+)?(.*)$/sux', $matches[3], $matches)) { |
| 76 | - $startingLine = (int)$matches[1]; |
|
| 76 | + $startingLine = (int) $matches[1]; |
|
| 77 | 77 | if (isset($matches[2]) && $matches[2] !== '') { |
| 78 | - $lineCount = (int)$matches[2]; |
|
| 78 | + $lineCount = (int) $matches[2]; |
|
| 79 | 79 | } |
| 80 | 80 | $description = $matches[3]; |
| 81 | 81 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function setFileURI($uri) |
| 126 | 126 | { |
| 127 | - $this->isURI = true; |
|
| 127 | + $this->isURI = true; |
|
| 128 | 128 | $this->description = null; |
| 129 | 129 | |
| 130 | 130 | $this->filePath = $this->isUriRelative($uri) |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function __toString() |
| 143 | 143 | { |
| 144 | - return $this->filePath . ($this->description ? ' ' . $this->description->render() : ''); |
|
| 144 | + return $this->filePath.($this->description ? ' '.$this->description->render() : ''); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -219,6 +219,9 @@ |
||
| 219 | 219 | return $arguments; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | + /** |
|
| 223 | + * @return string |
|
| 224 | + */ |
|
| 222 | 225 | private static function stripRestArg($argument) |
| 223 | 226 | { |
| 224 | 227 | if (strpos($argument, '...') === 0) { |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | TypeContext $context = null |
| 71 | 71 | ) { |
| 72 | 72 | Assert::stringNotEmpty($body); |
| 73 | - Assert::allNotNull([ $typeResolver, $descriptionFactory ]); |
|
| 73 | + Assert::allNotNull([$typeResolver, $descriptionFactory]); |
|
| 74 | 74 | |
| 75 | 75 | // 1. none or more whitespace |
| 76 | 76 | // 2. optionally the keyword "static" followed by whitespace |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | if ('' !== $arguments) { |
| 128 | 128 | $arguments = explode(',', $arguments); |
| 129 | - foreach($arguments as &$argument) { |
|
| 129 | + foreach ($arguments as &$argument) { |
|
| 130 | 130 | $argument = explode(' ', self::stripRestArg(trim($argument)), 2); |
| 131 | 131 | if ($argument[0][0] === '$') { |
| 132 | 132 | $argumentName = substr($argument[0], 1); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $argument = [ 'name' => $argumentName, 'type' => $argumentType]; |
|
| 143 | + $argument = ['name' => $argumentName, 'type' => $argumentType]; |
|
| 144 | 144 | } |
| 145 | 145 | } else { |
| 146 | 146 | $arguments = []; |
@@ -189,29 +189,29 @@ discard block |
||
| 189 | 189 | { |
| 190 | 190 | $arguments = []; |
| 191 | 191 | foreach ($this->arguments as $argument) { |
| 192 | - $arguments[] = $argument['type'] . ' $' . $argument['name']; |
|
| 192 | + $arguments[] = $argument['type'].' $'.$argument['name']; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | return ($this->isStatic() ? 'static ' : '') |
| 196 | - . (string)$this->returnType . ' ' |
|
| 196 | + . (string) $this->returnType.' ' |
|
| 197 | 197 | . $this->methodName |
| 198 | - . '(' . implode(', ', $arguments) . ')' |
|
| 199 | - . ($this->description ? ' ' . $this->description->render() : ''); |
|
| 198 | + . '('.implode(', ', $arguments).')' |
|
| 199 | + . ($this->description ? ' '.$this->description->render() : ''); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | private function filterArguments($arguments) |
| 203 | 203 | { |
| 204 | 204 | foreach ($arguments as &$argument) { |
| 205 | 205 | if (is_string($argument)) { |
| 206 | - $argument = [ 'name' => $argument ]; |
|
| 206 | + $argument = ['name' => $argument]; |
|
| 207 | 207 | } |
| 208 | - if (! isset($argument['type'])) { |
|
| 208 | + if (!isset($argument['type'])) { |
|
| 209 | 209 | $argument['type'] = new Void_(); |
| 210 | 210 | } |
| 211 | 211 | $keys = array_keys($argument); |
| 212 | - if ($keys !== [ 'name', 'type' ]) { |
|
| 212 | + if ($keys !== ['name', 'type']) { |
|
| 213 | 213 | throw new \InvalidArgumentException( |
| 214 | - 'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true) |
|
| 214 | + 'Arguments can only have the "name" and "type" fields, found: '.var_export($keys, true) |
|
| 215 | 215 | ); |
| 216 | 216 | } |
| 217 | 217 | } |
@@ -43,6 +43,9 @@ |
||
| 43 | 43 | /** @var string The version vector. */ |
| 44 | 44 | private $version = ''; |
| 45 | 45 | |
| 46 | + /** |
|
| 47 | + * @param string $version |
|
| 48 | + */ |
|
| 46 | 49 | public function __construct($version = null, Description $description = null) |
| 47 | 50 | { |
| 48 | 51 | Assert::nullOrStringNotEmpty($version); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $matches = []; |
| 65 | - if (! preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { |
|
| 65 | + if (!preg_match('/^('.self::REGEX_VECTOR.')\s*(.+)?$/sux', $body, $matches)) { |
|
| 66 | 66 | return null; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -89,6 +89,6 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function __toString() |
| 91 | 91 | { |
| 92 | - return $this->version . ($this->description ? ' ' . $this->description->render() : ''); |
|
| 92 | + return $this->version.($this->description ? ' '.$this->description->render() : ''); |
|
| 93 | 93 | } |
| 94 | 94 | } |
@@ -43,6 +43,9 @@ |
||
| 43 | 43 | /** @var string The version vector. */ |
| 44 | 44 | private $version = ''; |
| 45 | 45 | |
| 46 | + /** |
|
| 47 | + * @param string $version |
|
| 48 | + */ |
|
| 46 | 49 | public function __construct($version = null, Description $description = null) |
| 47 | 50 | { |
| 48 | 51 | Assert::nullOrStringNotEmpty($version); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $matches = []; |
| 65 | - if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { |
|
| 65 | + if (!preg_match('/^('.self::REGEX_VECTOR.')\s*(.+)?$/sux', $body, $matches)) { |
|
| 66 | 66 | return null; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -89,6 +89,6 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function __toString() |
| 91 | 91 | { |
| 92 | - return $this->version . ($this->description ? ' ' . $this->description->render() : ''); |
|
| 92 | + return $this->version.($this->description ? ' '.$this->description->render() : ''); |
|
| 93 | 93 | } |
| 94 | 94 | } |
@@ -103,6 +103,10 @@ discard block |
||
| 103 | 103 | ); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | + /** |
|
| 107 | + * @param integer $tagName |
|
| 108 | + * @param string $handler |
|
| 109 | + */ |
|
| 106 | 110 | public function registerTagHandler($tagName, $handler) |
| 107 | 111 | { |
| 108 | 112 | $this->tagFactory->registerTagHandler($tagName, $handler); |
@@ -254,7 +258,7 @@ discard block |
||
| 254 | 258 | } |
| 255 | 259 | |
| 256 | 260 | /** |
| 257 | - * @param $tags |
|
| 261 | + * @param string $tags |
|
| 258 | 262 | * @return string |
| 259 | 263 | */ |
| 260 | 264 | private function filterTagBlock($tags) |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | if (isset($tag_line[0]) && ($tag_line[0] === '@')) { |
| 247 | 247 | $result[] = $tag_line; |
| 248 | 248 | } else { |
| 249 | - $result[count($result) - 1] .= "\n" . $tag_line; |
|
| 249 | + $result[count($result) - 1] .= "\n".$tag_line; |
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | // @codeCoverageIgnoreStart |
| 269 | 269 | // Can't simulate this; this only happens if there is an error with the parsing of the DocBlock that |
| 270 | 270 | // we didn't foresee. |
| 271 | - throw new \LogicException('A tag block started with text instead of an at-sign(@): ' . $tags); |
|
| 271 | + throw new \LogicException('A tag block started with text instead of an at-sign(@): '.$tags); |
|
| 272 | 272 | // @codeCoverageIgnoreEnd |
| 273 | 273 | } |
| 274 | 274 | |
@@ -12,11 +12,6 @@ |
||
| 12 | 12 | |
| 13 | 13 | namespace phpDocumentor\Reflection; |
| 14 | 14 | |
| 15 | -use phpDocumentor\Reflection\DocBlock\Description; |
|
| 16 | -use phpDocumentor\Reflection\DocBlock\StandardTagFactory; |
|
| 17 | -use phpDocumentor\Reflection\DocBlock\Tag; |
|
| 18 | -use phpDocumentor\Reflection\DocBlock\Tags\See; |
|
| 19 | - |
|
| 20 | 15 | /** |
| 21 | 16 | * @coversNothing |
| 22 | 17 | */ |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * @var string $docComment |
| 29 | 29 | * @var string $reconstitutedDocComment |
| 30 | 30 | */ |
| 31 | - include(__DIR__ . '/../../examples/03-reconstituting-a-docblock.php'); |
|
| 31 | + include(__DIR__.'/../../examples/03-reconstituting-a-docblock.php'); |
|
| 32 | 32 | |
| 33 | 33 | $this->assertSame($docComment, $reconstitutedDocComment); |
| 34 | 34 | } |