Skip to content

Commit 4e546ee

Browse files
authored
Merge pull request #190 from eliashaeussler/fix/implicit-nullable-types
Add support for PHP 8.4
2 parents de2b2cc + ce90fe1 commit 4e546ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+107
-101
lines changed

.github/workflows/code_style_check.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v2
1414
- uses: shivammathur/setup-php@v2
1515
with:
16-
php-version: 7.3
16+
php-version: 8.1
1717
coverage: none # disable xdebug, pcov
1818
- run: composer install --no-progress
1919
# fix code style, automatically

.github/workflows/tests.yml

+5
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ jobs:
1515
- "8.0"
1616
- "8.1"
1717
- "8.2"
18+
- "8.3"
19+
- "8.4"
1820
symfony:
1921
- 5.*
2022
- 6.*
23+
- 7.*
2124
dependency-version:
2225
# - prefer-lowest
2326
- prefer-stable
2427
exclude:
28+
- {php: "8.0", symfony: "7.*"}
29+
- {php: "8.1", symfony: "7.*"}
2530
- {php: "8.2", symfony: "5.*"}
2631

2732
name: PHP ${{ matrix.php }} - S ${{ matrix.symfony }} - ${{ matrix.dependency-version }} - tests

phpstan.neon

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@ parameters:
33
paths:
44
- src
55
# - tests
6-
6+
77
# things we disable for the moment, but one day...
88
inferPrivatePropertyTypeFromConstructor: true
9-
checkMissingIterableValueType: false
10-
checkGenericClassInNonGenericObjectType: false
119
ignoreErrors:
12-
-
10+
-
1311
message: '#Unsafe usage of new static\(\).#'
1412
path: %currentWorkingDirectory%
1513
-
1614
message: '#Parameter \#1 \$command of class Symfony\\Component\\Process\\Process constructor expects array, string given.#'
1715
path: src/GitElephant/Command/Caller/Caller.php
16+
-
17+
identifier: missingType.iterableValue
18+
-
19+
identifier: missingType.generics
1820

1921
includes:
2022
- vendor/phpstan/phpstan-phpunit/extension.neon

src/GitElephant/Command/BaseCommand.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ class BaseCommand
7676
/**
7777
* the command subject
7878
*
79-
* @var string|SubCommandCommand|null
79+
* @var array|string|SubCommandCommand|null
8080
*/
8181
private $commandSubject = null;
8282

8383
/**
8484
* the command second subject (i.e. for branch)
8585
*
86-
* @var string|SubCommandCommand|null
86+
* @var array|string|SubCommandCommand|null
8787
*/
8888
private $commandSubject2 = null;
8989

