Parser error
rockoo opened this issue · 5 comments
There is some failure half through analysis and it throws the following exception:
.PHP Fatal error: Uncaught PhpParser\Error: Unexpected null byte on line 1 in ...vendor/nikic/php-parser/lib/PhpParser/Lexer.php:100
Thanks @rockoo for the bug report. This seems to be the problem I found in #1. It basically means the file you are checking is not a valid php file.
For #1 I will improve how these exceptions are handled. Do you mind if I ask you to try the same run again after I have fixed it, to see if that also fixes this issue?
I had the same issue when running this on my entire project. I'm using a custom framework that includes php files, js files, html files, etc.
By specifying the directory/file I want to scan I avoid this error.
Example:
$vendor/bin/php-doc-check -d /Users/myuser/Documents/projects/myproject/private/Models
This scans my entire Models directory which contains only PHP files, hence no invalid php file errors
Hi @rockoo, @petardfoozer
The fix of #1 is now merged and should also resolve this issue. Could you retry the command that failed before, to see if it no longer crashes on unparsable files?
I am considering this fixed.
@NielsdeBlaauw thank you for fast response and sorry for my late reply. For some reason I didnt get an email nor it showed me notification.
It is fixed! Thank you