Application bootstrap: fix version check #100
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
develop
ormaster
: try to run theparallel-lint
command and see it fail with a parse error.parallel-lint
command again and see it fail with an informative error message saying that "PHP Parallel Lint requires PHP 5.3.o or newer"