mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd9e6bd26d | ||
|
|
d5e4b2ec73 | ||
|
|
bae8be0dcd | ||
|
|
3a5d30e027 | ||
|
|
d2414cd3dc | ||
|
|
070b13745a | ||
|
|
df7807cd73 | ||
|
|
b07e3c36b7 | ||
|
|
163dd7877e | ||
|
|
ac6e37af97 | ||
|
|
4a7affe15b | ||
|
|
b7797b4e1a | ||
|
|
8b529636bf | ||
|
|
2e9fd6a2e8 | ||
|
|
cbb14bab1e | ||
|
|
d57128e65c | ||
|
|
d9c0928243 | ||
|
|
63c9de4e8b | ||
|
|
76619d4a16 | ||
|
|
47d3f86c53 | ||
|
|
cfb104b8c8 | ||
|
|
5c51ccf185 |
+5
-3
@@ -1,16 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "phpdocumentor/reflection-docblock",
|
"name": "barryvdh/reflection-docblock",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"authors": [
|
"authors": [
|
||||||
{"name": "Mike van Riel", "email": "[email protected]"}
|
{"name": "Mike van Riel", "email": "[email protected]"}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.3",
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
"dflydev/markdown": "1.0.*"
|
"dflydev/markdown": "1.0.*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {"phpDocumentor": ["src/"]}
|
"psr-0": {"Barryvdh": ["src/"]}
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "3.7.*@stable"
|
"phpunit/phpunit": "3.7.*@stable"
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection;
|
namespace Barryvdh\Reflection;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
use phpDocumentor\Reflection\DocBlock\Context;
|
use Barryvdh\Reflection\DocBlock\Context;
|
||||||
use phpDocumentor\Reflection\DocBlock\Location;
|
use Barryvdh\Reflection\DocBlock\Location;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the DocBlock for any structure.
|
* Parses the DocBlock for any structure.
|
||||||
@@ -143,7 +143,7 @@ class DocBlock implements \Reflector
|
|||||||
* Splits the docblock into a short description, long description and
|
* Splits the docblock into a short description, long description and
|
||||||
* tags section
|
* tags section
|
||||||
* - The short description is started from the first character until
|
* - The short description is started from the first character until
|
||||||
* a dot is encountered followed by a whitespace OR
|
* a dot is encountered followed by a newline OR
|
||||||
* two consecutive newlines (horizontal whitespace is taken into
|
* two consecutive newlines (horizontal whitespace is taken into
|
||||||
* account to consider spacing errors)
|
* account to consider spacing errors)
|
||||||
* - The long description, any character until a new line is
|
* - The long description, any character until a new line is
|
||||||
@@ -158,7 +158,7 @@ class DocBlock implements \Reflector
|
|||||||
\A (
|
\A (
|
||||||
[^\n.]+
|
[^\n.]+
|
||||||
(?:
|
(?:
|
||||||
(?! \. \s | \n{2} ) # disallow the first seperator here
|
(?! \. \n | \n{2} ) # disallow the first seperator here
|
||||||
[\n.] (?! [ \t]* @\pL ) # disallow second seperator
|
[\n.] (?! [ \t]* @\pL ) # disallow second seperator
|
||||||
[^\n.]+
|
[^\n.]+
|
||||||
)*
|
)*
|
||||||
@@ -229,6 +229,43 @@ class DocBlock implements \Reflector
|
|||||||
$this->tags = $result;
|
$this->tags = $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the text portion of the doc block.
|
||||||
|
*
|
||||||
|
* Gets the text portion (short and long description combined) of the doc
|
||||||
|
* block.
|
||||||
|
*
|
||||||
|
* @return string The text portion of the doc block.
|
||||||
|
*/
|
||||||
|
public function getText()
|
||||||
|
{
|
||||||
|
$short = $this->getShortDescription();
|
||||||
|
$long = $this->getLongDescription()->getContents();
|
||||||
|
|
||||||
|
if ($long) {
|
||||||
|
return "{$short}\n\n{$long}";
|
||||||
|
} else {
|
||||||
|
return $short;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text portion of the doc block.
|
||||||
|
*
|
||||||
|
* Sets the text portion (short and long description combined) of the doc
|
||||||
|
* block.
|
||||||
|
*
|
||||||
|
* @param string $docblock The new text portion of the doc block.
|
||||||
|
*
|
||||||
|
* @return $this This doc block.
|
||||||
|
*/
|
||||||
|
public function setText($comment)
|
||||||
|
{
|
||||||
|
list($short, $long) = $this->splitDocBlock($comment);
|
||||||
|
$this->short_description = $short;
|
||||||
|
$this->long_description = new DocBlock\Description($long, $this);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the opening line or also known as short description.
|
* Returns the opening line or also known as short description.
|
||||||
*
|
*
|
||||||
@@ -321,14 +358,14 @@ class DocBlock implements \Reflector
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends a tag at the end of the list of tags.
|
* Appends a tag at the end of the list of tags.
|
||||||
*
|
*
|
||||||
* @param Tag $tag The tag to add.
|
* @param Tag $tag The tag to add.
|
||||||
*
|
*
|
||||||
* @return Tag The newly added tag.
|
* @return Tag The newly added tag.
|
||||||
*
|
*
|
||||||
* @throws \LogicException When the tag belongs to a different DocBlock.
|
* @throws \LogicException When the tag belongs to a different DocBlock.
|
||||||
*/
|
*/
|
||||||
public function appendTag(Tag $tag)
|
public function appendTag(Tag $tag)
|
||||||
@@ -336,7 +373,7 @@ class DocBlock implements \Reflector
|
|||||||
if (null === $tag->getDocBlock()) {
|
if (null === $tag->getDocBlock()) {
|
||||||
$tag->setDocBlock($this);
|
$tag->setDocBlock($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tag->getDocBlock() === $this) {
|
if ($tag->getDocBlock() === $this) {
|
||||||
$this->tags[] = $tag;
|
$this->tags[] = $tag;
|
||||||
} else {
|
} else {
|
||||||
@@ -348,6 +385,7 @@ class DocBlock implements \Reflector
|
|||||||
return $tag;
|
return $tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a string representation of this object.
|
* Builds a string representation of this object.
|
||||||
*
|
*
|
||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock;
|
namespace Barryvdh\Reflection\DocBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The context in which a DocBlock occurs.
|
* The context in which a DocBlock occurs.
|
||||||
+4
-6
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock;
|
namespace Barryvdh\Reflection\DocBlock;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock;
|
use Barryvdh\Reflection\DocBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a Description of a DocBlock or tag.
|
* Parses a Description of a DocBlock or tag.
|
||||||
@@ -209,14 +209,12 @@ class Description implements \Reflector
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the exported information (we should use the export static method
|
* Returns the long description as a string.
|
||||||
* BUT this throws an exception at this point).
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @codeCoverageIgnore Not yet implemented
|
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
return 'Not yet implemented';
|
return $this->getContents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock;
|
namespace Barryvdh\Reflection\DocBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The location a DocBlock occurs within a file.
|
* The location a DocBlock occurs within a file.
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* phpDocumentor
|
||||||
|
*
|
||||||
|
* PHP Version 5.3
|
||||||
|
*
|
||||||
|
* @author Barry vd. Heuvel <[email protected]>
|
||||||
|
* @copyright 2013 Mike van Riel / Naenius (http://www.naenius.com)
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||||
|
* @link http://phpdoc.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Barryvdh\Reflection\DocBlock;
|
||||||
|
|
||||||
|
use Barryvdh\Reflection\DocBlock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serializes a DocBlock instance.
|
||||||
|
*
|
||||||
|
* @author Barry vd. Heuvel <[email protected]>
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||||
|
* @link http://phpdoc.org
|
||||||
|
*/
|
||||||
|
class Serializer
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @var string The string to indent the comment with. */
|
||||||
|
protected $indentString = ' ';
|
||||||
|
|
||||||
|
/** @var int The number of times the indent string is repeated. */
|
||||||
|
protected $indent = 0;
|
||||||
|
|
||||||
|
/** @var bool Whether to indent the first line. */
|
||||||
|
protected $isFirstLineIndented = true;
|
||||||
|
|
||||||
|
/** @var int|null The max length of a line. */
|
||||||
|
protected $lineLength = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a Serializer instance.
|
||||||
|
*
|
||||||
|
* @param int $indent The number of times the indent string is
|
||||||
|
* repeated.
|
||||||
|
* @param string $indentString The string to indent the comment with.
|
||||||
|
* @param bool $indentFirstLine Whether to indent the first line.
|
||||||
|
* @param int|null $lineLength The max length of a line or NULL to
|
||||||
|
* disable line wrapping.
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
$indent = 0,
|
||||||
|
$indentString = ' ',
|
||||||
|
$indentFirstLine = true,
|
||||||
|
$lineLength = null
|
||||||
|
) {
|
||||||
|
$this->setIndentationString($indentString);
|
||||||
|
$this->setIndent($indent);
|
||||||
|
$this->setIsFirstLineIndented($indentFirstLine);
|
||||||
|
$this->setLineLength($lineLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the string to indent comments with.
|
||||||
|
*
|
||||||
|
* @param string $indentationString The string to indent comments with.
|
||||||
|
*
|
||||||
|
* @return $this This serializer object.
|
||||||
|
*/
|
||||||
|
public function setIndentationString($indentString)
|
||||||
|
{
|
||||||
|
$this->indentString = (string)$indentString;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string to indent comments with.
|
||||||
|
*
|
||||||
|
* @return string The indent string.
|
||||||
|
*/
|
||||||
|
public function getIndentationString()
|
||||||
|
{
|
||||||
|
return $this->indentString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the number of indents.
|
||||||
|
*
|
||||||
|
* @param int $indent The number of times the indent string is repeated.
|
||||||
|
*
|
||||||
|
* @return $this This serializer object.
|
||||||
|
*/
|
||||||
|
public function setIndent($indent)
|
||||||
|
{
|
||||||
|
$this->indent = (int)$indent;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the number of indents.
|
||||||
|
*
|
||||||
|
* @return int The number of times the indent string is repeated.
|
||||||
|
*/
|
||||||
|
public function getIndent()
|
||||||
|
{
|
||||||
|
return $this->indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether or not the first line should be indented.
|
||||||
|
*
|
||||||
|
* Sets whether or not the first line (the one with the "/**") should be
|
||||||
|
* indented.
|
||||||
|
*
|
||||||
|
* @param bool $indentFirstLine The new value for this setting.
|
||||||
|
*
|
||||||
|
* @return $this This serializer object.
|
||||||
|
*/
|
||||||
|
public function setIsFirstLineIndented($indentFirstLine)
|
||||||
|
{
|
||||||
|
$this->isFirstLineIndented = (bool)$indentFirstLine;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether or not the first line should be indented.
|
||||||
|
*
|
||||||
|
* @return bool Whether or not the first line should be indented.
|
||||||
|
*/
|
||||||
|
public function isFirstLineIndented()
|
||||||
|
{
|
||||||
|
return $this->isFirstLineIndented;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the line length.
|
||||||
|
*
|
||||||
|
* Sets the length of each line in the serialization. Content will be
|
||||||
|
* wrapped within this limit.
|
||||||
|
*
|
||||||
|
* @param int|null $lineLength The length of each line. NULL to disable line
|
||||||
|
* wrapping altogether.
|
||||||
|
*
|
||||||
|
* @return $this This serializer object.
|
||||||
|
*/
|
||||||
|
public function setLineLength($lineLength)
|
||||||
|
{
|
||||||
|
$this->lineLength = null === $lineLength ? null : (int)$lineLength;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the line length.
|
||||||
|
*
|
||||||
|
* @return int|null The length of each line or NULL if line wrapping is
|
||||||
|
* disabled.
|
||||||
|
*/
|
||||||
|
public function getLineLength()
|
||||||
|
{
|
||||||
|
return $this->lineLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a DocBlock comment.
|
||||||
|
*
|
||||||
|
* @param DocBlock The DocBlock to serialize.
|
||||||
|
*
|
||||||
|
* @return string The serialized doc block.
|
||||||
|
*/
|
||||||
|
public function getDocComment(DocBlock $docblock)
|
||||||
|
{
|
||||||
|
$indent = str_repeat($this->indentString, $this->indent);
|
||||||
|
$firstIndent = $this->isFirstLineIndented ? $indent : '';
|
||||||
|
|
||||||
|
$text = $docblock->getText();
|
||||||
|
if ($this->lineLength) {
|
||||||
|
//3 === strlen(' * ')
|
||||||
|
$wrapLength = $this->lineLength - strlen($indent) - 3;
|
||||||
|
$text = wordwrap($text, $wrapLength);
|
||||||
|
}
|
||||||
|
$text = str_replace("\n", "\n{$indent} * ", $text);
|
||||||
|
|
||||||
|
$comment = "{$firstIndent}/**\n{$indent} * {$text}\n{$indent} *\n";
|
||||||
|
|
||||||
|
/** @var Tag $tag */
|
||||||
|
foreach ($docblock->getTags() as $tag) {
|
||||||
|
$tagText = (string) $tag;
|
||||||
|
if ($this->lineLength) {
|
||||||
|
$tagText = wordwrap($tagText, $wrapLength);
|
||||||
|
}
|
||||||
|
$tagText = str_replace("\n", "\n{$indent} * ", $tagText);
|
||||||
|
|
||||||
|
$comment .= "{$indent} * {$tagText}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$comment .= $indent . ' */';
|
||||||
|
|
||||||
|
return $comment;
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
-25
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock;
|
namespace Barryvdh\Reflection\DocBlock;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock;
|
use Barryvdh\Reflection\DocBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a tag definition for a DocBlock.
|
* Parses a tag definition for a DocBlock.
|
||||||
@@ -59,43 +59,43 @@ class Tag implements \Reflector
|
|||||||
*/
|
*/
|
||||||
private static $tagHandlerMappings = array(
|
private static $tagHandlerMappings = array(
|
||||||
'author'
|
'author'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\AuthorTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\AuthorTag',
|
||||||
'covers'
|
'covers'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\CoversTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\CoversTag',
|
||||||
'deprecated'
|
'deprecated'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\DeprecatedTag',
|
||||||
'example'
|
'example'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\ExampleTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\ExampleTag',
|
||||||
'link'
|
'link'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\LinkTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\LinkTag',
|
||||||
'method'
|
'method'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\MethodTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\MethodTag',
|
||||||
'param'
|
'param'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\ParamTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\ParamTag',
|
||||||
'property-read'
|
'property-read'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyReadTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\PropertyReadTag',
|
||||||
'property'
|
'property'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\PropertyTag',
|
||||||
'property-write'
|
'property-write'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyWriteTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\PropertyWriteTag',
|
||||||
'return'
|
'return'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\ReturnTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\ReturnTag',
|
||||||
'see'
|
'see'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\SeeTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\SeeTag',
|
||||||
'since'
|
'since'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\SinceTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\SinceTag',
|
||||||
'source'
|
'source'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\SourceTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\SourceTag',
|
||||||
'throw'
|
'throw'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\ThrowsTag',
|
||||||
'throws'
|
'throws'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\ThrowsTag',
|
||||||
'uses'
|
'uses'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\UsesTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\UsesTag',
|
||||||
'var'
|
'var'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\VarTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\VarTag',
|
||||||
'version'
|
'version'
|
||||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\VersionTag'
|
=> '\Barryvdh\Reflection\DocBlock\Tag\VersionTag'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -366,14 +366,12 @@ class Tag implements \Reflector
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the exported information (we should use the export static method
|
* Returns the tag as a serialized string
|
||||||
* BUT this throws an exception at this point).
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @codeCoverageIgnore Not yet implemented
|
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
return 'Not yet implemented';
|
return "@{$this->getName()} {$this->getContent()}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for an @author tag in a Docblock.
|
* Reflection class for an @author tag in a Docblock.
|
||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @covers tag in a Docblock.
|
* Reflection class for a @covers tag in a Docblock.
|
||||||
+2
-2
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag\VersionTag;
|
use Barryvdh\Reflection\DocBlock\Tag\VersionTag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @deprecated tag in a Docblock.
|
* Reflection class for a @deprecated tag in a Docblock.
|
||||||
+2
-2
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @example tag in a Docblock.
|
* Reflection class for a @example tag in a Docblock.
|
||||||
+2
-2
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @link tag in a Docblock.
|
* Reflection class for a @link tag in a Docblock.
|
||||||
+59
-10
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @method in a Docblock.
|
* Reflection class for a @method in a Docblock.
|
||||||
@@ -29,6 +29,9 @@ class MethodTag extends ReturnTag
|
|||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $arguments = '';
|
protected $arguments = '';
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
protected $isStatic = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
@@ -36,12 +39,16 @@ class MethodTag extends ReturnTag
|
|||||||
public function getContent()
|
public function getContent()
|
||||||
{
|
{
|
||||||
if (null === $this->content) {
|
if (null === $this->content) {
|
||||||
$this->content = $this->type .
|
$this->content = '';
|
||||||
|
if ($this->isStatic) {
|
||||||
|
$this->content .= 'static ';
|
||||||
|
}
|
||||||
|
$this->content .= $this->type .
|
||||||
" {$this->method_name}({$this->arguments}) " .
|
" {$this->method_name}({$this->arguments}) " .
|
||||||
$this->description;
|
$this->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,15 +58,22 @@ class MethodTag extends ReturnTag
|
|||||||
{
|
{
|
||||||
Tag::setContent($content);
|
Tag::setContent($content);
|
||||||
// 1. none or more whitespace
|
// 1. none or more whitespace
|
||||||
// 2. optionally a word with underscores followed by whitespace : as
|
// 2. optionally the keyword "static" followed by whitespace
|
||||||
|
// 3. optionally a word with underscores followed by whitespace : as
|
||||||
// type for the return value
|
// type for the return value
|
||||||
// 3. then optionally a word with underscores followed by () and
|
// 4. then optionally a word with underscores followed by () and
|
||||||
// whitespace : as method name as used by phpDocumentor
|
// whitespace : as method name as used by phpDocumentor
|
||||||
// 4. then a word with underscores, followed by ( and any character
|
// 5. then a word with underscores, followed by ( and any character
|
||||||
// until a ) and whitespace : as method name with signature
|
// until a ) and whitespace : as method name with signature
|
||||||
// 5. any remaining text : as description
|
// 6. any remaining text : as description
|
||||||
if (preg_match(
|
if (preg_match(
|
||||||
'/^
|
'/^
|
||||||
|
# Static keyword
|
||||||
|
# Declates a static method ONLY if type is also present
|
||||||
|
(?:
|
||||||
|
(static)
|
||||||
|
\s+
|
||||||
|
)?
|
||||||
# Return type
|
# Return type
|
||||||
(?:
|
(?:
|
||||||
([\w\|_\\\\]+)
|
([\w\|_\\\\]+)
|
||||||
@@ -82,13 +96,22 @@ class MethodTag extends ReturnTag
|
|||||||
)) {
|
)) {
|
||||||
list(
|
list(
|
||||||
,
|
,
|
||||||
|
$static,
|
||||||
$this->type,
|
$this->type,
|
||||||
$this->method_name,
|
$this->method_name,
|
||||||
$this->arguments,
|
$this->arguments,
|
||||||
$this->description
|
$this->description
|
||||||
) = $matches;
|
) = $matches;
|
||||||
if (!$this->type) {
|
if ($static) {
|
||||||
$this->type = 'void';
|
if (!$this->type) {
|
||||||
|
$this->type = 'static';
|
||||||
|
} else {
|
||||||
|
$this->isStatic = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!$this->type) {
|
||||||
|
$this->type = 'void';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->parsedDescription = null;
|
$this->parsedDescription = null;
|
||||||
} else {
|
} else {
|
||||||
@@ -160,4 +183,30 @@ class MethodTag extends ReturnTag
|
|||||||
|
|
||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the method tag describes a static method or not.
|
||||||
|
*
|
||||||
|
* @return bool TRUE if the method declaration is for a static method, FALSE
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
public function isStatic()
|
||||||
|
{
|
||||||
|
return $this->isStatic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a new value for whether the method is static or not.
|
||||||
|
*
|
||||||
|
* @param bool $isStatic The new value to set.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setIsStatic($isStatic)
|
||||||
|
{
|
||||||
|
$this->isStatic = $isStatic;
|
||||||
|
|
||||||
|
$this->content = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @param tag in a Docblock.
|
* Reflection class for a @param tag in a Docblock.
|
||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @property-read tag in a Docblock.
|
* Reflection class for a @property-read tag in a Docblock.
|
||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @property tag in a Docblock.
|
* Reflection class for a @property tag in a Docblock.
|
||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @property-write tag in a Docblock.
|
* Reflection class for a @property-write tag in a Docblock.
|
||||||
+36
-6
@@ -10,10 +10,10 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
use phpDocumentor\Reflection\DocBlock\Type\Collection;
|
use Barryvdh\Reflection\DocBlock\Type\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @return tag in a Docblock.
|
* Reflection class for a @return tag in a Docblock.
|
||||||
@@ -33,13 +33,13 @@ class ReturnTag extends Tag
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getCotnent()
|
public function getContent()
|
||||||
{
|
{
|
||||||
if (null === $this->content) {
|
if (null === $this->content) {
|
||||||
$this->content = "{$this->type} {$this->description}";
|
$this->content = "{$this->getType()} {$this->description}";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->cotnent;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,6 +53,7 @@ class ReturnTag extends Tag
|
|||||||
|
|
||||||
// any output is considered a type
|
// any output is considered a type
|
||||||
$this->type = $parts[0];
|
$this->type = $parts[0];
|
||||||
|
$this->types = null;
|
||||||
|
|
||||||
$this->setDescription(isset($parts[1]) ? $parts[1] : '');
|
$this->setDescription(isset($parts[1]) ? $parts[1] : '');
|
||||||
|
|
||||||
@@ -80,6 +81,35 @@ class ReturnTag extends Tag
|
|||||||
return (string) $this->getTypesCollection();
|
return (string) $this->getTypesCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the type section of the variable
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setType($type)
|
||||||
|
{
|
||||||
|
$this->type = $type;
|
||||||
|
$this->types = null;
|
||||||
|
$this->content = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a type to the type section of the variable
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function addType($type)
|
||||||
|
{
|
||||||
|
$this->type = $this->type . Collection::OPERATOR_OR . $type;
|
||||||
|
$this->types = null;
|
||||||
|
$this->content = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type collection.
|
* Returns the type collection.
|
||||||
*
|
*
|
||||||
+2
-2
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @see tag in a Docblock.
|
* Reflection class for a @see tag in a Docblock.
|
||||||
+2
-2
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag\VersionTag;
|
use Barryvdh\Reflection\DocBlock\Tag\VersionTag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @since tag in a Docblock.
|
* Reflection class for a @since tag in a Docblock.
|
||||||
+2
-2
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @source tag in a Docblock.
|
* Reflection class for a @source tag in a Docblock.
|
||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @throws tag in a Docblock.
|
* Reflection class for a @throws tag in a Docblock.
|
||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @uses tag in a Docblock.
|
* Reflection class for a @uses tag in a Docblock.
|
||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @var tag in a Docblock.
|
* Reflection class for a @var tag in a Docblock.
|
||||||
+2
-2
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
namespace Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @version tag in a Docblock.
|
* Reflection class for a @version tag in a Docblock.
|
||||||
+19
-2
@@ -10,9 +10,9 @@
|
|||||||
* @link http://phpdoc.org
|
* @link http://phpdoc.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Type;
|
namespace Barryvdh\Reflection\DocBlock\Type;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Context;
|
use Barryvdh\Reflection\DocBlock\Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collection
|
* Collection
|
||||||
@@ -156,6 +156,11 @@ class Collection extends \ArrayObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isRelativeType($type) && !$this->isTypeAKeyword($type)) {
|
if ($this->isRelativeType($type) && !$this->isTypeAKeyword($type)) {
|
||||||
|
|
||||||
|
if($this->shouldBeAbsolute($type)){
|
||||||
|
return self::OPERATOR_NAMESPACE . $type;
|
||||||
|
}
|
||||||
|
|
||||||
$type_parts = explode(self::OPERATOR_NAMESPACE, $type, 2);
|
$type_parts = explode(self::OPERATOR_NAMESPACE, $type, 2);
|
||||||
|
|
||||||
$namespace_aliases = $this->context->getNamespaceAliases();
|
$namespace_aliases = $this->context->getNamespaceAliases();
|
||||||
@@ -218,4 +223,16 @@ class Collection extends \ArrayObject
|
|||||||
return ($type[0] !== self::OPERATOR_NAMESPACE)
|
return ($type[0] !== self::OPERATOR_NAMESPACE)
|
||||||
|| $this->isTypeAKeyword($type);
|
|| $this->isTypeAKeyword($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detects if the type should actually be absolute, by checking if it exists.
|
||||||
|
*
|
||||||
|
* @param string $type A relative or absolute type as defined in the
|
||||||
|
* phpDocumentor documentation.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function shouldBeAbsolute($type){
|
||||||
|
return class_exists($type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -44,6 +44,7 @@ class MethodTagTest extends \PHPUnit_Framework_TestCase
|
|||||||
$valid,
|
$valid,
|
||||||
$expected_name,
|
$expected_name,
|
||||||
$expected_return,
|
$expected_return,
|
||||||
|
$expected_isStatic,
|
||||||
$paramCount,
|
$paramCount,
|
||||||
$description
|
$description
|
||||||
) {
|
) {
|
||||||
@@ -64,6 +65,7 @@ class MethodTagTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals($expected_name, $tag->getMethodName());
|
$this->assertEquals($expected_name, $tag->getMethodName());
|
||||||
$this->assertEquals($expected_return, $tag->getType());
|
$this->assertEquals($expected_return, $tag->getType());
|
||||||
$this->assertEquals($description, $tag->getDescription());
|
$this->assertEquals($description, $tag->getDescription());
|
||||||
|
$this->assertEquals($expected_isStatic, $tag->isStatic());
|
||||||
$this->assertCount($paramCount, $tag->getArguments());
|
$this->assertCount($paramCount, $tag->getArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,56 +74,72 @@ class MethodTagTest extends \PHPUnit_Framework_TestCase
|
|||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
'foo',
|
'foo',
|
||||||
false, 'foo', '', 0, ''
|
false, 'foo', '', false, 0, ''
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'foo()',
|
'foo()',
|
||||||
true, 'foo', 'void', 0, ''
|
true, 'foo', 'void', false, 0, ''
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'foo() description',
|
'foo() description',
|
||||||
true, 'foo', 'void', 0, 'description'
|
true, 'foo', 'void', false, 0, 'description'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'int foo()',
|
'int foo()',
|
||||||
true, 'foo', 'int', 0, ''
|
true, 'foo', 'int', false, 0, ''
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'int foo() description',
|
'int foo() description',
|
||||||
true, 'foo', 'int', 0, 'description'
|
true, 'foo', 'int', false, 0, 'description'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'int foo($a, $b)',
|
'int foo($a, $b)',
|
||||||
true, 'foo', 'int', 2, ''
|
true, 'foo', 'int', false, 2, ''
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'int foo() foo(int $a, int $b)',
|
'int foo() foo(int $a, int $b)',
|
||||||
true, 'foo', 'int', 2, ''
|
true, 'foo', 'int', false, 2, ''
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'int foo(int $a, int $b)',
|
'int foo(int $a, int $b)',
|
||||||
true, 'foo', 'int', 2, ''
|
true, 'foo', 'int', false, 2, ''
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'null|int foo(int $a, int $b)',
|
'null|int foo(int $a, int $b)',
|
||||||
true, 'foo', 'null|int', 2, ''
|
true, 'foo', 'null|int', false, 2, ''
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'int foo(null|int $a, int $b)',
|
'int foo(null|int $a, int $b)',
|
||||||
true, 'foo', 'int', 2, ''
|
true, 'foo', 'int', false, 2, ''
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'\Exception foo() foo(Exception $a, Exception $b)',
|
'\Exception foo() foo(Exception $a, Exception $b)',
|
||||||
true, 'foo', '\Exception', 2, ''
|
true, 'foo', '\Exception', false, 2, ''
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'int foo() foo(Exception $a, Exception $b) description',
|
'int foo() foo(Exception $a, Exception $b) description',
|
||||||
true, 'foo', 'int', 2, 'description'
|
true, 'foo', 'int', false, 2, 'description'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'int foo() foo(\Exception $a, \Exception $b) description',
|
'int foo() foo(\Exception $a, \Exception $b) description',
|
||||||
true, 'foo', 'int', 2, 'description'
|
true, 'foo', 'int', false, 2, 'description'
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'void()',
|
||||||
|
true, 'void', 'void', false, 0, ''
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'static foo()',
|
||||||
|
true, 'foo', 'static', false, 0, ''
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'static void foo()',
|
||||||
|
true, 'foo', 'void', true, 0, ''
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'static static foo()',
|
||||||
|
true, 'foo', 'static', true, 0, ''
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ class DocBlockTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$fixture = <<<DOCBLOCK
|
$fixture = <<<DOCBLOCK
|
||||||
/**
|
/**
|
||||||
* This is a short description.
|
* This is a short description
|
||||||
*
|
*
|
||||||
* This is a long description.
|
* This is a long description
|
||||||
*
|
*
|
||||||
* @see \MyClass
|
* @see \MyClass
|
||||||
* @return void
|
* @return void
|
||||||
@@ -48,11 +48,11 @@ DOCBLOCK;
|
|||||||
new Location(2)
|
new Location(2)
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'This is a short description.',
|
'This is a short description',
|
||||||
$object->getShortDescription()
|
$object->getShortDescription()
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'This is a long description.',
|
'This is a long description',
|
||||||
$object->getLongDescription()->getContents()
|
$object->getLongDescription()->getContents()
|
||||||
);
|
);
|
||||||
$this->assertCount(2, $object->getTags());
|
$this->assertCount(2, $object->getTags());
|
||||||
@@ -142,7 +142,8 @@ DOCBLOCK;
|
|||||||
{
|
{
|
||||||
$fixture = <<<DOCBLOCK
|
$fixture = <<<DOCBLOCK
|
||||||
/**
|
/**
|
||||||
* This is a short description. This is a long description.
|
* This is a short description.
|
||||||
|
* This is a long description.
|
||||||
* This is a continuation of the long description.
|
* This is a continuation of the long description.
|
||||||
*/
|
*/
|
||||||
DOCBLOCK;
|
DOCBLOCK;
|
||||||
|
|||||||
Reference in New Issue
Block a user