mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Fix issue with missing registered factory
This commit is contained in:
@@ -21,6 +21,7 @@ use phpDocumentor\Reflection\DocBlock\Tag;
|
|||||||
use phpDocumentor\Reflection\DocBlock\TagFactory;
|
use phpDocumentor\Reflection\DocBlock\TagFactory;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\AbstractPHPStanFactory;
|
use phpDocumentor\Reflection\DocBlock\Tags\Factory\AbstractPHPStanFactory;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory;
|
use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory;
|
||||||
|
use phpDocumentor\Reflection\DocBlock\Tags\Factory\MethodFactory;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\ParamFactory;
|
use phpDocumentor\Reflection\DocBlock\Tags\Factory\ParamFactory;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\PropertyFactory;
|
use phpDocumentor\Reflection\DocBlock\Tags\Factory\PropertyFactory;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\PropertyReadFactory;
|
use phpDocumentor\Reflection\DocBlock\Tags\Factory\PropertyReadFactory;
|
||||||
@@ -77,6 +78,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
|||||||
new PropertyFactory($typeResolver, $descriptionFactory),
|
new PropertyFactory($typeResolver, $descriptionFactory),
|
||||||
new PropertyReadFactory($typeResolver, $descriptionFactory),
|
new PropertyReadFactory($typeResolver, $descriptionFactory),
|
||||||
new PropertyWriteFactory($typeResolver, $descriptionFactory),
|
new PropertyWriteFactory($typeResolver, $descriptionFactory),
|
||||||
|
new MethodFactory($typeResolver, $descriptionFactory)
|
||||||
);
|
);
|
||||||
|
|
||||||
$tagFactory->addService($descriptionFactory);
|
$tagFactory->addService($descriptionFactory);
|
||||||
|
|||||||
@@ -17,11 +17,14 @@ use Mockery as m;
|
|||||||
use phpDocumentor\Reflection\DocBlock\Description;
|
use phpDocumentor\Reflection\DocBlock\Description;
|
||||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||||
|
use phpDocumentor\Reflection\DocBlock\Tags\Method;
|
||||||
|
use phpDocumentor\Reflection\DocBlock\Tags\MethodParameter;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tags\Param;
|
use phpDocumentor\Reflection\DocBlock\Tags\Param;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tags\See;
|
use phpDocumentor\Reflection\DocBlock\Tags\See;
|
||||||
use phpDocumentor\Reflection\Types\Array_;
|
use phpDocumentor\Reflection\Types\Array_;
|
||||||
use phpDocumentor\Reflection\Types\Integer;
|
use phpDocumentor\Reflection\Types\Integer;
|
||||||
use phpDocumentor\Reflection\Types\String_;
|
use phpDocumentor\Reflection\Types\String_;
|
||||||
|
use phpDocumentor\Reflection\Types\Void_;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -185,4 +188,35 @@ DOC;
|
|||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMethodRegression(): void
|
||||||
|
{
|
||||||
|
$docCommment = <<<DOC
|
||||||
|
/**
|
||||||
|
* This is an example of a summary.
|
||||||
|
*
|
||||||
|
* @method void setInteger(integer \$integer)
|
||||||
|
*/
|
||||||
|
DOC;
|
||||||
|
$factory = DocBlockFactory::createInstance();
|
||||||
|
$docblock = $factory->create($docCommment);
|
||||||
|
|
||||||
|
self::assertEquals(
|
||||||
|
[
|
||||||
|
new Method(
|
||||||
|
'setInteger',
|
||||||
|
[],
|
||||||
|
new Void_(),
|
||||||
|
false,
|
||||||
|
new Description(''),
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
new MethodParameter('integer', new Integer())
|
||||||
|
]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
$docblock->getTags()
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,18 @@ final class MethodFactoryTest extends TagFactoryTestCase
|
|||||||
[new MethodParameter('a', new Mixed_())]
|
[new MethodParameter('a', new Mixed_())]
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'@method void setInteger(integer $integer)',
|
||||||
|
new Method(
|
||||||
|
'setInteger',
|
||||||
|
[],
|
||||||
|
new Void_(),
|
||||||
|
false,
|
||||||
|
new Description(''),
|
||||||
|
false,
|
||||||
|
[new MethodParameter('integer', new Integer())]
|
||||||
|
),
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'@method myMethod($a = 1)',
|
'@method myMethod($a = 1)',
|
||||||
new Method(
|
new Method(
|
||||||
|
|||||||
Reference in New Issue
Block a user