diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index 03bd1b6..8156d07 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -342,6 +342,37 @@ class MethodTest extends TestCase $this->assertInstanceOf(This::class, $fixture->getReturnType()); } + /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method:: + * @uses \phpDocumentor\Reflection\TypeResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create + */ + public function testReturnTypeNoneWithLongMethodName() : void + { + $descriptionFactory = m::mock(DescriptionFactory::class); + $resolver = new TypeResolver(); + $context = new Context(''); + + $description = new Description(''); + + $descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description); + + $fixture = Method::create( + 'myVeryLongMethodName($node)', + $resolver, + $descriptionFactory, + $context + ); + + $this->assertFalse($fixture->isStatic()); + $this->assertSame('void myVeryLongMethodName(mixed $node)', (string) $fixture); + $this->assertSame('myVeryLongMethodName', $fixture->getMethodName()); + $this->assertInstanceOf(Void_::class, $fixture->getReturnType()); + } + /** * @return string[][] */