Closed otruffer closed 10 years ago
Hi,
thanks a lot for the first PR.
Please catch Exception instead of InvalidArgumentException, and throw a new PhpParser\Error, like..
} catch (\Exception $e) {
throw new Error($e->getMessage(), $node->getLine());
}
These type of exceptions are catched to skip analysis for current php-file. After analysis you will get a list of catched errors on command line.
See PhpDA\Parser\Visitor\Required for instance.
..and would be nice to have a test to cover this bug.
Hi Thanks for the quick response. I added the Test and implemented it the way you mentioned above. If it is skipping the whole file it seems like a slight overkill as it's only a problem with the DocBlock. And the DocBlock is not per se invalid but PhpDocumentor has a bug when encountering an @ element with a following whitespace anywhere in the doc.
Thanks for contributing, i will merge it. And you are right. We should add a new type of exception for that. Maybe Parser\Warning as a derivate from Parser\Error. Those exceptions should be collectable at the ADT entity and should be also listed at the end of analysis.
If
An \InvalidArgumentException was thrown and not catched which broke the whole process of building dependencies.
The solution in this pull request tries to ignore the Exception as it is a problem of the phpDocumentor library. At the same time it logs the occurrence. This looks quite ugly if used in the command line though. Do you have any suggestions on that?