Skip to content

Commit a25cbcc

Browse files
committed
feat: Explicitly mark formatter as nullable
1 parent ba07b4d commit a25cbcc

File tree

11 files changed

+15
-15
lines changed

11 files changed

+15
-15
lines changed

src/Bolt/BoltDriver.php

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function runStatements(iterable $statements, ?TransactionConfiguration $c
7676
/**
7777
* @param iterable<Statement>|null $statements
7878
*/
79-
public function openTransaction(iterable $statements = null, ?TransactionConfiguration $config = null): UnmanagedTransactionInterface
79+
public function openTransaction(?iterable $statements = null, ?TransactionConfiguration $config = null): UnmanagedTransactionInterface
8080
{
8181
return $this->beginTransaction($statements, $this->mergeTsxConfig($config));
8282
}

src/Common/GeneratorHelper.php

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ final class DriverFactory
4545
* : DriverInterface<OGMResults>
4646
* )
4747
*/
48-
public static function create(string|UriInterface $uri, ?DriverConfiguration $configuration = null, ?AuthenticateInterface $authenticate = null, FormatterInterface $formatter = null): DriverInterface
48+
public static function create(string|UriInterface $uri, ?DriverConfiguration $configuration = null, ?AuthenticateInterface $authenticate = null, ?FormatterInterface $formatter = null): DriverInterface
4949
{
5050
if (is_string($uri)) {
5151
$uri = Uri::create($uri);
@@ -76,7 +76,7 @@ public static function create(string|UriInterface $uri, ?DriverConfiguration $co
7676
* : DriverInterface<OGMResults>
7777
* )
7878
*/
79-
private static function createBoltDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, FormatterInterface $formatter = null): DriverInterface
79+
private static function createBoltDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, ?FormatterInterface $formatter = null): DriverInterface
8080
{
8181
if ($formatter !== null) {
8282
return BoltDriver::create($uri, $configuration, $authenticate, $formatter);
@@ -96,7 +96,7 @@ private static function createBoltDriver(string|UriInterface $uri, ?DriverConfig
9696
* : DriverInterface<OGMResults>
9797
* )
9898
*/
99-
private static function createNeo4jDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, FormatterInterface $formatter = null): DriverInterface
99+
private static function createNeo4jDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, ?FormatterInterface $formatter = null): DriverInterface
100100
{
101101
if ($formatter !== null) {
102102
return Neo4jDriver::create($uri, $configuration, $authenticate, $formatter);
@@ -118,7 +118,7 @@ private static function createNeo4jDriver(string|UriInterface $uri, ?DriverConfi
118118
*
119119
* @pure
120120
*/
121-
private static function createHttpDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, FormatterInterface $formatter = null): DriverInterface
121+
private static function createHttpDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, ?FormatterInterface $formatter = null): DriverInterface
122122
{
123123
if ($formatter !== null) {
124124
return HttpDriver::create($uri, $configuration, $authenticate, $formatter);

src/Exception/Neo4jException.php

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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) {

0 commit comments

Comments
 (0)