Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added warning when running on old PHP version #66

Merged
merged 1 commit into from Mar 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion bin/codestyle
Expand Up @@ -7,6 +7,12 @@ use DragonCode\CodeStyler\Commands\EditorConfig;
use DragonCode\CodeStyler\Commands\Fix;
use Symfony\Component\Console\Application;

if (PHP_SAPI !== 'cli' || PHP_MAJOR_VERSION < 8) {
echo 'Warning: codestyle should be invoked via the CLI minimum version of PHP 8.0.0, not the ' . PHP_SAPI . ' ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;

exit(1);
}

error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);

$possible_files = [
Expand All @@ -30,7 +36,7 @@ if (is_null($file)) {

require_once $file;

$application = new Application('PHP Code Styler');
$application = new Application('The Dragon Code Styler');

$application->add(new Check());
$application->add(new Fix());
Expand Down