From e39a2628bb99ef64c3a35422b60c4ac101ffdacb Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Thu, 31 Oct 2024 06:26:24 +0000 Subject: [PATCH] removed deprecation notices on core code to support PHP 8.4 runtime (see gh#215) --- src/Cache.php | 2 +- src/Console/Application.php | 2 +- src/Event/EventDispatcher.php | 2 +- src/Helper/ProcessHelper.php | 4 ++-- src/Process/LintProcess.php | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Cache.php b/src/Cache.php index c538e04a..3825bf6b 100644 --- a/src/Cache.php +++ b/src/Cache.php @@ -43,7 +43,7 @@ final class Cache private int $hits = 0; private int $misses = 0; - public function __construct(string|object $cachePoolAdapter = null) + public function __construct(string|object|null $cachePoolAdapter = null) { if (null === $cachePoolAdapter) { $adapter = new ArrayAdapter(); diff --git a/src/Console/Application.php b/src/Console/Application.php index 341013b2..b77a2aaa 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -47,7 +47,7 @@ public function __construct() parent::__construct(self::NAME, self::getPrettyVersion()); } - public function run(InputInterface $input = null, OutputInterface $output = null): int + public function run(?InputInterface $input = null, ?OutputInterface $output = null): int { $output ??= new ConsoleOutput(STDOUT); diff --git a/src/Event/EventDispatcher.php b/src/Event/EventDispatcher.php index 0425ae66..67ab8a1b 100644 --- a/src/Event/EventDispatcher.php +++ b/src/Event/EventDispatcher.php @@ -36,7 +36,7 @@ public function __construct(iterable $extensions) } } - public function dispatch(object $event, string $eventName = null): object + public function dispatch(object $event, ?string $eventName = null): object { $triggered = false; diff --git a/src/Helper/ProcessHelper.php b/src/Helper/ProcessHelper.php index 39add929..19f0befa 100644 --- a/src/Helper/ProcessHelper.php +++ b/src/Helper/ProcessHelper.php @@ -40,7 +40,7 @@ public function getName(): string public function start( OutputInterface $output, Process $process, - callable $callback = null, + ?callable $callback = null, array $env = [], int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE ): Process { @@ -97,7 +97,7 @@ private function wrapCallback( DebugFormatterHelper $formatter, OutputInterface $output, Process $process, - callable $callback = null + ?callable $callback = null ): callable { return function ($type, $buffer) use ($output, $process, $callback, $formatter) { $output->write( diff --git a/src/Process/LintProcess.php b/src/Process/LintProcess.php index 28fe3c06..c5a3dd16 100644 --- a/src/Process/LintProcess.php +++ b/src/Process/LintProcess.php @@ -40,8 +40,8 @@ final class LintProcess extends Process public function __construct( array $command, - string $cwd = null, - array $env = null, + ?string $cwd = null, + ?array $env = null, mixed $input = null, ?float $timeout = 60 ) { @@ -158,7 +158,7 @@ public function getItem(SplFileInfo $fileInfo): LintProcessItem return (self::$createLintProcessItem)($hasError, $errorString, $errorLine, $hasWarning, $warningString, $warningLine, $fileInfo); } - public function begin(callable $callback = null, array $env = []): void + public function begin(?callable $callback = null, array $env = []): void { if ($this->helper instanceof ProcessHelper) { $this->helper->start($this->output, $this, $callback, $env);