diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 88e1b424..79968eaf 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,8 @@ -on: push +on: + push: + branches: + - master + pull_request: name: Qa workflow jobs: setup: diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index c7a00e4d..dbb2eba4 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -111,13 +111,7 @@ public static function create( # Return type (?: ( - (?:[\w\|_\\\\]*\$this[\w\|_\\\\]*) - | - (?: - (?:[\w\|_\\\\]+) - # array notation - (?:\[\])* - )* + [^\s]+ ) \s+ )? diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index 03bd1b61..8156d07e 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -342,6 +342,37 @@ public function testReturnTypeThis() : void $this->assertInstanceOf(This::class, $fixture->getReturnType()); } + /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public> + * @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[][] */