diff --git a/Jenkinsfile b/Jenkinsfile index 1b7c9715..47f58808 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { stage('Code Cleanliness') { agent any steps { - sh "php8 ./vendor/bin/phpstan analyse -c phpstan.neon -n --no-progress --no-ansi --error-format=checkstyle | awk '{\$1=\$1;print}' > build/logs/phpstan.log" + sh "php ./vendor/bin/phpstan analyse -c phpstan.neon -n --no-progress --no-ansi --error-format=checkstyle | awk '{\$1=\$1;print}' > build/logs/phpstan.log" recordIssues( failOnError: false, tools: [phpStan(reportEncoding: 'UTF-8', pattern: 'build/logs/phpstan.log')] diff --git a/console b/console index fb69e144..7c4260cb 100755 --- a/console +++ b/console @@ -26,7 +26,7 @@ try 'sync:lists' => Command\SyncLists::class ]))->run(); } -catch (\Exception $e) +catch (\Throwable) { } diff --git a/index.php b/index.php index 0aa93974..598a5604 100644 --- a/index.php +++ b/index.php @@ -17,9 +17,9 @@ namespace Aviat\AnimeClient; use Aviat\AnimeClient\Types\Config as ConfigType; -use Whoops\Handler\PrettyPageHandler; +use Whoops\Handler; use Whoops\Run; - +use Whoops\Util; use function Aviat\Ion\_dir; setlocale(LC_CTYPE, 'en_US'); @@ -30,7 +30,12 @@ require_once __DIR__ . '/vendor/autoload.php'; if (file_exists('.is-dev')) { $whoops = new Run; - $whoops->pushHandler(new PrettyPageHandler); + $whoops->pushHandler(new Handler\PrettyPageHandler); + + if (Util\Misc::isAjaxRequest()) { + $whoops->pushHandler(new Handler\JsonResponseHandler); + } + $whoops->register(); } diff --git a/src/AnimeClient/Command/BaseCommand.php b/src/AnimeClient/Command/BaseCommand.php index f05d2a60..3451972f 100644 --- a/src/AnimeClient/Command/BaseCommand.php +++ b/src/AnimeClient/Command/BaseCommand.php @@ -61,14 +61,16 @@ abstract class BaseCommand extends Command { if ($fgColor !== NULL) { - $fgColor = (string)$fgColor; + $fgColor = (int)$fgColor; } if ($bgColor !== NULL) { - $bgColor = (string)$bgColor; + $bgColor = (int)$bgColor; } - // color message + // Colorize the CLI output + // the documented type for the function is wrong + // @phpstan-ignore-next-line $message = Colors::colorize($message, $fgColor, $bgColor); // create the box