Skip to content
This repository was archived by the owner on Dec 29, 2020. It is now read-only.

Avoid exception when superclass is null and no docblock is provided for a method #5

Merged
merged 1 commit into from
Nov 16, 2015

Conversation

meyerbaptiste
Copy link
Contributor

When a class does not have parent and no docblock is provided for a method, Class_::getParent() method returns null so an exception is thrown:

PHP Fatal error:  Uncaught TypeError: Argument 2 passed to Dunglas\PhpDocToTypeHint\Converter::getObject() must be an instance of phpDocumentor\Reflection\Fqsen, null given, called in /Users/meyerb/workspace/phpdoc-to-typehint/src/Converter.php on line 287 and defined in /Users/meyerb/workspace/phpdoc-to-typehint/src/Converter.php:325
Stack trace:
#0 /Users/meyerb/workspace/phpdoc-to-typehint/src/Converter.php(287): Dunglas\PhpDocToTypeHint\Converter->getObject(Object(phpDocumentor\Reflection\Php\Project), NULL, 0)
#1 /Users/meyerb/workspace/phpdoc-to-typehint/src/Converter.php(425): Dunglas\PhpDocToTypeHint\Converter->getDocBlock(Object(phpDocumentor\Reflection\Php\Project), 0, NULL, 'ElePHPant', '__construct')
#2 /Users/meyerb/workspace/phpdoc-to-typehint/src/Converter.php(105): Dunglas\PhpDocToTypeHint\Converter->getReturn(Object(phpDocumentor\Reflection\Php\Project), 0, NULL, 'ElePHPant', '__construct')
#3 /Users/meyerb/workspace/phpdoc-to-typehint/src/ConvertCommand.php(90): Dunglas\PhpDocToTypeHint\Converter->convert(Obj in /Users/meyerb/workspace/phpdoc-to-typehint/src/Converter.php on line 325

@meyerbaptiste meyerbaptiste changed the title Avoid exception when superclass is null and no doc block is provided for a method Avoid exception when superclass is null and no docblock is provided for a method Nov 16, 2015
dunglas added a commit that referenced this pull request Nov 16, 2015
Avoid exception when superclass is null and no docblock is provided for a method
@dunglas dunglas merged commit 3d8879b into dunglas:master Nov 16, 2015
@dunglas
Copy link
Owner

dunglas commented Nov 16, 2015

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants