From 2ad0f1a279cf4ba28c560a5be1e568ca2aa77471 Mon Sep 17 00:00:00 2001 From: Damien Date: Mon, 20 Jan 2025 18:21:13 +0100 Subject: [PATCH] Deprecations php 8.4 --- src/CommandProcessor.php | 2 +- src/GitRepository.php | 14 +++++++------- src/Runners/CliRunner.php | 2 +- src/Runners/MemoryRunner.php | 2 +- src/Runners/OldGitRunner.php | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/CommandProcessor.php b/src/CommandProcessor.php index 83372b3..7f57e4c 100644 --- a/src/CommandProcessor.php +++ b/src/CommandProcessor.php @@ -39,7 +39,7 @@ public function __construct($mode = self::MODE_DETECT) * @param array|NULL $env * @return string */ - public function process($app, array $args, array $env = NULL) + public function process($app, array $args, ?array $env = NULL) { $cmd = []; diff --git a/src/GitRepository.php b/src/GitRepository.php index cd8d5fa..b408c50 100644 --- a/src/GitRepository.php +++ b/src/GitRepository.php @@ -16,7 +16,7 @@ class GitRepository * @param string $repository * @throws GitException */ - public function __construct($repository, IRunner $runner = NULL) + public function __construct($repository, ?IRunner $runner = NULL) { if (basename($repository) === '.git') { $repository = dirname($repository); @@ -466,7 +466,7 @@ public function hasChanges() * @return static * @throws GitException */ - public function pull($remote = NULL, array $options = NULL) + public function pull($remote = NULL, ?array $options = NULL) { $this->run('pull', $options, '--end-of-options', $remote); return $this; @@ -480,7 +480,7 @@ public function pull($remote = NULL, array $options = NULL) * @return static * @throws GitException */ - public function push($remote = NULL, array $options = NULL) + public function push($remote = NULL, ?array $options = NULL) { $this->run('push', $options, '--end-of-options', $remote); return $this; @@ -494,7 +494,7 @@ public function push($remote = NULL, array $options = NULL) * @return static * @throws GitException */ - public function fetch($remote = NULL, array $options = NULL) + public function fetch($remote = NULL, ?array $options = NULL) { $this->run('fetch', $options, '--end-of-options', $remote); return $this; @@ -509,7 +509,7 @@ public function fetch($remote = NULL, array $options = NULL) * @return static * @throws GitException */ - public function addRemote($name, $url, array $options = NULL) + public function addRemote($name, $url, ?array $options = NULL) { $this->run('remote', 'add', $options, '--end-of-options', $name, $url); return $this; @@ -551,7 +551,7 @@ public function removeRemote($name) * @return static * @throws GitException */ - public function setRemoteUrl($name, $url, array $options = NULL) + public function setRemoteUrl($name, $url, ?array $options = NULL) { $this->run('remote', 'set-url', $options, '--end-of-options', $name, $url); return $this; @@ -593,7 +593,7 @@ public function run(...$args) * @return string[]|NULL * @throws GitException */ - protected function extractFromCommand(array $args, callable $filter = NULL) + protected function extractFromCommand(array $args, ?callable $filter = NULL) { $result = $this->run(...$args); $output = $result->getOutput(); diff --git a/src/Runners/CliRunner.php b/src/Runners/CliRunner.php index 462e61c..4850e6a 100644 --- a/src/Runners/CliRunner.php +++ b/src/Runners/CliRunner.php @@ -30,7 +30,7 @@ public function __construct($gitBinary = 'git') /** * @return RunnerResult */ - public function run($cwd, array $args, array $env = NULL) + public function run($cwd, array $args, ?array $env = NULL) { if (!is_dir($cwd)) { throw new GitException("Directory '$cwd' not found"); diff --git a/src/Runners/MemoryRunner.php b/src/Runners/MemoryRunner.php index 4982c9c..fb28523 100644 --- a/src/Runners/MemoryRunner.php +++ b/src/Runners/MemoryRunner.php @@ -49,7 +49,7 @@ public function setResult(array $args, array $env, $output, $errorOutput = [], $ /** * @return RunnerResult */ - public function run($cwd, array $args, array $env = NULL) + public function run($cwd, array $args, ?array $env = NULL) { $cmd = $this->commandProcessor->process('git', $args, $env); diff --git a/src/Runners/OldGitRunner.php b/src/Runners/OldGitRunner.php index cb07136..54be04b 100644 --- a/src/Runners/OldGitRunner.php +++ b/src/Runners/OldGitRunner.php @@ -17,7 +17,7 @@ public function __construct(IRunner $runner = NULL) } - public function run($cwd, array $args, array $env = NULL) + public function run($cwd, array $args, ?array $env = NULL) { if (($key = array_search('--end-of-options', $args)) !== FALSE) { unset($args[$key]);