mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
apply coding standard to code
This commit is contained in:
@@ -112,7 +112,7 @@ class DescriptionFactory
|
|||||||
{
|
{
|
||||||
$count = count($tokens);
|
$count = count($tokens);
|
||||||
$tagCount = 0;
|
$tagCount = 0;
|
||||||
$tags = [];
|
$tags = [];
|
||||||
|
|
||||||
for ($i = 1; $i < $count; $i += 2) {
|
for ($i = 1; $i < $count; $i += 2) {
|
||||||
$tags[] = $this->tagFactory->create($tokens[$i], $context);
|
$tags[] = $this->tagFactory->create($tokens[$i], $context);
|
||||||
@@ -156,7 +156,7 @@ class DescriptionFactory
|
|||||||
|
|
||||||
// determine how many whitespace characters need to be stripped
|
// determine how many whitespace characters need to be stripped
|
||||||
$startingSpaceCount = 9999999;
|
$startingSpaceCount = 9999999;
|
||||||
for ($i = 1; $i < count($lines); $i++) {
|
for ($i = 1; $i < count($lines); ++$i) {
|
||||||
// lines with a no length do not count as they are not indented at all
|
// lines with a no length do not count as they are not indented at all
|
||||||
if (strlen(trim($lines[$i])) === 0) {
|
if (strlen(trim($lines[$i])) === 0) {
|
||||||
continue;
|
continue;
|
||||||
@@ -169,7 +169,7 @@ class DescriptionFactory
|
|||||||
|
|
||||||
// strip the number of spaces from each line
|
// strip the number of spaces from each line
|
||||||
if ($startingSpaceCount > 0) {
|
if ($startingSpaceCount > 0) {
|
||||||
for ($i = 1; $i < count($lines); $i++) {
|
for ($i = 1; $i < count($lines); ++$i) {
|
||||||
$lines[$i] = substr($lines[$i], $startingSpaceCount);
|
$lines[$i] = substr($lines[$i], $startingSpaceCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class Serializer
|
|||||||
|
|
||||||
private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength): string
|
private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength): string
|
||||||
{
|
{
|
||||||
$text = $docblock->getSummary() . ((string)$docblock->getDescription() ? "\n\n" . $docblock->getDescription()
|
$text = $docblock->getSummary() . ((string) $docblock->getDescription() ? "\n\n" . $docblock->getDescription()
|
||||||
: '');
|
: '');
|
||||||
if ($wrapLength !== null) {
|
if ($wrapLength !== null) {
|
||||||
$text = wordwrap($text, $wrapLength);
|
$text = wordwrap($text, $wrapLength);
|
||||||
|
|||||||
@@ -45,25 +45,25 @@ final class StandardTagFactory implements TagFactory
|
|||||||
* @var string[] An array with a tag as a key, and an FQCN to a class that handles it as an array value.
|
* @var string[] An array with a tag as a key, and an FQCN to a class that handles it as an array value.
|
||||||
*/
|
*/
|
||||||
private $tagHandlerMappings = [
|
private $tagHandlerMappings = [
|
||||||
'author' => '\phpDocumentor\Reflection\DocBlock\Tags\Author',
|
'author' => '\phpDocumentor\Reflection\DocBlock\Tags\Author',
|
||||||
'covers' => '\phpDocumentor\Reflection\DocBlock\Tags\Covers',
|
'covers' => '\phpDocumentor\Reflection\DocBlock\Tags\Covers',
|
||||||
'deprecated' => '\phpDocumentor\Reflection\DocBlock\Tags\Deprecated',
|
'deprecated' => '\phpDocumentor\Reflection\DocBlock\Tags\Deprecated',
|
||||||
// 'example' => '\phpDocumentor\Reflection\DocBlock\Tags\Example',
|
// 'example' => '\phpDocumentor\Reflection\DocBlock\Tags\Example',
|
||||||
'link' => '\phpDocumentor\Reflection\DocBlock\Tags\Link',
|
'link' => '\phpDocumentor\Reflection\DocBlock\Tags\Link',
|
||||||
'method' => '\phpDocumentor\Reflection\DocBlock\Tags\Method',
|
'method' => '\phpDocumentor\Reflection\DocBlock\Tags\Method',
|
||||||
'param' => '\phpDocumentor\Reflection\DocBlock\Tags\Param',
|
'param' => '\phpDocumentor\Reflection\DocBlock\Tags\Param',
|
||||||
'property-read' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead',
|
'property-read' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead',
|
||||||
'property' => '\phpDocumentor\Reflection\DocBlock\Tags\Property',
|
'property' => '\phpDocumentor\Reflection\DocBlock\Tags\Property',
|
||||||
'property-write' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite',
|
'property-write' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite',
|
||||||
'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_',
|
'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_',
|
||||||
'see' => '\phpDocumentor\Reflection\DocBlock\Tags\See',
|
'see' => '\phpDocumentor\Reflection\DocBlock\Tags\See',
|
||||||
'since' => '\phpDocumentor\Reflection\DocBlock\Tags\Since',
|
'since' => '\phpDocumentor\Reflection\DocBlock\Tags\Since',
|
||||||
'source' => '\phpDocumentor\Reflection\DocBlock\Tags\Source',
|
'source' => '\phpDocumentor\Reflection\DocBlock\Tags\Source',
|
||||||
'throw' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws',
|
'throw' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws',
|
||||||
'throws' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws',
|
'throws' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws',
|
||||||
'uses' => '\phpDocumentor\Reflection\DocBlock\Tags\Uses',
|
'uses' => '\phpDocumentor\Reflection\DocBlock\Tags\Uses',
|
||||||
'var' => '\phpDocumentor\Reflection\DocBlock\Tags\Var_',
|
'var' => '\phpDocumentor\Reflection\DocBlock\Tags\Var_',
|
||||||
'version' => '\phpDocumentor\Reflection\DocBlock\Tags\Version'
|
'version' => '\phpDocumentor\Reflection\DocBlock\Tags\Version',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,7 +186,7 @@ final class StandardTagFactory implements TagFactory
|
|||||||
private function createTag(string $body, string $name, TypeContext $context): ?Tag
|
private function createTag(string $body, string $name, TypeContext $context): ?Tag
|
||||||
{
|
{
|
||||||
$handlerClassName = $this->findHandlerClassName($name, $context);
|
$handlerClassName = $this->findHandlerClassName($name, $context);
|
||||||
$arguments = $this->getArgumentsForParametersFromWiring(
|
$arguments = $this->getArgumentsForParametersFromWiring(
|
||||||
$this->fetchParametersForHandlerFactoryMethod($handlerClassName),
|
$this->fetchParametersForHandlerFactoryMethod($handlerClassName),
|
||||||
$this->getServiceLocatorWithDynamicParameters($context, $name, $body)
|
$this->getServiceLocatorWithDynamicParameters($context, $name, $body)
|
||||||
);
|
);
|
||||||
@@ -254,7 +254,7 @@ final class StandardTagFactory implements TagFactory
|
|||||||
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName)
|
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName)
|
||||||
{
|
{
|
||||||
if (! isset($this->tagHandlerParameterCache[$handlerClassName])) {
|
if (! isset($this->tagHandlerParameterCache[$handlerClassName])) {
|
||||||
$methodReflection = new \ReflectionMethod($handlerClassName, 'create');
|
$methodReflection = new \ReflectionMethod($handlerClassName, 'create');
|
||||||
$this->tagHandlerParameterCache[$handlerClassName] = $methodReflection->getParameters();
|
$this->tagHandlerParameterCache[$handlerClassName] = $methodReflection->getParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,9 +276,9 @@ final class StandardTagFactory implements TagFactory
|
|||||||
$locator = array_merge(
|
$locator = array_merge(
|
||||||
$this->serviceLocator,
|
$this->serviceLocator,
|
||||||
[
|
[
|
||||||
'name' => $tagName,
|
'name' => $tagName,
|
||||||
'body' => $tagBody,
|
'body' => $tagBody,
|
||||||
TypeContext::class => $context
|
TypeContext::class => $context,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ final class Author extends BaseTag implements Factory\StaticMethod
|
|||||||
throw new \InvalidArgumentException('The author tag does not have a valid e-mail address');
|
throw new \InvalidArgumentException('The author tag does not have a valid e-mail address');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->authorName = $authorName;
|
$this->authorName = $authorName;
|
||||||
$this->authorEmail = $authorEmail;
|
$this->authorEmail = $authorEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ final class Example extends BaseTag
|
|||||||
if ($this->isURI) {
|
if ($this->isURI) {
|
||||||
$filePath = $this->isUriRelative($this->filePath)
|
$filePath = $this->isUriRelative($this->filePath)
|
||||||
? str_replace('%2F', '/', rawurlencode($this->filePath))
|
? str_replace('%2F', '/', rawurlencode($this->filePath))
|
||||||
:$this->filePath;
|
: $this->filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return trim($filePath . ' ' . parent::getDescription());
|
return trim($filePath . ' ' . parent::getDescription());
|
||||||
@@ -89,7 +89,7 @@ final class Example extends BaseTag
|
|||||||
}
|
}
|
||||||
|
|
||||||
$filePath = null;
|
$filePath = null;
|
||||||
$fileUri = null;
|
$fileUri = null;
|
||||||
if ('' !== $matches[1]) {
|
if ('' !== $matches[1]) {
|
||||||
$filePath = $matches[1];
|
$filePath = $matches[1];
|
||||||
} else {
|
} else {
|
||||||
@@ -97,17 +97,17 @@ final class Example extends BaseTag
|
|||||||
}
|
}
|
||||||
|
|
||||||
$startingLine = 1;
|
$startingLine = 1;
|
||||||
$lineCount = null;
|
$lineCount = null;
|
||||||
$description = null;
|
$description = null;
|
||||||
|
|
||||||
if (array_key_exists(3, $matches)) {
|
if (array_key_exists(3, $matches)) {
|
||||||
$description = $matches[3];
|
$description = $matches[3];
|
||||||
|
|
||||||
// Starting line / Number of lines / Description
|
// Starting line / Number of lines / Description
|
||||||
if (preg_match('/^([1-9]\d*)(?:\s+((?1))\s*)?(.*)$/sux', $matches[3], $contentMatches)) {
|
if (preg_match('/^([1-9]\d*)(?:\s+((?1))\s*)?(.*)$/sux', $matches[3], $contentMatches)) {
|
||||||
$startingLine = (int)$contentMatches[1];
|
$startingLine = (int) $contentMatches[1];
|
||||||
if (isset($contentMatches[2]) && $contentMatches[2] !== '') {
|
if (isset($contentMatches[2]) && $contentMatches[2] !== '') {
|
||||||
$lineCount = (int)$contentMatches[2];
|
$lineCount = (int) $contentMatches[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists(3, $contentMatches)) {
|
if (array_key_exists(3, $contentMatches)) {
|
||||||
@@ -117,7 +117,7 @@ final class Example extends BaseTag
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new static(
|
return new static(
|
||||||
$filePath !== null?$filePath:$fileUri,
|
$filePath !== null ? $filePath : $fileUri,
|
||||||
$fileUri !== null,
|
$fileUri !== null,
|
||||||
$startingLine,
|
$startingLine,
|
||||||
$lineCount,
|
$lineCount,
|
||||||
|
|||||||
@@ -39,6 +39,6 @@ class AlignFormatter implements Formatter
|
|||||||
*/
|
*/
|
||||||
public function format(Tag $tag): string
|
public function format(Tag $tag): string
|
||||||
{
|
{
|
||||||
return '@' . $tag->getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string)$tag;
|
return '@' . $tag->getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string) $tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ class PassthroughFormatter implements Formatter
|
|||||||
*/
|
*/
|
||||||
public function format(Tag $tag): string
|
public function format(Tag $tag): string
|
||||||
{
|
{
|
||||||
return trim('@' . $tag->getName() . ' ' . (string)$tag);
|
return trim('@' . $tag->getName() . ' ' . (string) $tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ final class Link extends BaseTag implements Factory\StaticMethod
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): Link
|
public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self
|
||||||
{
|
{
|
||||||
Assert::notNull($descriptionFactory);
|
Assert::notNull($descriptionFactory);
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
|||||||
$returnType = new Void_();
|
$returnType = new Void_();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->methodName = $methodName;
|
$this->methodName = $methodName;
|
||||||
$this->arguments = $this->filterArguments($arguments);
|
$this->arguments = $this->filterArguments($arguments);
|
||||||
$this->returnType = $returnType;
|
$this->returnType = $returnType;
|
||||||
$this->isStatic = $static;
|
$this->isStatic = $static;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
|||||||
?TypeContext $context = null
|
?TypeContext $context = null
|
||||||
): ?self {
|
): ?self {
|
||||||
Assert::stringNotEmpty($body);
|
Assert::stringNotEmpty($body);
|
||||||
Assert::allNotNull([ $typeResolver, $descriptionFactory ]);
|
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||||
|
|
||||||
// 1. none or more whitespace
|
// 1. none or more whitespace
|
||||||
// 2. optionally the keyword "static" followed by whitespace
|
// 2. optionally the keyword "static" followed by whitespace
|
||||||
@@ -131,7 +131,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
|||||||
$returnType = 'void';
|
$returnType = 'void';
|
||||||
}
|
}
|
||||||
|
|
||||||
$returnType = $typeResolver->resolve($returnType, $context);
|
$returnType = $typeResolver->resolve($returnType, $context);
|
||||||
$description = $descriptionFactory->create($description, $context);
|
$description = $descriptionFactory->create($description, $context);
|
||||||
|
|
||||||
if (is_string($arguments) && strlen($arguments) > 0) {
|
if (is_string($arguments) && strlen($arguments) > 0) {
|
||||||
@@ -150,7 +150,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$argument = [ 'name' => $argumentName, 'type' => $argumentType];
|
$argument = ['name' => $argumentName, 'type' => $argumentType];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$arguments = [];
|
$arguments = [];
|
||||||
@@ -198,7 +198,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
|||||||
}
|
}
|
||||||
|
|
||||||
return trim(($this->isStatic() ? 'static ' : '')
|
return trim(($this->isStatic() ? 'static ' : '')
|
||||||
. (string)$this->returnType . ' '
|
. (string) $this->returnType . ' '
|
||||||
. $this->methodName
|
. $this->methodName
|
||||||
. '(' . implode(', ', $arguments) . ')'
|
. '(' . implode(', ', $arguments) . ')'
|
||||||
. ($this->description ? ' ' . $this->description->render() : ''));
|
. ($this->description ? ' ' . $this->description->render() : ''));
|
||||||
@@ -208,7 +208,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
|||||||
{
|
{
|
||||||
foreach ($arguments as &$argument) {
|
foreach ($arguments as &$argument) {
|
||||||
if (is_string($argument)) {
|
if (is_string($argument)) {
|
||||||
$argument = [ 'name' => $argument ];
|
$argument = ['name' => $argument];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isset($argument['type'])) {
|
if (! isset($argument['type'])) {
|
||||||
@@ -217,7 +217,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
|||||||
|
|
||||||
$keys = array_keys($argument);
|
$keys = array_keys($argument);
|
||||||
sort($keys);
|
sort($keys);
|
||||||
if ($keys !== [ 'name', 'type' ]) {
|
if ($keys !== ['name', 'type']) {
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException(
|
||||||
'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true)
|
'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -38,6 +38,6 @@ final class Fqsen implements Reference
|
|||||||
*/
|
*/
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
return (string)$this->fqsen;
|
return (string) $this->fqsen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class See extends BaseTag implements Factory\StaticMethod
|
|||||||
) {
|
) {
|
||||||
Assert::allNotNull([$resolver, $descriptionFactory]);
|
Assert::allNotNull([$resolver, $descriptionFactory]);
|
||||||
|
|
||||||
$parts = preg_split('/\s+/Su', $body, 2);
|
$parts = preg_split('/\s+/Su', $body, 2);
|
||||||
$description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null;
|
$description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null;
|
||||||
|
|
||||||
// https://tools.ietf.org/html/rfc2396#section-3
|
// https://tools.ietf.org/html/rfc2396#section-3
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ final class Since extends BaseTag implements Factory\StaticMethod
|
|||||||
{
|
{
|
||||||
Assert::nullOrStringNotEmpty($version);
|
Assert::nullOrStringNotEmpty($version);
|
||||||
|
|
||||||
$this->version = $version;
|
$this->version = $version;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ final class Source extends BaseTag implements Factory\StaticMethod
|
|||||||
Assert::integerish($startingLine);
|
Assert::integerish($startingLine);
|
||||||
Assert::nullOrIntegerish($lineCount);
|
Assert::nullOrIntegerish($lineCount);
|
||||||
|
|
||||||
$this->startingLine = (int)$startingLine;
|
$this->startingLine = (int) $startingLine;
|
||||||
$this->lineCount = $lineCount !== null ? (int)$lineCount : null;
|
$this->lineCount = $lineCount !== null ? (int) $lineCount : null;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,14 +54,14 @@ final class Source extends BaseTag implements Factory\StaticMethod
|
|||||||
Assert::notNull($descriptionFactory);
|
Assert::notNull($descriptionFactory);
|
||||||
|
|
||||||
$startingLine = 1;
|
$startingLine = 1;
|
||||||
$lineCount = null;
|
$lineCount = null;
|
||||||
$description = null;
|
$description = null;
|
||||||
|
|
||||||
// Starting line / Number of lines / Description
|
// Starting line / Number of lines / Description
|
||||||
if (preg_match('/^([1-9]\d*)\s*(?:((?1))\s+)?(.*)$/sux', $body, $matches)) {
|
if (preg_match('/^([1-9]\d*)\s*(?:((?1))\s+)?(.*)$/sux', $body, $matches)) {
|
||||||
$startingLine = (int)$matches[1];
|
$startingLine = (int) $matches[1];
|
||||||
if (isset($matches[2]) && $matches[2] !== '') {
|
if (isset($matches[2]) && $matches[2] !== '') {
|
||||||
$lineCount = (int)$matches[2];
|
$lineCount = (int) $matches[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
$description = $matches[3];
|
$description = $matches[3];
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ final class Throws extends BaseTag implements Factory\StaticMethod
|
|||||||
|
|
||||||
public function __construct(Type $type, ?Description $description = null)
|
public function __construct(Type $type, ?Description $description = null)
|
||||||
{
|
{
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ final class Throws extends BaseTag implements Factory\StaticMethod
|
|||||||
|
|
||||||
$parts = preg_split('/\s+/Su', $body, 2);
|
$parts = preg_split('/\s+/Su', $body, 2);
|
||||||
|
|
||||||
$type = $typeResolver->resolve($parts[0] ?? '', $context);
|
$type = $typeResolver->resolve($parts[0] ?? '', $context);
|
||||||
$description = $descriptionFactory->create($parts[1] ?? '', $context);
|
$description = $descriptionFactory->create($parts[1] ?? '', $context);
|
||||||
|
|
||||||
return new static($type, $description);
|
return new static($type, $description);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ final class Uses extends BaseTag implements Factory\StaticMethod
|
|||||||
*/
|
*/
|
||||||
public function __construct(Fqsen $refers, ?Description $description = null)
|
public function __construct(Fqsen $refers, ?Description $description = null)
|
||||||
{
|
{
|
||||||
$this->refers = $refers;
|
$this->refers = $refers;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ class Var_ extends BaseTag implements Factory\StaticMethod
|
|||||||
public function __construct(string $variableName, ?Type $type = null, ?Description $description = null)
|
public function __construct(string $variableName, ?Type $type = null, ?Description $description = null)
|
||||||
{
|
{
|
||||||
$this->variableName = $variableName;
|
$this->variableName = $variableName;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,8 +53,8 @@ class Var_ extends BaseTag implements Factory\StaticMethod
|
|||||||
Assert::stringNotEmpty($body);
|
Assert::stringNotEmpty($body);
|
||||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||||
|
|
||||||
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
|
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
$type = null;
|
$type = null;
|
||||||
$variableName = '';
|
$variableName = '';
|
||||||
|
|
||||||
// if the first item that is encountered is not a variable; it is a type
|
// if the first item that is encountered is not a variable; it is a type
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
|||||||
*
|
*
|
||||||
* @param string[] $additionalTags
|
* @param string[] $additionalTags
|
||||||
*/
|
*/
|
||||||
public static function createInstance(array $additionalTags = []): DocBlockFactory
|
public static function createInstance(array $additionalTags = []): self
|
||||||
{
|
{
|
||||||
$fqsenResolver = new FqsenResolver();
|
$fqsenResolver = new FqsenResolver();
|
||||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ final class DocblocksWithAnnotationsTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
DOCCOMMENT;
|
DOCCOMMENT;
|
||||||
|
|
||||||
$factory = DocBlockFactory::createInstance();
|
$factory = DocBlockFactory::createInstance();
|
||||||
$docblock = $factory->create($docComment);
|
$docblock = $factory->create($docComment);
|
||||||
|
|
||||||
$this->assertCount(3, $docblock->getTags());
|
$this->assertCount(3, $docblock->getTags());
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ DESCRIPTION;
|
|||||||
$this->assertInstanceOf(See::class, $seeTags[0]);
|
$this->assertInstanceOf(See::class, $seeTags[0]);
|
||||||
|
|
||||||
$seeTag = $seeTags[0];
|
$seeTag = $seeTags[0];
|
||||||
$this->assertSame('\\' . StandardTagFactory::class, (string)$seeTag->getReference());
|
$this->assertSame('\\' . StandardTagFactory::class, (string) $seeTag->getReference());
|
||||||
$this->assertSame('', (string)$seeTag->getDescription());
|
$this->assertSame('', (string) $seeTag->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDescriptionsCanEscapeAtSignsAndClosingBraces(): void
|
public function testDescriptionsCanEscapeAtSignsAndClosingBraces(): void
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class UsingTagsTest extends TestCase
|
|||||||
|
|
||||||
$this->assertInstanceOf(\MyTag::class, $customTagObjects[0]);
|
$this->assertInstanceOf(\MyTag::class, $customTagObjects[0]);
|
||||||
$this->assertSame('my-tag', $customTagObjects[0]->getName());
|
$this->assertSame('my-tag', $customTagObjects[0]->getName());
|
||||||
$this->assertSame('I have a description', (string)$customTagObjects[0]->getDescription());
|
$this->assertSame('I have a description', (string) $customTagObjects[0]->getDescription());
|
||||||
$this->assertSame($docComment, $reconstitutedDocComment);
|
$this->assertSame($docComment, $reconstitutedDocComment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class DescriptionFactoryTest extends TestCase
|
|||||||
$tagFactory = m::mock(TagFactory::class);
|
$tagFactory = m::mock(TagFactory::class);
|
||||||
$tagFactory->shouldReceive('create')->never();
|
$tagFactory->shouldReceive('create')->never();
|
||||||
|
|
||||||
$factory = new DescriptionFactory($tagFactory);
|
$factory = new DescriptionFactory($tagFactory);
|
||||||
$description = $factory->create($contents, new Context(''));
|
$description = $factory->create($contents, new Context(''));
|
||||||
|
|
||||||
$this->assertSame($contents, $description->render());
|
$this->assertSame($contents, $description->render());
|
||||||
@@ -60,7 +60,7 @@ class DescriptionFactoryTest extends TestCase
|
|||||||
$tagFactory = m::mock(TagFactory::class);
|
$tagFactory = m::mock(TagFactory::class);
|
||||||
$tagFactory->shouldReceive('create')->never();
|
$tagFactory->shouldReceive('create')->never();
|
||||||
|
|
||||||
$factory = new DescriptionFactory($tagFactory);
|
$factory = new DescriptionFactory($tagFactory);
|
||||||
$description = $factory->create($contents, new Context(''));
|
$description = $factory->create($contents, new Context(''));
|
||||||
|
|
||||||
$this->assertSame($expected, $description->render());
|
$this->assertSame($expected, $description->render());
|
||||||
@@ -77,15 +77,15 @@ class DescriptionFactoryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDescriptionCanParseAStringWithInlineTag(): void
|
public function testDescriptionCanParseAStringWithInlineTag(): void
|
||||||
{
|
{
|
||||||
$contents = 'This is text for a {@link http://phpdoc.org/ description} that uses an inline tag.';
|
$contents = 'This is text for a {@link http://phpdoc.org/ description} that uses an inline tag.';
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
$tagFactory = m::mock(TagFactory::class);
|
$tagFactory = m::mock(TagFactory::class);
|
||||||
$tagFactory->shouldReceive('create')
|
$tagFactory->shouldReceive('create')
|
||||||
->once()
|
->once()
|
||||||
->with('@link http://phpdoc.org/ description', $context)
|
->with('@link http://phpdoc.org/ description', $context)
|
||||||
->andReturn(new Link('http://phpdoc.org/', new Description('description')));
|
->andReturn(new Link('http://phpdoc.org/', new Description('description')));
|
||||||
|
|
||||||
$factory = new DescriptionFactory($tagFactory);
|
$factory = new DescriptionFactory($tagFactory);
|
||||||
$description = $factory->create($contents, $context);
|
$description = $factory->create($contents, $context);
|
||||||
|
|
||||||
$this->assertSame($contents, $description->render());
|
$this->assertSame($contents, $description->render());
|
||||||
@@ -102,15 +102,15 @@ class DescriptionFactoryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDescriptionCanParseAStringStartingWithInlineTag(): void
|
public function testDescriptionCanParseAStringStartingWithInlineTag(): void
|
||||||
{
|
{
|
||||||
$contents = '{@link http://phpdoc.org/ This} is text for a description that starts with an inline tag.';
|
$contents = '{@link http://phpdoc.org/ This} is text for a description that starts with an inline tag.';
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
$tagFactory = m::mock(TagFactory::class);
|
$tagFactory = m::mock(TagFactory::class);
|
||||||
$tagFactory->shouldReceive('create')
|
$tagFactory->shouldReceive('create')
|
||||||
->once()
|
->once()
|
||||||
->with('@link http://phpdoc.org/ This', $context)
|
->with('@link http://phpdoc.org/ This', $context)
|
||||||
->andReturn(new Link('http://phpdoc.org/', new Description('This')));
|
->andReturn(new Link('http://phpdoc.org/', new Description('This')));
|
||||||
|
|
||||||
$factory = new DescriptionFactory($tagFactory);
|
$factory = new DescriptionFactory($tagFactory);
|
||||||
$description = $factory->create($contents, $context);
|
$description = $factory->create($contents, $context);
|
||||||
|
|
||||||
$this->assertSame($contents, $description->render());
|
$this->assertSame($contents, $description->render());
|
||||||
@@ -123,7 +123,7 @@ class DescriptionFactoryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testIfSuperfluousStartingSpacesAreRemoved(): void
|
public function testIfSuperfluousStartingSpacesAreRemoved(): void
|
||||||
{
|
{
|
||||||
$factory = new DescriptionFactory(m::mock(TagFactory::class));
|
$factory = new DescriptionFactory(m::mock(TagFactory::class));
|
||||||
$descriptionText = <<<DESCRIPTION
|
$descriptionText = <<<DESCRIPTION
|
||||||
This is a multiline
|
This is a multiline
|
||||||
description that you commonly
|
description that you commonly
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class DescriptionTest extends TestCase
|
|||||||
|
|
||||||
$fixture = new Description($body, $tags);
|
$fixture = new Description($body, $tags);
|
||||||
|
|
||||||
$this->assertSame($expected, (string)$fixture);
|
$this->assertSame($expected, (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,6 +123,6 @@ class DescriptionTest extends TestCase
|
|||||||
|
|
||||||
$fixture = new Description($body, $tags);
|
$fixture = new Description($body, $tags);
|
||||||
$expected = '@JoinTable(name="table", joinColumns={@JoinColumn (name="column_id", referencedColumnName="id")}, inverseJoinColumns={@JoinColumn (name="column_id_2", referencedColumnName="id")})';
|
$expected = '@JoinTable(name="table", joinColumns={@JoinColumn (name="column_id", referencedColumnName="id")}, inverseJoinColumns={@JoinColumn (name="column_id_2", referencedColumnName="id")})';
|
||||||
$this->assertSame($expected, (string)$fixture);
|
$this->assertSame($expected, (string) $fixture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ DOCCOMMENT;
|
|||||||
'This is a summary',
|
'This is a summary',
|
||||||
new Description('This is a description'),
|
new Description('This is a description'),
|
||||||
[
|
[
|
||||||
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag'))
|
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ DOCCOMMENT;
|
|||||||
'This is a summary',
|
'This is a summary',
|
||||||
new Description('This is a description'),
|
new Description('This is a description'),
|
||||||
[
|
[
|
||||||
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag'))
|
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ DOCCOMMENT;
|
|||||||
'This is a summary',
|
'This is a summary',
|
||||||
new Description('This is a description'),
|
new Description('This is a description'),
|
||||||
[
|
[
|
||||||
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag'))
|
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ DOCCOMMENT;
|
|||||||
'This is a summary',
|
'This is a summary',
|
||||||
new Description('This is a description'),
|
new Description('This is a description'),
|
||||||
[
|
[
|
||||||
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag'))
|
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ use PHPUnit\Framework\TestCase;
|
|||||||
*/
|
*/
|
||||||
class StandardTagFactoryTest extends TestCase
|
class StandardTagFactoryTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call Mockery::close after each test.
|
* Call Mockery::close after each test.
|
||||||
*/
|
*/
|
||||||
@@ -51,10 +50,10 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testCreatingAGenericTag(): void
|
public function testCreatingAGenericTag(): void
|
||||||
{
|
{
|
||||||
$expectedTagName = 'unknown-tag';
|
$expectedTagName = 'unknown-tag';
|
||||||
$expectedDescriptionText = 'This is a description';
|
$expectedDescriptionText = 'This is a description';
|
||||||
$expectedDescription = new Description($expectedDescriptionText);
|
$expectedDescription = new Description($expectedDescriptionText);
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$descriptionFactory
|
$descriptionFactory
|
||||||
@@ -83,7 +82,7 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testCreatingASpecificTag(): void
|
public function testCreatingASpecificTag(): void
|
||||||
{
|
{
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
$tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class));
|
$tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class));
|
||||||
|
|
||||||
/** @var Author $tag */
|
/** @var Author $tag */
|
||||||
@@ -104,8 +103,8 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testAnEmptyContextIsCreatedIfNoneIsProvided(): void
|
public function testAnEmptyContextIsCreatedIfNoneIsProvided(): void
|
||||||
{
|
{
|
||||||
$fqsen = '\Tag';
|
$fqsen = '\Tag';
|
||||||
$resolver = m::mock(FqsenResolver::class)
|
$resolver = m::mock(FqsenResolver::class)
|
||||||
->shouldReceive('resolve')
|
->shouldReceive('resolve')
|
||||||
->with('Tag', m::type(Context::class))
|
->with('Tag', m::type(Context::class))
|
||||||
->andReturn(new Fqsen($fqsen))
|
->andReturn(new Fqsen($fqsen))
|
||||||
@@ -120,7 +119,7 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
$tag = $tagFactory->create('@see Tag');
|
$tag = $tagFactory->create('@see Tag');
|
||||||
|
|
||||||
$this->assertInstanceOf(See::class, $tag);
|
$this->assertInstanceOf(See::class, $tag);
|
||||||
$this->assertSame($fqsen, (string)$tag->getReference());
|
$this->assertSame($fqsen, (string) $tag->getReference());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,7 +131,7 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testPassingYourOwnSetOfTagHandlers(): void
|
public function testPassingYourOwnSetOfTagHandlers(): void
|
||||||
{
|
{
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
$tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class), ['user' => Author::class]);
|
$tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class), ['user' => Author::class]);
|
||||||
|
|
||||||
/** @var Author $tag */
|
/** @var Author $tag */
|
||||||
@@ -162,7 +161,7 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testAddParameterToServiceLocator(): void
|
public function testAddParameterToServiceLocator(): void
|
||||||
{
|
{
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
$resolver = m::mock(FqsenResolver::class);
|
||||||
$tagFactory = new StandardTagFactory($resolver);
|
$tagFactory = new StandardTagFactory($resolver);
|
||||||
$tagFactory->addParameter('myParam', 'myValue');
|
$tagFactory->addParameter('myParam', 'myValue');
|
||||||
|
|
||||||
@@ -181,7 +180,7 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
{
|
{
|
||||||
$service = new PassthroughFormatter();
|
$service = new PassthroughFormatter();
|
||||||
|
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
$resolver = m::mock(FqsenResolver::class);
|
||||||
$tagFactory = new StandardTagFactory($resolver);
|
$tagFactory = new StandardTagFactory($resolver);
|
||||||
$tagFactory->addService($service);
|
$tagFactory->addService($service);
|
||||||
|
|
||||||
@@ -199,9 +198,9 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
public function testInjectConcreteServiceForInterfaceToServiceLocator(): void
|
public function testInjectConcreteServiceForInterfaceToServiceLocator(): void
|
||||||
{
|
{
|
||||||
$interfaceName = Formatter::class;
|
$interfaceName = Formatter::class;
|
||||||
$service = new PassthroughFormatter();
|
$service = new PassthroughFormatter();
|
||||||
|
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
$resolver = m::mock(FqsenResolver::class);
|
||||||
$tagFactory = new StandardTagFactory($resolver);
|
$tagFactory = new StandardTagFactory($resolver);
|
||||||
$tagFactory->addService($service, $interfaceName);
|
$tagFactory->addService($service, $interfaceName);
|
||||||
|
|
||||||
@@ -221,7 +220,7 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testRegisteringAHandlerForANewTag(): void
|
public function testRegisteringAHandlerForANewTag(): void
|
||||||
{
|
{
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
$resolver = m::mock(FqsenResolver::class);
|
||||||
$tagFactory = new StandardTagFactory($resolver);
|
$tagFactory = new StandardTagFactory($resolver);
|
||||||
|
|
||||||
$tagFactory->registerTagHandler('my-tag', Author::class);
|
$tagFactory->registerTagHandler('my-tag', Author::class);
|
||||||
@@ -239,7 +238,7 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified(): void
|
public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified(): void
|
||||||
{
|
{
|
||||||
$this->expectException('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
$resolver = m::mock(FqsenResolver::class);
|
||||||
$tagFactory = new StandardTagFactory($resolver);
|
$tagFactory = new StandardTagFactory($resolver);
|
||||||
$tagFactory->registerTagHandler(\Name\Spaced\Tag::class, Author::class);
|
$tagFactory->registerTagHandler(\Name\Spaced\Tag::class, Author::class);
|
||||||
}
|
}
|
||||||
@@ -252,7 +251,7 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void
|
public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void
|
||||||
{
|
{
|
||||||
$this->expectException('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
$resolver = m::mock(FqsenResolver::class);
|
||||||
$tagFactory = new StandardTagFactory($resolver);
|
$tagFactory = new StandardTagFactory($resolver);
|
||||||
$tagFactory->registerTagHandler('my-tag', '');
|
$tagFactory->registerTagHandler('my-tag', '');
|
||||||
}
|
}
|
||||||
@@ -265,7 +264,7 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName(): void
|
public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName(): void
|
||||||
{
|
{
|
||||||
$this->expectException('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
$resolver = m::mock(FqsenResolver::class);
|
||||||
$tagFactory = new StandardTagFactory($resolver);
|
$tagFactory = new StandardTagFactory($resolver);
|
||||||
$tagFactory->registerTagHandler('my-tag', 'IDoNotExist');
|
$tagFactory->registerTagHandler('my-tag', 'IDoNotExist');
|
||||||
}
|
}
|
||||||
@@ -278,7 +277,7 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface(): void
|
public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface(): void
|
||||||
{
|
{
|
||||||
$this->expectException('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
$resolver = m::mock(FqsenResolver::class);
|
||||||
$tagFactory = new StandardTagFactory($resolver);
|
$tagFactory = new StandardTagFactory($resolver);
|
||||||
$tagFactory->registerTagHandler('my-tag', 'stdClass');
|
$tagFactory->registerTagHandler('my-tag', 'stdClass');
|
||||||
}
|
}
|
||||||
@@ -293,7 +292,7 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testReturntagIsMappedCorrectly(): void
|
public function testReturntagIsMappedCorrectly(): void
|
||||||
{
|
{
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$descriptionFactory
|
$descriptionFactory
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ use PHPUnit\Framework\TestCase;
|
|||||||
*/
|
*/
|
||||||
class CoversTest extends TestCase
|
class CoversTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call Mockery::close after each test.
|
* Call Mockery::close after each test.
|
||||||
*/
|
*/
|
||||||
@@ -114,7 +113,7 @@ class CoversTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Covers(new Fqsen('\DateTime'), new Description('Description'));
|
$fixture = new Covers(new Fqsen('\DateTime'), new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('\DateTime Description', (string)$fixture);
|
$this->assertSame('\DateTime Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,7 +140,7 @@ class CoversTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Covers::create('DateTime My Description', $descriptionFactory, $resolver, $context);
|
$fixture = Covers::create('DateTime My Description', $descriptionFactory, $resolver, $context);
|
||||||
|
|
||||||
$this->assertSame('\DateTime My Description', (string)$fixture);
|
$this->assertSame('\DateTime My Description', (string) $fixture);
|
||||||
$this->assertSame($fqsen, $fixture->getReference());
|
$this->assertSame($fqsen, $fixture->getReference());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class DeprecatedTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Deprecated('1.0', new Description('Description'));
|
$fixture = new Deprecated('1.0', new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('1.0 Description', (string)$fixture);
|
$this->assertSame('1.0 Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,7 +133,7 @@ class DeprecatedTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Deprecated::create('1.0 My Description', $descriptionFactory, $context);
|
$fixture = Deprecated::create('1.0 My Description', $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('1.0 My Description', (string)$fixture);
|
$this->assertSame('1.0 My Description', (string) $fixture);
|
||||||
$this->assertSame($version, $fixture->getVersion());
|
$this->assertSame($version, $fixture->getVersion());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ use PHPUnit\Framework\TestCase;
|
|||||||
*/
|
*/
|
||||||
class ExampleTest extends TestCase
|
class ExampleTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call Mockery::close after each test.
|
* Call Mockery::close after each test.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,14 +50,14 @@ class AlignFormatterTest extends TestCase
|
|||||||
$tags = [
|
$tags = [
|
||||||
new Param('foobar', new String_()),
|
new Param('foobar', new String_()),
|
||||||
new Version('1.2.0'),
|
new Version('1.2.0'),
|
||||||
new Link('http://www.example.com', new Description('Examples'))
|
new Link('http://www.example.com', new Description('Examples')),
|
||||||
];
|
];
|
||||||
$fixture = new AlignFormatter($tags);
|
$fixture = new AlignFormatter($tags);
|
||||||
|
|
||||||
$expected = [
|
$expected = [
|
||||||
'@param string $foobar',
|
'@param string $foobar',
|
||||||
'@version 1.2.0',
|
'@version 1.2.0',
|
||||||
'@link http://www.example.com Examples'
|
'@link http://www.example.com Examples',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($tags as $key => $tag) {
|
foreach ($tags as $key => $tag) {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class GenericTest extends TestCase
|
|||||||
{
|
{
|
||||||
m::close();
|
m::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic::__construct
|
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic::__construct
|
||||||
* @uses \phpDocumentor\Reflection\DocBlock\Description
|
* @uses \phpDocumentor\Reflection\DocBlock\Description
|
||||||
@@ -98,7 +99,7 @@ class GenericTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Generic('generic', new Description('Description'));
|
$fixture = new Generic('generic', new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('Description', (string)$fixture);
|
$this->assertSame('Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,7 +121,7 @@ class GenericTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Generic::create('My Description', 'generic', $descriptionFactory, $context);
|
$fixture = Generic::create('My Description', 'generic', $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('My Description', (string)$fixture);
|
$this->assertSame('My Description', (string) $fixture);
|
||||||
$this->assertSame($generics, $fixture->getName());
|
$this->assertSame($generics, $fixture->getName());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class LinkTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Link('http://this.is.my/link', new Description('Description'));
|
$fixture = new Link('http://this.is.my/link', new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('http://this.is.my/link Description', (string)$fixture);
|
$this->assertSame('http://this.is.my/link Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,7 +133,7 @@ class LinkTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Link::create('http://this.is.my/link My Description', $descriptionFactory, $context);
|
$fixture = Link::create('http://this.is.my/link My Description', $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('http://this.is.my/link My Description', (string)$fixture);
|
$this->assertSame('http://this.is.my/link My Description', (string) $fixture);
|
||||||
$this->assertSame($links, $fixture->getLink());
|
$this->assertSame($links, $fixture->getLink());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ class LinkTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Link::create('', $descriptionFactory, new Context(''));
|
$fixture = Link::create('', $descriptionFactory, new Context(''));
|
||||||
|
|
||||||
$this->assertSame('', (string)$fixture);
|
$this->assertSame('', (string) $fixture);
|
||||||
$this->assertSame('', $fixture->getLink());
|
$this->assertSame('', $fixture->getLink());
|
||||||
$this->assertSame(null, $fixture->getDescription());
|
$this->assertSame(null, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class MethodTest extends TestCase
|
|||||||
{
|
{
|
||||||
$arguments = [
|
$arguments = [
|
||||||
['name' => 'argument1', 'type' => new String_()],
|
['name' => 'argument1', 'type' => new String_()],
|
||||||
['name' => 'argument2', 'type' => new Object_()]
|
['name' => 'argument2', 'type' => new Object_()],
|
||||||
];
|
];
|
||||||
$fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description'));
|
$fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description'));
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ class MethodTest extends TestCase
|
|||||||
public function testHasArguments(): void
|
public function testHasArguments(): void
|
||||||
{
|
{
|
||||||
$arguments = [
|
$arguments = [
|
||||||
[ 'name' => 'argument1', 'type' => new String_() ]
|
['name' => 'argument1', 'type' => new String_()],
|
||||||
];
|
];
|
||||||
|
|
||||||
$fixture = new Method('myMethod', $arguments);
|
$fixture = new Method('myMethod', $arguments);
|
||||||
@@ -127,7 +127,7 @@ class MethodTest extends TestCase
|
|||||||
{
|
{
|
||||||
$arguments = ['argument1'];
|
$arguments = ['argument1'];
|
||||||
$expected = [
|
$expected = [
|
||||||
[ 'name' => $arguments[0], 'type' => new Void_() ]
|
['name' => $arguments[0], 'type' => new Void_()],
|
||||||
];
|
];
|
||||||
|
|
||||||
$fixture = new Method('myMethod', $arguments);
|
$fixture = new Method('myMethod', $arguments);
|
||||||
@@ -141,9 +141,9 @@ class MethodTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testArgumentTypeCanBeInferredAsVoid(): void
|
public function testArgumentTypeCanBeInferredAsVoid(): void
|
||||||
{
|
{
|
||||||
$arguments = [ [ 'name' => 'argument1' ] ];
|
$arguments = [['name' => 'argument1']];
|
||||||
$expected = [
|
$expected = [
|
||||||
[ 'name' => $arguments[0]['name'], 'type' => new Void_() ]
|
['name' => $arguments[0]['name'], 'type' => new Void_()],
|
||||||
];
|
];
|
||||||
|
|
||||||
$fixture = new Method('myMethod', $arguments);
|
$fixture = new Method('myMethod', $arguments);
|
||||||
@@ -160,15 +160,15 @@ class MethodTest extends TestCase
|
|||||||
public function testRestArgumentIsParsedAsRegularArg(): void
|
public function testRestArgumentIsParsedAsRegularArg(): void
|
||||||
{
|
{
|
||||||
$expected = [
|
$expected = [
|
||||||
[ 'name' => 'arg1', 'type' => new Void_() ],
|
['name' => 'arg1', 'type' => new Void_()],
|
||||||
[ 'name' => 'rest', 'type' => new Void_() ],
|
['name' => 'rest', 'type' => new Void_()],
|
||||||
[ 'name' => 'rest2', 'type' => new Array_() ],
|
['name' => 'rest2', 'type' => new Array_()],
|
||||||
];
|
];
|
||||||
|
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$resolver = new TypeResolver();
|
$resolver = new TypeResolver();
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
$description = new Description('');
|
$description = new Description('');
|
||||||
$descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description);
|
$descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description);
|
||||||
|
|
||||||
$fixture = Method::create(
|
$fixture = Method::create(
|
||||||
@@ -244,13 +244,13 @@ class MethodTest extends TestCase
|
|||||||
{
|
{
|
||||||
$arguments = [
|
$arguments = [
|
||||||
['name' => 'argument1', 'type' => new String_()],
|
['name' => 'argument1', 'type' => new String_()],
|
||||||
['name' => 'argument2', 'type' => new Object_()]
|
['name' => 'argument2', 'type' => new Object_()],
|
||||||
];
|
];
|
||||||
$fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description'));
|
$fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description'));
|
||||||
|
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
'static void myMethod(string $argument1, object $argument2) My Description',
|
'static void myMethod(string $argument1, object $argument2) My Description',
|
||||||
(string)$fixture
|
(string) $fixture
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,13 +266,13 @@ class MethodTest extends TestCase
|
|||||||
public function testFactoryMethod(): void
|
public function testFactoryMethod(): void
|
||||||
{
|
{
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$resolver = new TypeResolver();
|
$resolver = new TypeResolver();
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$description = new Description('My Description');
|
$description = new Description('My Description');
|
||||||
$expectedArguments = [
|
$expectedArguments = [
|
||||||
[ 'name' => 'argument1', 'type' => new String_() ],
|
['name' => 'argument1', 'type' => new String_()],
|
||||||
[ 'name' => 'argument2', 'type' => new Void_() ]
|
['name' => 'argument2', 'type' => new Void_()],
|
||||||
];
|
];
|
||||||
|
|
||||||
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
||||||
@@ -284,7 +284,7 @@ class MethodTest extends TestCase
|
|||||||
$context
|
$context
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertSame('static void myMethod(string $argument1, void $argument2) My Description', (string)$fixture);
|
$this->assertSame('static void myMethod(string $argument1, void $argument2) My Description', (string) $fixture);
|
||||||
$this->assertSame('myMethod', $fixture->getMethodName());
|
$this->assertSame('myMethod', $fixture->getMethodName());
|
||||||
$this->assertEquals($expectedArguments, $fixture->getArguments());
|
$this->assertEquals($expectedArguments, $fixture->getArguments());
|
||||||
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
|
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
|
||||||
@@ -301,10 +301,10 @@ class MethodTest extends TestCase
|
|||||||
public function testReturnTypeThis(): void
|
public function testReturnTypeThis(): void
|
||||||
{
|
{
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$resolver = new TypeResolver();
|
$resolver = new TypeResolver();
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$description = new Description('');
|
$description = new Description('');
|
||||||
|
|
||||||
$descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description);
|
$descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description);
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@ class MethodTest extends TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue($fixture->isStatic());
|
$this->assertTrue($fixture->isStatic());
|
||||||
$this->assertSame('static $this myMethod()', (string)$fixture);
|
$this->assertSame('static $this myMethod()', (string) $fixture);
|
||||||
$this->assertSame('myMethod', $fixture->getMethodName());
|
$this->assertSame('myMethod', $fixture->getMethodName());
|
||||||
$this->assertInstanceOf(This::class, $fixture->getReturnType());
|
$this->assertInstanceOf(This::class, $fixture->getReturnType());
|
||||||
}
|
}
|
||||||
@@ -334,15 +334,14 @@ class MethodTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* @dataProvider collectionReturnTypesProvider
|
* @dataProvider collectionReturnTypesProvider
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
|
* @uses phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
|
||||||
* @uses \phpDocumentor\Reflection\DocBlock\Description
|
* @uses phpDocumentor\Reflection\DocBlock\Description
|
||||||
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
|
* @uses phpDocumentor\Reflection\DocBlock\DescriptionFactory
|
||||||
* @uses \phpDocumentor\Reflection\TypeResolver
|
* @uses phpDocumentor\Reflection\TypeResolver
|
||||||
* @uses \phpDocumentor\Reflection\Types\Array_
|
* @uses phpDocumentor\Reflection\Types\Array_
|
||||||
* @uses \phpDocumentor\Reflection\Types\Compound
|
* @uses phpDocumentor\Reflection\Types\Compound
|
||||||
* @uses \phpDocumentor\Reflection\Types\Integer
|
* @uses phpDocumentor\Reflection\Types\Integer
|
||||||
* @uses \phpDocumentor\Reflection\Types\Object_
|
* @uses phpDocumentor\Reflection\Types\Object_
|
||||||
* @param string null $expectedKeyType
|
|
||||||
*/
|
*/
|
||||||
public function testCollectionReturnTypes(
|
public function testCollectionReturnTypes(
|
||||||
string $returnType,
|
string $returnType,
|
||||||
@@ -350,11 +349,11 @@ class MethodTest extends TestCase
|
|||||||
?string $expectedValueType = null,
|
?string $expectedValueType = null,
|
||||||
?string $expectedKeyType = null
|
?string $expectedKeyType = null
|
||||||
): void {
|
): void {
|
||||||
$resolver = new TypeResolver();
|
$resolver = new TypeResolver();
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$descriptionFactory->shouldReceive('create')->with('', null)->andReturn(new Description(''));
|
$descriptionFactory->shouldReceive('create')->with('', null)->andReturn(new Description(''));
|
||||||
|
|
||||||
$fixture = Method::create("$returnType myMethod(\$arg)", $resolver, $descriptionFactory);
|
$fixture = Method::create("${returnType} myMethod(\$arg)", $resolver, $descriptionFactory);
|
||||||
$returnType = $fixture->getReturnType();
|
$returnType = $fixture->getReturnType();
|
||||||
$this->assertInstanceOf($expectedType, $returnType);
|
$this->assertInstanceOf($expectedType, $returnType);
|
||||||
|
|
||||||
@@ -433,7 +432,7 @@ class MethodTest extends TestCase
|
|||||||
public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void
|
public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void
|
||||||
{
|
{
|
||||||
$this->expectException('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
new Method('body', [ [ 'name' => 'myName', 'unknown' => 'nah' ] ]);
|
new Method('body', [['name' => 'myName', 'unknown' => 'nah']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -448,10 +447,10 @@ class MethodTest extends TestCase
|
|||||||
public function testCreateMethodParenthesisMissing(): void
|
public function testCreateMethodParenthesisMissing(): void
|
||||||
{
|
{
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$resolver = new TypeResolver();
|
$resolver = new TypeResolver();
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$description = new Description('My Description');
|
$description = new Description('My Description');
|
||||||
|
|
||||||
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
||||||
|
|
||||||
@@ -462,7 +461,7 @@ class MethodTest extends TestCase
|
|||||||
$context
|
$context
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertSame('static void myMethod() My Description', (string)$fixture);
|
$this->assertSame('static void myMethod() My Description', (string) $fixture);
|
||||||
$this->assertSame('myMethod', $fixture->getMethodName());
|
$this->assertSame('myMethod', $fixture->getMethodName());
|
||||||
$this->assertEquals([], $fixture->getArguments());
|
$this->assertEquals([], $fixture->getArguments());
|
||||||
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
|
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
|
||||||
@@ -482,10 +481,10 @@ class MethodTest extends TestCase
|
|||||||
public function testCreateWithoutReturnType(): void
|
public function testCreateWithoutReturnType(): void
|
||||||
{
|
{
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$resolver = new TypeResolver();
|
$resolver = new TypeResolver();
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$description = new Description('');
|
$description = new Description('');
|
||||||
|
|
||||||
$descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description);
|
$descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description);
|
||||||
|
|
||||||
@@ -496,7 +495,7 @@ class MethodTest extends TestCase
|
|||||||
$context
|
$context
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertSame('void myMethod()', (string)$fixture);
|
$this->assertSame('void myMethod()', (string) $fixture);
|
||||||
$this->assertSame('myMethod', $fixture->getMethodName());
|
$this->assertSame('myMethod', $fixture->getMethodName());
|
||||||
$this->assertEquals([], $fixture->getArguments());
|
$this->assertEquals([], $fixture->getArguments());
|
||||||
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
|
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
|
||||||
@@ -519,8 +518,8 @@ class MethodTest extends TestCase
|
|||||||
public function testCreateWithMixedReturnTypes(): void
|
public function testCreateWithMixedReturnTypes(): void
|
||||||
{
|
{
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$resolver = new TypeResolver();
|
$resolver = new TypeResolver();
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$descriptionFactory->shouldReceive('create')->andReturn(new Description(''));
|
$descriptionFactory->shouldReceive('create')->andReturn(new Description(''));
|
||||||
|
|
||||||
@@ -531,7 +530,7 @@ class MethodTest extends TestCase
|
|||||||
$context
|
$context
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertSame('\MyClass[]|int[] myMethod()', (string)$fixture);
|
$this->assertSame('\MyClass[]|int[] myMethod()', (string) $fixture);
|
||||||
$this->assertSame('myMethod', $fixture->getMethodName());
|
$this->assertSame('myMethod', $fixture->getMethodName());
|
||||||
$this->assertEquals([], $fixture->getArguments());
|
$this->assertEquals([], $fixture->getArguments());
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class ParamTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Param('myParameter', new String_(), true, new Description('Description'));
|
$fixture = new Param('myParameter', new String_(), true, new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('string ...$myParameter Description', (string)$fixture);
|
$this->assertSame('string ...$myParameter Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -170,7 +170,7 @@ class ParamTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Param::create('string ...$myParameter My Description', $typeResolver, $descriptionFactory, $context);
|
$fixture = Param::create('string ...$myParameter My Description', $typeResolver, $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('string ...$myParameter My Description', (string)$fixture);
|
$this->assertSame('string ...$myParameter My Description', (string) $fixture);
|
||||||
$this->assertSame('myParameter', $fixture->getVariableName());
|
$this->assertSame('myParameter', $fixture->getVariableName());
|
||||||
$this->assertInstanceOf(String_::class, $fixture->getType());
|
$this->assertInstanceOf(String_::class, $fixture->getType());
|
||||||
$this->assertTrue($fixture->isVariadic());
|
$this->assertTrue($fixture->isVariadic());
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class PropertyReadTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new PropertyRead('myProperty', new String_(), new Description('Description'));
|
$fixture = new PropertyRead('myProperty', new String_(), new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('string $myProperty Description', (string)$fixture);
|
$this->assertSame('string $myProperty Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -157,7 +157,7 @@ class PropertyReadTest extends TestCase
|
|||||||
$context
|
$context
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertSame('string $myProperty My Description', (string)$fixture);
|
$this->assertSame('string $myProperty My Description', (string) $fixture);
|
||||||
$this->assertSame('myProperty', $fixture->getVariableName());
|
$this->assertSame('myProperty', $fixture->getVariableName());
|
||||||
$this->assertInstanceOf(String_::class, $fixture->getType());
|
$this->assertInstanceOf(String_::class, $fixture->getType());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class PropertyTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Property('myProperty', new String_(), new Description('Description'));
|
$fixture = new Property('myProperty', new String_(), new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('string $myProperty Description', (string)$fixture);
|
$this->assertSame('string $myProperty Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,7 +152,7 @@ class PropertyTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Property::create('string $myProperty My Description', $typeResolver, $descriptionFactory, $context);
|
$fixture = Property::create('string $myProperty My Description', $typeResolver, $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('string $myProperty My Description', (string)$fixture);
|
$this->assertSame('string $myProperty My Description', (string) $fixture);
|
||||||
$this->assertSame('myProperty', $fixture->getVariableName());
|
$this->assertSame('myProperty', $fixture->getVariableName());
|
||||||
$this->assertInstanceOf(String_::class, $fixture->getType());
|
$this->assertInstanceOf(String_::class, $fixture->getType());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class PropertyWriteTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new PropertyWrite('myProperty', new String_(), new Description('Description'));
|
$fixture = new PropertyWrite('myProperty', new String_(), new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('string $myProperty Description', (string)$fixture);
|
$this->assertSame('string $myProperty Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -157,7 +157,7 @@ class PropertyWriteTest extends TestCase
|
|||||||
$context
|
$context
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertSame('string $myProperty My Description', (string)$fixture);
|
$this->assertSame('string $myProperty My Description', (string) $fixture);
|
||||||
$this->assertSame('myProperty', $fixture->getVariableName());
|
$this->assertSame('myProperty', $fixture->getVariableName());
|
||||||
$this->assertInstanceOf(String_::class, $fixture->getType());
|
$this->assertInstanceOf(String_::class, $fixture->getType());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class ReturnTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Return_(new String_(), new Description('Description'));
|
$fixture = new Return_(new String_(), new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('string Description', (string)$fixture);
|
$this->assertSame('string Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,7 +137,7 @@ class ReturnTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Return_::create('string My Description', $resolver, $descriptionFactory, $context);
|
$fixture = Return_::create('string My Description', $resolver, $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('string My Description', (string)$fixture);
|
$this->assertSame('string My Description', (string) $fixture);
|
||||||
$this->assertEquals($type, $fixture->getType());
|
$this->assertEquals($type, $fixture->getType());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ class SeeTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new See(new FqsenRef(new Fqsen('\DateTime::format()')), new Description('Description'));
|
$fixture = new See(new FqsenRef(new Fqsen('\DateTime::format()')), new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('\DateTime::format() Description', (string)$fixture);
|
$this->assertSame('\DateTime::format() Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,9 +154,9 @@ class SeeTest extends TestCase
|
|||||||
|
|
||||||
$fixture = See::create('DateTime My Description', $resolver, $descriptionFactory, $context);
|
$fixture = See::create('DateTime My Description', $resolver, $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('\DateTime My Description', (string)$fixture);
|
$this->assertSame('\DateTime My Description', (string) $fixture);
|
||||||
$this->assertInstanceOf(FqsenRef::class, $fixture->getReference());
|
$this->assertInstanceOf(FqsenRef::class, $fixture->getReference());
|
||||||
$this->assertSame((string)$fqsen, (string)$fixture->getReference());
|
$this->assertSame((string) $fqsen, (string) $fixture->getReference());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,9 +184,9 @@ class SeeTest extends TestCase
|
|||||||
|
|
||||||
$fixture = See::create('https://test.org My Description', $resolver, $descriptionFactory, $context);
|
$fixture = See::create('https://test.org My Description', $resolver, $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('https://test.org My Description', (string)$fixture);
|
$this->assertSame('https://test.org My Description', (string) $fixture);
|
||||||
$this->assertInstanceOf(UrlRef::class, $fixture->getReference());
|
$this->assertInstanceOf(UrlRef::class, $fixture->getReference());
|
||||||
$this->assertSame('https://test.org', (string)$fixture->getReference());
|
$this->assertSame('https://test.org', (string) $fixture->getReference());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ use PHPUnit\Framework\TestCase;
|
|||||||
*/
|
*/
|
||||||
class SinceTest extends TestCase
|
class SinceTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call Mockery::close after each test.
|
* Call Mockery::close after each test.
|
||||||
*/
|
*/
|
||||||
@@ -112,7 +111,7 @@ class SinceTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Since('1.0', new Description('Description'));
|
$fixture = new Since('1.0', new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('1.0 Description', (string)$fixture);
|
$this->assertSame('1.0 Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,16 +124,16 @@ class SinceTest extends TestCase
|
|||||||
public function testFactoryMethod(): void
|
public function testFactoryMethod(): void
|
||||||
{
|
{
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$version = '1.0';
|
$version = '1.0';
|
||||||
$description = new Description('My Description');
|
$description = new Description('My Description');
|
||||||
|
|
||||||
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
||||||
|
|
||||||
$fixture = Since::create('1.0 My Description', $descriptionFactory, $context);
|
$fixture = Since::create('1.0 My Description', $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('1.0 My Description', (string)$fixture);
|
$this->assertSame('1.0 My Description', (string) $fixture);
|
||||||
$this->assertSame($version, $fixture->getVersion());
|
$this->assertSame($version, $fixture->getVersion());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
@@ -153,7 +152,7 @@ class SinceTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Since::create('', $descriptionFactory, new Context(''));
|
$fixture = Since::create('', $descriptionFactory, new Context(''));
|
||||||
|
|
||||||
$this->assertSame('', (string)$fixture);
|
$this->assertSame('', (string) $fixture);
|
||||||
$this->assertSame(null, $fixture->getVersion());
|
$this->assertSame(null, $fixture->getVersion());
|
||||||
$this->assertSame(null, $fixture->getDescription());
|
$this->assertSame(null, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ class SourceTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Source(1, 10, new Description('Description'));
|
$fixture = new Source(1, 10, new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('1 10 Description', (string)$fixture);
|
$this->assertSame('1 10 Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,14 +142,14 @@ class SourceTest extends TestCase
|
|||||||
public function testFactoryMethod(): void
|
public function testFactoryMethod(): void
|
||||||
{
|
{
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$description = new Description('My Description');
|
$description = new Description('My Description');
|
||||||
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
||||||
|
|
||||||
$fixture = Source::create('1 10 My Description', $descriptionFactory, $context);
|
$fixture = Source::create('1 10 My Description', $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('1 10 My Description', (string)$fixture);
|
$this->assertSame('1 10 My Description', (string) $fixture);
|
||||||
$this->assertSame(1, $fixture->getStartingLine());
|
$this->assertSame(1, $fixture->getStartingLine());
|
||||||
$this->assertSame(10, $fixture->getLineCount());
|
$this->assertSame(10, $fixture->getLineCount());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class ThrowsTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Throws(new String_(), new Description('Description'));
|
$fixture = new Throws(new String_(), new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('string Description', (string)$fixture);
|
$this->assertSame('string Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,16 +128,16 @@ class ThrowsTest extends TestCase
|
|||||||
public function testFactoryMethod(): void
|
public function testFactoryMethod(): void
|
||||||
{
|
{
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$resolver = new TypeResolver();
|
$resolver = new TypeResolver();
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$type = new String_();
|
$type = new String_();
|
||||||
$description = new Description('My Description');
|
$description = new Description('My Description');
|
||||||
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
||||||
|
|
||||||
$fixture = Throws::create('string My Description', $resolver, $descriptionFactory, $context);
|
$fixture = Throws::create('string My Description', $resolver, $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('string My Description', (string)$fixture);
|
$this->assertSame('string My Description', (string) $fixture);
|
||||||
$this->assertEquals($type, $fixture->getType());
|
$this->assertEquals($type, $fixture->getType());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class UsesTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Uses(new Fqsen('\DateTime'), new Description('Description'));
|
$fixture = new Uses(new Fqsen('\DateTime'), new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('\DateTime Description', (string)$fixture);
|
$this->assertSame('\DateTime Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,10 +128,10 @@ class UsesTest extends TestCase
|
|||||||
public function testFactoryMethod(): void
|
public function testFactoryMethod(): void
|
||||||
{
|
{
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
$resolver = m::mock(FqsenResolver::class);
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$fqsen = new Fqsen('\DateTime');
|
$fqsen = new Fqsen('\DateTime');
|
||||||
$description = new Description('My Description');
|
$description = new Description('My Description');
|
||||||
|
|
||||||
$descriptionFactory
|
$descriptionFactory
|
||||||
@@ -140,7 +140,7 @@ class UsesTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Uses::create('DateTime My Description', $resolver, $descriptionFactory, $context);
|
$fixture = Uses::create('DateTime My Description', $resolver, $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('\DateTime My Description', (string)$fixture);
|
$this->assertSame('\DateTime My Description', (string) $fixture);
|
||||||
$this->assertSame($fqsen, $fixture->getReference());
|
$this->assertSame($fqsen, $fixture->getReference());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ class VarTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Var_('myVariable', new String_(), new Description('Description'));
|
$fixture = new Var_('myVariable', new String_(), new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('string $myVariable Description', (string)$fixture);
|
$this->assertSame('string $myVariable Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,16 +154,16 @@ class VarTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testFactoryMethod(): void
|
public function testFactoryMethod(): void
|
||||||
{
|
{
|
||||||
$typeResolver = new TypeResolver();
|
$typeResolver = new TypeResolver();
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$description = new Description('My Description');
|
$description = new Description('My Description');
|
||||||
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
||||||
|
|
||||||
$fixture = Var_::create('string $myVariable My Description', $typeResolver, $descriptionFactory, $context);
|
$fixture = Var_::create('string $myVariable My Description', $typeResolver, $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('string $myVariable My Description', (string)$fixture);
|
$this->assertSame('string $myVariable My Description', (string) $fixture);
|
||||||
$this->assertSame('myVariable', $fixture->getVariableName());
|
$this->assertSame('myVariable', $fixture->getVariableName());
|
||||||
$this->assertInstanceOf(String_::class, $fixture->getType());
|
$this->assertInstanceOf(String_::class, $fixture->getType());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class VersionTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new Version('1.0', new Description('Description'));
|
$fixture = new Version('1.0', new Description('Description'));
|
||||||
|
|
||||||
$this->assertSame('1.0 Description', (string)$fixture);
|
$this->assertSame('1.0 Description', (string) $fixture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,16 +124,16 @@ class VersionTest extends TestCase
|
|||||||
public function testFactoryMethod(): void
|
public function testFactoryMethod(): void
|
||||||
{
|
{
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
$context = new Context('');
|
$context = new Context('');
|
||||||
|
|
||||||
$version = '1.0';
|
$version = '1.0';
|
||||||
$description = new Description('My Description');
|
$description = new Description('My Description');
|
||||||
|
|
||||||
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
||||||
|
|
||||||
$fixture = Version::create('1.0 My Description', $descriptionFactory, $context);
|
$fixture = Version::create('1.0 My Description', $descriptionFactory, $context);
|
||||||
|
|
||||||
$this->assertSame('1.0 My Description', (string)$fixture);
|
$this->assertSame('1.0 My Description', (string) $fixture);
|
||||||
$this->assertSame($version, $fixture->getVersion());
|
$this->assertSame($version, $fixture->getVersion());
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ class VersionTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Version::create('', $descriptionFactory, new Context(''));
|
$fixture = Version::create('', $descriptionFactory, new Context(''));
|
||||||
|
|
||||||
$this->assertSame('', (string)$fixture);
|
$this->assertSame('', (string) $fixture);
|
||||||
$this->assertSame(null, $fixture->getVersion());
|
$this->assertSame(null, $fixture->getVersion());
|
||||||
$this->assertSame(null, $fixture->getDescription());
|
$this->assertSame(null, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class DocBlockFactoryTest extends TestCase
|
|||||||
{
|
{
|
||||||
$fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class));
|
$fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class));
|
||||||
|
|
||||||
$docBlock = '/** This is a DocBlock */';
|
$docBlock = '/** This is a DocBlock */';
|
||||||
$classReflector = m::mock(\ReflectionClass::class);
|
$classReflector = m::mock(\ReflectionClass::class);
|
||||||
$classReflector->shouldReceive('getDocComment')->andReturn($docBlock);
|
$classReflector->shouldReceive('getDocComment')->andReturn($docBlock);
|
||||||
$docblock = $fixture->create($classReflector);
|
$docblock = $fixture->create($classReflector);
|
||||||
@@ -121,7 +121,7 @@ class DocBlockFactoryTest extends TestCase
|
|||||||
public function testSummaryAndDescriptionAreSeparated($given, $summary, $description): void
|
public function testSummaryAndDescriptionAreSeparated($given, $summary, $description): void
|
||||||
{
|
{
|
||||||
$tagFactory = m::mock(TagFactory::class);
|
$tagFactory = m::mock(TagFactory::class);
|
||||||
$fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory);
|
$fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory);
|
||||||
|
|
||||||
$docblock = $fixture->create($given);
|
$docblock = $fixture->create($given);
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ class DocBlockFactoryTest extends TestCase
|
|||||||
public function testDescriptionsRetainFormatting(): void
|
public function testDescriptionsRetainFormatting(): void
|
||||||
{
|
{
|
||||||
$tagFactory = m::mock(TagFactory::class);
|
$tagFactory = m::mock(TagFactory::class);
|
||||||
$fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory);
|
$fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory);
|
||||||
|
|
||||||
$given = <<<DOCBLOCK
|
$given = <<<DOCBLOCK
|
||||||
/**
|
/**
|
||||||
@@ -175,7 +175,7 @@ DESCRIPTION;
|
|||||||
multiline description.
|
multiline description.
|
||||||
TAG;
|
TAG;
|
||||||
|
|
||||||
$tag = m::mock(Tag::class);
|
$tag = m::mock(Tag::class);
|
||||||
$tagFactory = m::mock(TagFactory::class);
|
$tagFactory = m::mock(TagFactory::class);
|
||||||
$tagFactory->shouldReceive('create')->with($tagString, m::type(Context::class))->andReturn($tag);
|
$tagFactory->shouldReceive('create')->with($tagString, m::type(Context::class))->andReturn($tag);
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ DOCBLOCK;
|
|||||||
[
|
[
|
||||||
'This is a DocBlock. This should still be summary.',
|
'This is a DocBlock. This should still be summary.',
|
||||||
'This is a DocBlock. This should still be summary.',
|
'This is a DocBlock. This should still be summary.',
|
||||||
''
|
'',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
<<<DOCBLOCK
|
<<<DOCBLOCK
|
||||||
@@ -211,7 +211,7 @@ This should be a Description.
|
|||||||
DOCBLOCK
|
DOCBLOCK
|
||||||
,
|
,
|
||||||
'This is a DocBlock.',
|
'This is a DocBlock.',
|
||||||
'This should be a Description.'
|
'This should be a Description.',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
<<<DOCBLOCK
|
<<<DOCBLOCK
|
||||||
@@ -221,7 +221,7 @@ This should be a Description.
|
|||||||
DOCBLOCK
|
DOCBLOCK
|
||||||
,
|
,
|
||||||
"This is a\nmultiline Summary.",
|
"This is a\nmultiline Summary.",
|
||||||
'This should be a Description.'
|
'This should be a Description.',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
<<<DOCBLOCK
|
<<<DOCBLOCK
|
||||||
@@ -231,7 +231,7 @@ This should be a Description.
|
|||||||
DOCBLOCK
|
DOCBLOCK
|
||||||
,
|
,
|
||||||
'This is a Summary without dot but with a whiteline',
|
'This is a Summary without dot but with a whiteline',
|
||||||
'This should be a Description.'
|
'This should be a Description.',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
<<<DOCBLOCK
|
<<<DOCBLOCK
|
||||||
@@ -241,7 +241,7 @@ This should be a Description.
|
|||||||
DOCBLOCK
|
DOCBLOCK
|
||||||
,
|
,
|
||||||
'This is a Summary with dot and with a whiteline.',
|
'This is a Summary with dot and with a whiteline.',
|
||||||
'This should be a Description.'
|
'This should be a Description.',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class DocBlockTest extends TestCase
|
|||||||
public function testDocBlockCanHaveTags(): void
|
public function testDocBlockCanHaveTags(): void
|
||||||
{
|
{
|
||||||
$tags = [
|
$tags = [
|
||||||
m::mock(DocBlock\Tag::class)
|
m::mock(DocBlock\Tag::class),
|
||||||
];
|
];
|
||||||
|
|
||||||
$fixture = new DocBlock('', null, $tags);
|
$fixture = new DocBlock('', null, $tags);
|
||||||
@@ -91,7 +91,7 @@ class DocBlockTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->expectException('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$tags = [
|
$tags = [
|
||||||
null
|
null,
|
||||||
];
|
];
|
||||||
$fixture = new DocBlock('', null, $tags);
|
$fixture = new DocBlock('', null, $tags);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user