Skip to content

Commit fe72acb

Browse files
authored
feat: Fix PHP 8.4 deprecations (#238)
* feat(dx): Split commands in Dockerfile to individual RUN to improve caching * feat: Explicitly mark formatter as nullable * chore: Change Dockerfile
1 parent 920014a commit fe72acb

11 files changed

+15
-15
lines changed

src/Bolt/BoltDriver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function __construct(
6565
*
6666
* @psalm-suppress MixedReturnTypeCoercion
6767
*/
68-
public static function create(string|UriInterface $uri, ?DriverConfiguration $configuration = null, ?AuthenticateInterface $authenticate = null, FormatterInterface $formatter = null): self
68+
public static function create(string|UriInterface $uri, ?DriverConfiguration $configuration = null, ?AuthenticateInterface $authenticate = null, ?FormatterInterface $formatter = null): self
6969
{
7070
if (is_string($uri)) {
7171
$uri = Uri::create($uri);

src/Bolt/Session.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function runStatements(iterable $statements, ?TransactionConfiguration $c
7979
/**
8080
* @param iterable<Statement>|null $statements
8181
*/
82-
public function openTransaction(iterable $statements = null, ?TransactionConfiguration $config = null): UnmanagedTransactionInterface
82+
public function openTransaction(?iterable $statements = null, ?TransactionConfiguration $config = null): UnmanagedTransactionInterface
8383
{
8484
return $this->beginTransaction($statements, $this->mergeTsxConfig($config));
8585
}

src/Common/GeneratorHelper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class GeneratorHelper
3030
*
3131
* @return T
3232
*/
33-
public static function getReturnFromGenerator(Generator $generator, float $timeout = null)
33+
public static function getReturnFromGenerator(Generator $generator, ?float $timeout = null)
3434
{
3535
$start = microtime(true);
3636
while ($generator->valid()) {

src/Databags/HttpPsrBindings.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class HttpPsrBindings
4747
* @param callable():StreamFactoryInterface|StreamFactoryInterface|null $streamFactory
4848
* @param callable():RequestFactoryInterface|RequestFactoryInterface|null $requestFactory
4949
*/
50-
public function __construct(callable|ClientInterface|null $client = null, callable|StreamFactoryInterface $streamFactory = null, callable|RequestFactoryInterface $requestFactory = null)
50+
public function __construct(callable|ClientInterface|null $client = null, callable|StreamFactoryInterface|null $streamFactory = null, callable|RequestFactoryInterface|null $requestFactory = null)
5151
{
5252
$this->client = $client ?? static fn (): ClientInterface => Psr18ClientDiscovery::find();
5353
$this->streamFactory = $streamFactory ?? static fn (): StreamFactoryInterface => Psr17FactoryDiscovery::findStreamFactory();
@@ -61,7 +61,7 @@ public function __construct(callable|ClientInterface|null $client = null, callab
6161
* @param callable():StreamFactoryInterface|StreamFactoryInterface|null $streamFactory
6262
* @param callable():RequestFactoryInterface|RequestFactoryInterface|null $requestFactory
6363
*/
64-
public static function create(callable|ClientInterface $client = null, callable|StreamFactoryInterface $streamFactory = null, callable|RequestFactoryInterface $requestFactory = null): self
64+
public static function create(callable|ClientInterface|null $client = null, callable|StreamFactoryInterface|null $streamFactory = null, callable|RequestFactoryInterface|null $requestFactory = null): self
6565
{
6666
return new self($client, $streamFactory, $requestFactory);
6767
}

src/DriverFactory.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ final class DriverFactory
4646
* : DriverInterface<OGMResults>
4747
* )
4848
*/
49-
public static function create(string|UriInterface $uri, ?DriverConfiguration $configuration = null, ?AuthenticateInterface $authenticate = null, FormatterInterface $formatter = null, ?string $logLevel = null, ?LoggerInterface $logger = null): DriverInterface
49+
public static function create(string|UriInterface $uri, ?DriverConfiguration $configuration = null, ?AuthenticateInterface $authenticate = null, ?FormatterInterface $formatter = null, ?string $logLevel = null, ?LoggerInterface $logger = null): DriverInterface
5050
{
5151
if (is_string($uri)) {
5252
$uri = Uri::create($uri);
@@ -77,7 +77,7 @@ public static function create(string|UriInterface $uri, ?DriverConfiguration $co
7777
* : DriverInterface<OGMResults>
7878
* )
7979
*/
80-
private static function createBoltDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, FormatterInterface $formatter = null): DriverInterface
80+
private static function createBoltDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, ?FormatterInterface $formatter = null): DriverInterface
8181
{
8282
if ($formatter !== null) {
8383
return BoltDriver::create($uri, $configuration, $authenticate, $formatter);
@@ -97,7 +97,7 @@ private static function createBoltDriver(string|UriInterface $uri, ?DriverConfig
9797
* : DriverInterface<OGMResults>
9898
* )
9999
*/
100-
private static function createNeo4jDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, FormatterInterface $formatter = null): DriverInterface
100+
private static function createNeo4jDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, ?FormatterInterface $formatter = null): DriverInterface
101101
{
102102
if ($formatter !== null) {
103103
return Neo4jDriver::create($uri, $configuration, $authenticate, $formatter);
@@ -119,7 +119,7 @@ private static function createNeo4jDriver(string|UriInterface $uri, ?DriverConfi
119119
*
120120
* @pure
121121
*/
122-
private static function createHttpDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, FormatterInterface $formatter = null): DriverInterface
122+
private static function createHttpDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, ?FormatterInterface $formatter = null): DriverInterface
123123
{
124124
if ($formatter !== null) {
125125
return HttpDriver::create($uri, $configuration, $authenticate, $formatter);

src/Exception/Neo4jException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class Neo4jException extends RuntimeException
3434
/**
3535
* @param non-empty-list<Neo4jError> $errors
3636
*/
37-
public function __construct(array $errors, Throwable $previous = null)
37+
public function __construct(array $errors, ?Throwable $previous = null)
3838
{
3939
$error = $errors[0];
4040
$message = sprintf(self::MESSAGE_TEMPLATE, $error->getCode(), $error->getMessage() ?? 'NULL');

src/Http/HttpDriver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function __construct(
7070
*
7171
* @pure
7272
*/
73-
public static function create(string|UriInterface $uri, ?DriverConfiguration $configuration = null, ?AuthenticateInterface $authenticate = null, FormatterInterface $formatter = null): self
73+
public static function create(string|UriInterface $uri, ?DriverConfiguration $configuration = null, ?AuthenticateInterface $authenticate = null, ?FormatterInterface $formatter = null): self
7474
{
7575
if (is_string($uri)) {
7676
$uri = Uri::create($uri);

src/Neo4j/Neo4jDriver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct(
6868
*
6969
* @psalm-suppress MixedReturnTypeCoercion
7070
*/
71-
public static function create(string|UriInterface $uri, ?DriverConfiguration $configuration = null, ?AuthenticateInterface $authenticate = null, FormatterInterface $formatter = null, ?AddressResolverInterface $resolver = null): self
71+
public static function create(string|UriInterface $uri, ?DriverConfiguration $configuration = null, ?AuthenticateInterface $authenticate = null, ?FormatterInterface $formatter = null, ?AddressResolverInterface $resolver = null): self
7272
{
7373
if (is_string($uri)) {
7474
$uri = Uri::create($uri);

src/Neo4j/RoutingTable.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function getTtl(): int
4545
*
4646
* @return list<string>
4747
*/
48-
public function getWithRole(RoutingRoles $role = null): array
48+
public function getWithRole(?RoutingRoles $role = null): array
4949
{
5050
/** @psalm-var list<string> $tbr */
5151
$tbr = [];

src/Types/AbstractCypherSequence.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function reversed(): self
248248
*
249249
* @psalm-mutation-free
250250
*/
251-
public function slice(int $offset, int $length = null): self
251+
public function slice(int $offset, ?int $length = null): self
252252
{
253253
return $this->withOperation(function () use ($offset, $length) {
254254
if ($length !== 0) {

src/Types/Map.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function pairs(): ArrayList
186186
*
187187
* @return static<TValue>
188188
*/
189-
public function ksorted(callable $comparator = null): Map
189+
public function ksorted(?callable $comparator = null): Map
190190
{
191191
return $this->withOperation(function () use ($comparator) {
192192
$pairs = $this->pairs()->sorted(static function (Pair $x, Pair $y) use ($comparator) {

0 commit comments

Comments
 (0)