Skip to content

Commit a7994f7

Browse files
authored
Merge pull request #10: Fix PHP 8.4 deprecations
1 parent 03ae291 commit a7994f7

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

src/Environment/Native.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
final class Native implements EnvironmentInterface
88
{
99
public function __construct(
10-
private array $values = []
10+
private array $values = [],
1111
) {
1212
$this->values = $values + $_ENV + $_SERVER;
1313
}

src/Exception/UnsupportedVersionException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class UnsupportedVersionException extends VersionCheckerException
1414
public function __construct(
1515
string $message,
1616
private string $installed,
17-
private string $requested
17+
private string $requested,
1818
) {
1919
parent::__construct($message);
2020
}

src/Version/Comparator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class Comparator implements ComparatorInterface
1111
{
1212
private VersionParser $parser;
1313

14-
public function __construct(VersionParser $parser = null)
14+
public function __construct(?VersionParser $parser = null)
1515
{
1616
$this->parser = $parser ?? new VersionParser();
1717
}
@@ -24,7 +24,7 @@ public function greaterThan(string $requested, string $installed): bool
2424
{
2525
return SemverComparator::greaterThanOrEqualTo(
2626
$this->parser->normalize($installed),
27-
$this->parser->normalize($requested)
27+
$this->parser->normalize($requested),
2828
);
2929
}
3030

@@ -36,7 +36,7 @@ public function lessThan(string $requested, string $installed): bool
3636
{
3737
return SemverComparator::lessThanOrEqualTo(
3838
$this->parser->normalize($installed),
39-
$this->parser->normalize($requested)
39+
$this->parser->normalize($requested),
4040
);
4141
}
4242

@@ -48,7 +48,7 @@ public function equal(string $requested, string $installed): bool
4848
{
4949
return SemverComparator::equalTo(
5050
$this->parser->normalize($installed),
51-
$this->parser->normalize($requested)
51+
$this->parser->normalize($requested),
5252
);
5353
}
5454
}

src/Version/Installed.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ final class Installed implements InstalledInterface
2727
* @param non-empty-string $executablePath
2828
*/
2929
public function __construct(
30-
ProcessInterface $process = null,
31-
EnvironmentInterface $environment = null,
32-
private string $executablePath = './rr'
30+
?ProcessInterface $process = null,
31+
?EnvironmentInterface $environment = null,
32+
private string $executablePath = './rr',
3333
) {
3434
$this->process = $process ?? new Process();
3535
$this->environment = $environment ?? new Native();
@@ -86,7 +86,7 @@ private function getVersionFromConsoleCommand(): ?string
8686
' If RoadRunner is installed in a different path, pass the correct `executablePath` parameter to the' .
8787
' `%s` class constructor.',
8888
$this->executablePath,
89-
self::class
89+
self::class,
9090
));
9191
}
9292

src/Version/Required.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class Required implements RequiredInterface
1919

2020
private PackageInterface $package;
2121

22-
public function __construct(PackageInterface $package = null)
22+
public function __construct(?PackageInterface $package = null)
2323
{
2424
$this->package = $package ?? new Package();
2525
}

src/VersionChecker.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ final class VersionChecker
2121
private ComparatorInterface $comparator;
2222

2323
public function __construct(
24-
InstalledInterface $installedVersion = null,
25-
RequiredInterface $requiredVersion = null,
26-
ComparatorInterface $comparator = null
24+
?InstalledInterface $installedVersion = null,
25+
?RequiredInterface $requiredVersion = null,
26+
?ComparatorInterface $comparator = null,
2727
) {
2828
$this->installedVersion = $installedVersion ?? new Installed();
2929
$this->requiredVersion = $requiredVersion ?? new Required();
@@ -46,7 +46,7 @@ public function greaterThan(?string $version = null): void
4646
if (empty($version)) {
4747
throw new RequiredVersionException(
4848
'Unable to determine required RoadRunner version.' .
49-
' Please specify the required version in the `$version` parameter.'
49+
' Please specify the required version in the `$version` parameter.',
5050
);
5151
}
5252

@@ -56,7 +56,7 @@ public function greaterThan(?string $version = null): void
5656
throw new UnsupportedVersionException($this->getFormattedMessage(
5757
'Installed RoadRunner version `%s` not supported. Requires version `%s` or higher.',
5858
$installedVersion,
59-
$version
59+
$version,
6060
), $installedVersion, $version);
6161
}
6262
}
@@ -75,7 +75,7 @@ public function lessThan(string $version): void
7575
throw new UnsupportedVersionException($this->getFormattedMessage(
7676
'Installed RoadRunner version `%s` not supported. Requires version `%s` or lower.',
7777
$installedVersion,
78-
$version
78+
$version,
7979
), $installedVersion, $version);
8080
}
8181
}
@@ -94,7 +94,7 @@ public function equal(string $version): void
9494
throw new UnsupportedVersionException($this->getFormattedMessage(
9595
'Installed RoadRunner version `%s` not supported. Requires version `%s`.',
9696
$installedVersion,
97-
$version
97+
$version,
9898
), $installedVersion, $version);
9999
}
100100
}

0 commit comments

Comments
 (0)