mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Fixed @method annotations with an empty argument list and description
This commit is contained in:
@@ -120,12 +120,8 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
)
|
||||
\s+
|
||||
)?
|
||||
# Legacy method name (not captured)
|
||||
(?:
|
||||
[\w_]+\(\)\s+
|
||||
)?
|
||||
# Method name
|
||||
([\w\|_\\\\]+)
|
||||
([\w_]+)
|
||||
# Arguments
|
||||
(?:
|
||||
\(([^\)]*)\)
|
||||
|
||||
@@ -472,6 +472,40 @@ class MethodTest extends TestCase
|
||||
$this->assertSame($description, $fixture->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
|
||||
* @uses \phpDocumentor\Reflection\TypeResolver
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\Description
|
||||
* @uses \phpDocumentor\Reflection\Fqsen
|
||||
* @uses \phpDocumentor\Reflection\Types\Context
|
||||
*
|
||||
* @covers ::create
|
||||
*/
|
||||
public function testCreateMethodEmptyArguments() : void
|
||||
{
|
||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||
$resolver = new TypeResolver();
|
||||
$context = new Context('');
|
||||
|
||||
$description = new Description('My Description');
|
||||
|
||||
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
||||
|
||||
$fixture = Method::create(
|
||||
'static void myMethod() My Description',
|
||||
$resolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('static void myMethod() My Description', (string) $fixture);
|
||||
$this->assertSame('myMethod', $fixture->getMethodName());
|
||||
$this->assertEquals([], $fixture->getArguments());
|
||||
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
|
||||
$this->assertSame($description, $fixture->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
|
||||
|
||||
Reference in New Issue
Block a user