@@ -112,7 +112,7 @@ class BaseCommand
112112
*
113113
* @param null|\GitElephant\Repository $repo The repo object to read
114114
*/
115-
public function __construct(Repository $repo = null)
115+
public function __construct(?Repository $repo = null)
116116
{
117117
if (!is_null($repo)) {
118118
$this->addGlobalConfigs($repo->getGlobalConfigs());
@@ -148,7 +148,7 @@ public function clearAll(): void
148148
* @param Repository $repo
149149
* @return static
150150
*/
151-
public static function getInstance(Repository $repo = null)
151+
public static function getInstance(?Repository $repo = null)
152152
{
153153
return new static($repo);
154154
}

src/GitElephant/Command/BranchCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class BranchCommand extends BaseCommand
3737
* @param \GitElephant\Repository $repo The repository object this command
3838
* will interact with
3939
*/
40-
public function __construct(Repository $repo = null)
40+
public function __construct(?Repository $repo = null)
4141
{
4242
parent::__construct($repo);
4343
}
@@ -69,7 +69,7 @@ public function contains(string $reference): string
6969
* @throws \RuntimeException
7070
* @return string the command
7171
*/
72-
public function create(string $name, string $startPoint = null): string
72+
public function create(string $name, ?string $startPoint = null): string
7373
{
7474
$this->clearAll();
7575
$this->addCommandName(self::BRANCH_COMMAND);

src/GitElephant/Command/Caller/Caller.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function __construct($gitPath, $repositoryPath)
7575
public function execute(
7676
string $cmd,
7777
bool $git = true,
78-
string $cwd = null,
78+
?string $cwd = null,
7979
array $acceptedExitCodes = [0]
8080
): CallerInterface {
8181
if ($git) {
@@ -107,7 +107,7 @@ public function execute(
107107
$text .= "\n" . $process->getOutput();
108108
throw new \RuntimeException($text);
109109
}
110-
110+
111111
$this->rawOutput = $process->getOutput();
112112
// rtrim values
113113
$values = array_map('rtrim', explode(PHP_EOL, $process->getOutput()));

src/GitElephant/Command/Caller/CallerInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ interface CallerInterface
3737
public function execute(
3838
string $cmd,
3939
bool $git = true,
40-
string $cwd = null
40+
?string $cwd = null
4141
): CallerInterface;
4242

4343
/**

src/GitElephant/Command/CatFileCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CatFileCommand extends BaseCommand
3939
* @param \GitElephant\Repository $repo The repository object this command
4040
* will interact with
4141
*/
42-
public function __construct(Repository $repo = null)
42+
public function __construct(?Repository $repo = null)
4343
{
4444
parent::__construct($repo);
4545
}

src/GitElephant/Command/CloneCommand.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CloneCommand extends BaseCommand
3838
* @param \GitElephant\Repository $repo The repository object this command
3939
* will interact with
4040
*/
41-
public function __construct(Repository $repo = null)
41+
public function __construct(?Repository $repo = null)
4242
{
4343
parent::__construct($repo);
4444
}
@@ -57,9 +57,9 @@ public function __construct(Repository $repo = null)
5757
*/
5858
public function cloneUrl(
5959
string $url,
60-
string $to = null,
61-
string $repoReference = null,
62-
int $depth = null,
60+
?string $to = null,
61+
?string $repoReference = null,
62+
?int $depth = null,
6363
bool $recursive = false
6464
): string {
6565
// get binary version before reset
@@ -90,7 +90,7 @@ public function cloneUrl(
9090
$this->addCommandArgument('--shallow-submodules');
9191
}
9292
}
93-
93+
9494
if ($recursive) {
9595
$this->addCommandArgument('--recursive');
9696
}

src/GitElephant/Command/DiffCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class DiffCommand extends BaseCommand
3838
* @param \GitElephant\Repository $repo The repository object this command
3939
* will interact with
4040
*/
41-
public function __construct(Repository $repo = null)
41+
public function __construct(?Repository $repo = null)
4242
{
4343
parent::__construct($repo);
4444
}

src/GitElephant/Command/DiffTreeCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DiffTreeCommand extends BaseCommand
4040
* @param \GitElephant\Repository $repo The repository object this command
4141
* will interact with
4242
*/
43-
public function __construct(Repository $repo = null)
43+
public function __construct(?Repository $repo = null)
4444
{
4545
parent::__construct($repo);
4646
}

src/GitElephant/Command/FetchCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class FetchCommand extends BaseCommand
3838
* @param \GitElephant\Repository $repo The repository object this command
3939
* will interact with
4040
*/
41-
public function __construct(Repository $repo = null)
41+
public function __construct(?Repository $repo = null)
4242
{
4343
parent::__construct($repo);
4444
}
@@ -68,7 +68,7 @@ public function fetch($remote = null, $branch = null, array $options = []): stri
6868
foreach ($normalizedOptions as $value) {
6969
$this->addCommandArgument($value);
7070
}
71-
71+
7272
if (!is_null($remote)) {
7373
$this->addCommandSubject($remote);
7474
}

src/GitElephant/Command/LogCommand.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class LogCommand extends BaseCommand
4141
* @param \GitElephant\Repository $repo The repository object this command
4242
* will interact with
4343
*/
44-
public function __construct(Repository $repo = null)
44+
public function __construct(?Repository $repo = null)
4545
{
4646
parent::__construct($repo);
4747
}
@@ -57,7 +57,7 @@ public function __construct(Repository $repo = null)
5757
* @throws \RuntimeException
5858
* @return string
5959
*/
60-
public function showObjectLog(NodeObject $obj, $branch = null, int $limit = null, int $offset = null): string
60+
public function showObjectLog(NodeObject $obj, $branch = null, ?int $limit = null, ?int $offset = null): string
6161
{
6262
$subject = null;
6363
if (null !== $branch) {
@@ -84,7 +84,7 @@ public function showObjectLog(NodeObject $obj, $branch = null, int $limit = null
8484
* @throws \RuntimeException
8585
* @return string
8686
*/
87-
public function showLog($ref, $path = null, $limit = null, int $offset = null, bool $firstParent = false): string
87+
public function showLog($ref, $path = null, $limit = null, ?int $offset = null, bool $firstParent = false): string
8888
{
8989
$this->clearAll();
9090

@@ -114,7 +114,7 @@ public function showLog($ref, $path = null, $limit = null, int $offset = null, b
114114
if (null !== $path && !empty($path)) {
115115
$this->addPath($path);
116116
}
117-
117+
118118
$this->addCommandSubject($ref);
119119

120120
return $this->getCommand();

src/GitElephant/Command/LogRangeCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class LogRangeCommand extends BaseCommand
3535
* @param \GitElephant\Repository $repo The repository object this command
3636
* will interact with
3737
*/
38-
public function __construct(Repository $repo = null)
38+
public function __construct(?Repository $repo = null)
3939
{
4040
parent::__construct($repo);
4141
}
@@ -94,7 +94,7 @@ public function showLog(
9494
if (null !== $path && !empty($path)) {
9595
$this->addPath($path);
9696
}
97-
97+
9898
$this->addCommandSubject($refStart . '..' . $refEnd);
9999

100100
return $this->getCommand();

src/GitElephant/Command/LsTreeCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class LsTreeCommand extends BaseCommand
4040
* @param \GitElephant\Repository $repo The repository object this command
4141
* will interact with
4242
*/
43-
public function __construct(Repository $repo = null)
43+
public function __construct(?Repository $repo = null)
4444
{
4545
parent::__construct($repo);
4646
}

src/GitElephant/Command/MainCommand.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class MainCommand extends BaseCommand
4747
* @param \GitElephant\Repository $repo The repository object this command
4848
* will interact with
4949
*/
50-
public function __construct(Repository $repo = null)
50+
public function __construct(?Repository $repo = null)
5151
{
5252
parent::__construct($repo);
5353
}
@@ -149,7 +149,7 @@ public function commit(
149149
bool $stageAll = false,
150150
$author = null,
151151
bool $allowEmpty = false,
152-
\DateTimeInterface $date = null
152+
?\DateTimeInterface $date = null
153153
): string {
154154
$this->clearAll();
155155

@@ -170,7 +170,7 @@ public function commit(
170170
if ($allowEmpty) {
171171
$this->addCommandArgument('--allow-empty');
172172
}
173-
173+
174174
if (null !== $date) {
175175
$this->addCommandArgument('--date');
176176
$this->addCommandArgument($date->format(\DateTimeInterface::RFC822));

src/GitElephant/Command/MergeCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class MergeCommand extends BaseCommand
4040
* @param \GitElephant\Repository $repo The repository object this command
4141
* will interact with
4242
*/
43-
public function __construct(Repository $repo = null)
43+
public function __construct(?Repository $repo = null)
4444
{
4545
parent::__construct($repo);
4646
}
@@ -76,7 +76,7 @@ public function merge(Branch $with, $message = '', array $options = []): string
7676
$this->addCommandArgument('-m');
7777
$this->addCommandArgument($message);
7878
}
79-
79+
8080
$this->addCommandSubject($with->getFullRef());
8181

8282
return $this->getCommand();

src/GitElephant/Command/MvCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class MvCommand extends BaseCommand
3838
* @param \GitElephant\Repository $repo The repository object this command
3939
* will interact with
4040
*/
41-
public function __construct(Repository $repo = null)
41+
public function __construct(?Repository $repo = null)
4242
{
4343
parent::__construct($repo);
4444
}

src/GitElephant/Command/PullCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PullCommand extends BaseCommand
3737
* @param \GitElephant\Repository $repo The repository object this command
3838
* will interact with
3939
*/
40-
public function __construct(Repository $repo = null)
40+
public function __construct(?Repository $repo = null)
4141
{
4242
parent::__construct($repo);
4343
}

src/GitElephant/Command/PushCommand.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PushCommand extends BaseCommand
3737
* @param \GitElephant\Repository $repo The repository object this command
3838
* will interact with
3939
*/
40-
public function __construct(Repository $repo = null)
40+
public function __construct(?Repository $repo = null)
4141
{
4242
parent::__construct($repo);
4343
}
@@ -49,7 +49,7 @@ public function __construct(Repository $repo = null)
4949
* @throws \RuntimeException
5050
* @return string
5151
*/
52-
public function push($remote = 'origin', $branch = 'master', string $args = null): string
52+
public function push($remote = 'origin', $branch = 'master', ?string $args = null): string
5353
{
5454
$this->clearAll();
5555

@@ -63,7 +63,7 @@ public function push($remote = 'origin', $branch = 'master', string $args = null
6363
$this->addCommandName(self::GIT_PUSH_COMMAND);
6464
$this->addCommandSubject($remote);
6565
$this->addCommandSubject2($branch);
66-
66+
6767
if (!is_null($args)) {
6868
$this->addCommandArgument($args);
6969
}

src/GitElephant/Command/Remote/AddSubCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class AddSubCommand extends SubCommandCommand
4848
* @param \GitElephant\Repository $repo The repository object this command
4949
* will interact with
5050
*/
51-
public function __construct(Repository $repo = null)
51+
public function __construct(?Repository $repo = null)
5252
{
5353
parent::__construct($repo);
5454
}
@@ -97,7 +97,7 @@ public function prepare($name, $url, $options = []): self
9797
$this->addCmdSwitchOptions(),
9898
$this->addCmdValueOptions()
9999
);
100-
100+
101101
$this->addCommandName(self::GIT_REMOTE_ADD);
102102
$this->addCommandSubject($name);
103103
$this->addCommandSubject($url);

src/GitElephant/Command/Remote/ShowSubCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ShowSubCommand extends SubCommandCommand
4242
* @param \GitElephant\Repository $repo The repository object this command
4343
* will interact with
4444
*/
45-
public function __construct(Repository $repo = null)
45+
public function __construct(?Repository $repo = null)
4646
{
4747
parent::__construct($repo);
4848
}
@@ -69,7 +69,7 @@ public function prepare($name = null, $queryRemotes = true): self
6969
if ($name) {
7070
$this->addCommandSubject($name);
7171
}
72-
72+
7373
if (!$queryRemotes) {
7474
$this->addCommandArgument('-n');
7575
}

0 commit comments

Comments
 (0)