Skip to content

Commit

Permalink
Make the version check more informative
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jrfnl authored and grogy committed Mar 3, 2022
1 parent ba8ac48 commit 36233b2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion parallel-lint
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ either expressed or implied, of the FreeBSD Project.
*/

if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300) {
fwrite(STDERR, "PHP Parallel Lint requires PHP 5.3.0 or newer." . PHP_EOL);
fwrite(
STDERR,
sprintf(
'PHP Parallel Lint requires PHP 5.3.0 or newer.' . PHP_EOL
. 'You are using PHP %s (%s).' . PHP_EOL,
PHP_VERSION,
PHP_BINDIR
)
);
exit(254);
}

Expand Down

0 comments on commit 36233b2

Please sign in to comment.