-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add warning if PHP version is too low
- Loading branch information
1 parent
7ea3d14
commit a8caca8
Showing
1 changed file
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
use Symfony\Component\Console\Output\ConsoleOutput; | ||
require __DIR__.'/vendor/autoload.php'; | ||
|
||
require __DIR__ . '/vendor/autoload.php'; | ||
$app = new \RockShell\Application(); | ||
$app->registerCommands(); | ||
try { | ||
if (version_compare(phpversion(), '8.0', '<')) { | ||
throw new Exception( | ||
"PHP Version must be at least 8.0 - your version is " . phpversion() | ||
); | ||
} | ||
$app->run(); | ||
} catch (\Throwable $th) { | ||
$output = new ConsoleOutput(); | ||
$output->writeln("<bg=red;options=bold>".$th->getMessage()."</>"); | ||
$output->writeln("<bg=red;options=bold>" . $th->getMessage() . "</>"); | ||
} |