-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
PhpDocExtractor::getTypes() throws fatal error when type omitted #25947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,11 @@ public function testExtract($property, array $type = null, $shortDescription, $l | |
$this->assertSame($longDescription, $this->extractor->getLongDescription('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property)); | ||
} | ||
|
||
public function testParamTagTypeIsOmitted() | ||
{ | ||
$this->assertNull($this->extractor->getTypes(OmittedParamTagTypeDocBlock::class, 'omittedType')); | ||
} | ||
|
||
/** | ||
* @dataProvider typesWithCustomPrefixesProvider | ||
*/ | ||
|
@@ -176,3 +181,13 @@ class EmptyDocBlock | |
{ | ||
public $foo; | ||
} | ||
|
||
class OmittedParamTagTypeDocBlock | ||
{ | ||
/** | ||
* @param $omittedTagType | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please remove this docblock, it's not needed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's very much needed; it's the entire point of the test. Currently the PhpDocExtractor throws a fatal error when getting the type from a PHPDoc tag like this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe a comment explaining the point would be valuable here, to prevent somebody "fixing" it later :) |
||
*/ | ||
public function setOmittedType(array $omittedTagType) | ||
{ | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bug doest not exists in 2.7 ?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like
PhpDocExtractor
was added in 2.8, and at that time it handled nulls (albeit differently).f1eb185#diff-72b9199530f645acef692f3d77d4de4dR84
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be a good idea to send an extra PR that adds this test case to the
2.8
branch to prevent regressions there.