Skip to content

Commit

Permalink
feat: add warning if PHP version is too low
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Jul 21, 2023
1 parent 7ea3d14 commit a8caca8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rock
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() . "</>");
}

0 comments on commit a8caca8

Please sign in to comment.