From db115c336ac44f8fed6fcc7fb9e8a1c6a2342ae1 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Wed, 2 Mar 2022 00:32:13 +0300 Subject: [PATCH] Added warning when running on old PHP version --- bin/codestyle | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/codestyle b/bin/codestyle index d14f1b7..2b7438c 100644 --- a/bin/codestyle +++ b/bin/codestyle @@ -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 = [ @@ -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());