When programming, lint checking your source code can be useful to detect low level issues like syntax errors, undefined or unused variables. The PHP command line interpreter has an option
--syntax-check to do a syntax check of the provided PHP file, instead of executing it:
$ php -l file_with_syntax_error.php PHP Parse error: syntax error, unexpected T_VARIABLE in file_with_syntax_error.php on line 5 Errors parsing file_with_syntax_error.php
Unfortunately, it only allows to check one file at a time. For example, the following does not work as expected:
$ php -l file1.php file2.php file_with_syntax_error.php No syntax errors detected in file1.php
If you want to lint-check (a complete tree of) multiple PHP files, you have to use some kind of loop (e.g. in Bash) to check them one by one.
I recently was faced with this issue, but also wanted to have some parallelism, to speed up the process by putting multiple cores a work, instead of checking one file at a time. After googling a bit I found the following (command line) solutions.