diff --git a/src/CLI/CLI.php b/src/CLI/CLI.php index e8d5e25..8cbfa0a 100644 --- a/src/CLI/CLI.php +++ b/src/CLI/CLI.php @@ -87,7 +87,7 @@ class CLI * * @throws Exception */ - public function __construct(Adapter $adapter = null, array $args = []) + public function __construct(?Adapter $adapter = null, array $args = []) { if (\php_sapi_name() !== 'cli') { throw new Exception('CLI tasks can only work from the command line'); diff --git a/src/CLI/Console.php b/src/CLI/Console.php index 8014859..b025b52 100644 --- a/src/CLI/Console.php +++ b/src/CLI/Console.php @@ -130,7 +130,7 @@ public static function exit(int $status = 0): void * @param int $timeout * @return int */ - public static function execute(array|string $cmd, string $input, string &$output, int $timeout = -1, callable $onProgress = null): int + public static function execute(array|string $cmd, string $input, string &$output, int $timeout = -1, ?callable $onProgress = null): int { // If the $cmd is passed as string, it will be wrapped into a subshell by \proc_open // Forward stdout and exit codes from the subshell. @@ -216,7 +216,7 @@ public static function isInteractive(): bool * * @throws \Exception */ - public static function loop(callable $callback, int $sleep = 1 /* seconds */, int $delay = 0 /* seconds */, callable $onError = null): void + public static function loop(callable $callback, int $sleep = 1 /* seconds */, int $delay = 0 /* seconds */, ?callable $onError = null): void { gc_enable();