mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Allow omitting method return type
Support for `@method myMethod()` was missing but according to the docs of phpdocumentor this is possible.
This commit is contained in:
committed by
Jaap van Otterdijk
parent
8ba1708217
commit
b453d2c304
@@ -305,7 +305,7 @@ class MethodTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$this->assertTrue($fixture->isStatic());
|
||||
$this->assertSame('static $this myMethod() ', (string)$fixture);
|
||||
$this->assertSame('static $this myMethod()', (string)$fixture);
|
||||
$this->assertSame('myMethod', $fixture->getMethodName());
|
||||
$this->assertInstanceOf(This::class, $fixture->getReturnType());
|
||||
}
|
||||
@@ -468,4 +468,28 @@ class MethodTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
|
||||
$this->assertSame($description, $fixture->getDescription());
|
||||
}
|
||||
|
||||
public function testCreateWithoutReturnType()
|
||||
{
|
||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
||||
$resolver = new TypeResolver();
|
||||
$context = new Context('');
|
||||
|
||||
$description = new Description('');
|
||||
|
||||
$descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description);
|
||||
|
||||
$fixture = Method::create(
|
||||
'myMethod()',
|
||||
$resolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('void myMethod()', (string)$fixture);
|
||||
$this->assertSame('myMethod', $fixture->getMethodName());
|
||||
$this->assertEquals([], $fixture->getArguments());
|
||||
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
|
||||
$this->assertSame($description, $fixture->getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user