php-parallel-lint / PHP-Parallel-Lint

This tool check syntax of PHP files faster than serial check with fancier output.
Other
282 stars 21 forks source link

Application bootstrap: fix version check #100

Closed jrfnl closed 2 years ago

jrfnl commented 2 years ago

Allow version check in application entry file to work

As reported in #62, the "version check" for PHP < 5.3 in the application bootstrap did not work as the code in file would cause a parse error when run on PHP < 5.3.

By putting the class name, which contains PHP 5.3 namespace separator tokens, as a variable and then dynamically calling the class, the parse error on PHP < 5.3 is prevented and the version check at the top of the file can work as expected.

Fixes #62

Note: this is not something which can really be unit tested as this concerns the application bootstrap file. An integration test would be an option, but then, this integration test would need to be run against PHP 5.2 (or lower) in a workflow. Adding a setup for this is outside the scope of this PR.

Make the version check more informative

Previously, the PHP version check run at the start of the script would display PHP Parallel Lint requires PHP 5.3.0 or newer. if the PHP version was too low.

The message has been updated to include the currently detected PHP version and the path to the PHP binary.

Note: both constants used are available in PHP cross-version

Testing the PR

grogy commented 2 years ago

Thank you, this is elegant solution :-)