Skip to content

Commit 20a1c1e

Browse files
Damienbelingherijanpecha
authored andcommitted
Added support for PHP 8.4
1 parent 3ce476c commit 20a1c1e

File tree

10 files changed

+21
-21
lines changed

10 files changed

+21
-21
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
tests:
1414
uses: janpecha/actions/.github/workflows/nette-tester-library.yml@master
1515
with:
16-
phpVersions: '["7.4", "8.0", "8.1", "8.2", "8.3"]'
16+
phpVersions: '["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]'
1717
lowestDependencies: true
1818

1919
coding-style:

src/CommandProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct($mode = self::MODE_DETECT)
3939
* @param array<string, scalar>|NULL $env
4040
* @return string
4141
*/
42-
public function process($app, array $args, array $env = NULL)
42+
public function process($app, array $args, ?array $env = NULL)
4343
{
4444
$cmd = [];
4545

src/Git.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Git
99
protected $runner;
1010

1111

12-
public function __construct(IRunner $runner = NULL)
12+
public function __construct(?IRunner $runner = NULL)
1313
{
1414
$this->runner = $runner !== NULL ? $runner : new Runners\CliRunner;
1515
}
@@ -32,7 +32,7 @@ public function open($directory)
3232
* @return GitRepository
3333
* @throws GitException
3434
*/
35-
public function init($directory, array $params = NULL)
35+
public function init($directory, ?array $params = NULL)
3636
{
3737
if (is_dir("$directory/.git")) {
3838
throw new GitException("Repo already exists in $directory.");
@@ -66,7 +66,7 @@ public function init($directory, array $params = NULL)
6666
* @return GitRepository
6767
* @throws GitException
6868
*/
69-
public function cloneRepository($url, $directory = NULL, array $params = NULL)
69+
public function cloneRepository($url, $directory = NULL, ?array $params = NULL)
7070
{
7171
if ($directory !== NULL && is_dir("$directory/.git")) {
7272
throw new GitException("Repo already exists in $directory.");
@@ -115,7 +115,7 @@ public function cloneRepository($url, $directory = NULL, array $params = NULL)
115115
* @param array<string>|NULL $refs
116116
* @return bool
117117
*/
118-
public function isRemoteUrlReadable($url, array $refs = NULL)
118+
public function isRemoteUrlReadable($url, ?array $refs = NULL)
119119
{
120120
$result = $this->runner->run($this->runner->getCwd(), [
121121
'ls-remote',
@@ -139,7 +139,7 @@ public function isRemoteUrlReadable($url, array $refs = NULL)
139139
* @return RunnerResult
140140
* @throws GitException
141141
*/
142-
private function run($cwd, array $args, array $env = NULL)
142+
private function run($cwd, array $args, ?array $env = NULL)
143143
{
144144
$result = $this->runner->run($cwd, $args, $env);
145145

src/GitRepository.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class GitRepository
1616
* @param string $repository
1717
* @throws GitException
1818
*/
19-
public function __construct($repository, IRunner $runner = NULL)
19+
public function __construct($repository, ?IRunner $runner = NULL)
2020
{
2121
if (basename($repository) === '.git') {
2222
$repository = dirname($repository);
@@ -466,7 +466,7 @@ public function hasChanges()
466466
* @return static
467467
* @throws GitException
468468
*/
469-
public function pull($remote = NULL, array $options = NULL)
469+
public function pull($remote = NULL, ?array $options = NULL)
470470
{
471471
$this->run('pull', $options, '--end-of-options', $remote);
472472
return $this;
@@ -480,7 +480,7 @@ public function pull($remote = NULL, array $options = NULL)
480480
* @return static
481481
* @throws GitException
482482
*/
483-
public function push($remote = NULL, array $options = NULL)
483+
public function push($remote = NULL, ?array $options = NULL)
484484
{
485485
$this->run('push', $options, '--end-of-options', $remote);
486486
return $this;
@@ -494,7 +494,7 @@ public function push($remote = NULL, array $options = NULL)
494494
* @return static
495495
* @throws GitException
496496
*/
497-
public function fetch($remote = NULL, array $options = NULL)
497+
public function fetch($remote = NULL, ?array $options = NULL)
498498
{
499499
$this->run('fetch', $options, '--end-of-options', $remote);
500500
return $this;
@@ -509,7 +509,7 @@ public function fetch($remote = NULL, array $options = NULL)
509509
* @return static
510510
* @throws GitException
511511
*/
512-
public function addRemote($name, $url, array $options = NULL)
512+
public function addRemote($name, $url, ?array $options = NULL)
513513
{
514514
$this->run('remote', 'add', $options, '--end-of-options', $name, $url);
515515
return $this;
@@ -551,7 +551,7 @@ public function removeRemote($name)
551551
* @return static
552552
* @throws GitException
553553
*/
554-
public function setRemoteUrl($name, $url, array $options = NULL)
554+
public function setRemoteUrl($name, $url, ?array $options = NULL)
555555
{
556556
$this->run('remote', 'set-url', $options, '--end-of-options', $name, $url);
557557
return $this;
@@ -593,7 +593,7 @@ public function run(...$args)
593593
* @return string[]|NULL
594594
* @throws GitException
595595
*/
596-
protected function extractFromCommand(array $args, callable $filter = NULL)
596+
protected function extractFromCommand(array $args, ?callable $filter = NULL)
597597
{
598598
$result = $this->run(...$args);
599599
$output = $result->getOutput();

src/IRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface IRunner
1111
* @param array<string, scalar>|NULL $env
1212
* @return RunnerResult
1313
*/
14-
function run($cwd, array $args, array $env = NULL);
14+
function run($cwd, array $args, ?array $env = NULL);
1515

1616

1717
/**

src/Runners/CliRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct($gitBinary = 'git')
3030
/**
3131
* @return RunnerResult
3232
*/
33-
public function run($cwd, array $args, array $env = NULL)
33+
public function run($cwd, array $args, ?array $env = NULL)
3434
{
3535
if (!is_dir($cwd)) {
3636
throw new GitException("Directory '$cwd' not found");

src/Runners/MemoryRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function setResult(array $args, array $env, $output, $errorOutput = [], $
4949
/**
5050
* @return RunnerResult
5151
*/
52-
public function run($cwd, array $args, array $env = NULL)
52+
public function run($cwd, array $args, ?array $env = NULL)
5353
{
5454
$cmd = $this->commandProcessor->process('git', $args, $env);
5555

src/Runners/OldGitRunner.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ class OldGitRunner implements IRunner
1111
private $runner;
1212

1313

14-
public function __construct(IRunner $runner = NULL)
14+
public function __construct(?IRunner $runner = NULL)
1515
{
1616
$this->runner = $runner !== NULL ? $runner : new CliRunner;
1717
}
1818

1919

20-
public function run($cwd, array $args, array $env = NULL)
20+
public function run($cwd, array $args, ?array $env = NULL)
2121
{
2222
if (($key = array_search('--end-of-options', $args)) !== FALSE) {
2323
unset($args[$key]);

src/exceptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GitException extends Exception
1818
* @param string $message
1919
* @param int $code
2020
*/
21-
public function __construct($message, $code = 0, \Exception $previous = NULL, RunnerResult $runnerResult = NULL)
21+
public function __construct($message, $code = 0, ?\Exception $previous = NULL, ?RunnerResult $runnerResult = NULL)
2222
{
2323
parent::__construct($message, $code, $previous);
2424
$this->runnerResult = $runnerResult;

tests/libs/AssertRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function resetAsserts()
5959
/**
6060
* @return RunnerResult
6161
*/
62-
public function run($cwd, array $args, array $env = NULL)
62+
public function run($cwd, array $args, ?array $env = NULL)
6363
{
6464
if (empty($this->asserts)) {
6565
throw new \CzProject\GitPhp\InvalidStateException('Missing asserts, use $runner->assert().');

0 commit comments

Comments
 (0)