Skip to content

Commit ce8d943

Browse files
committed
fix: Psalm and CS Fix
1 parent 6d3786b commit ce8d943

File tree

9 files changed

+11
-23
lines changed

9 files changed

+11
-23
lines changed

src/Authentication/BasicAuth.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ public function __construct(
4343
private readonly ?Neo4jLogger $logger,
4444
) {}
4545

46-
/**
47-
* @psalm-mutation-free
48-
*/
4946
public function authenticateHttp(RequestInterface $request, UriInterface $uri, string $userAgent): RequestInterface
5047
{
5148
$this->logger?->log(LogLevel::DEBUG, 'Authenticating using BasicAuth');

src/Authentication/KerberosAuth.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ public function __construct(
4242
private readonly ?Neo4jLogger $logger,
4343
) {}
4444

45-
/**
46-
* @psalm-mutation-free
47-
*/
4845
public function authenticateHttp(RequestInterface $request, UriInterface $uri, string $userAgent): RequestInterface
4946
{
5047
$this->logger?->log(LogLevel::DEBUG, 'Authenticating using KerberosAuth');

src/Authentication/NoAuth.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public function __construct(
4141
private readonly ?Neo4jLogger $logger
4242
) {}
4343

44-
/**
45-
* @psalm-mutation-free
46-
*/
4744
public function authenticateHttp(RequestInterface $request, UriInterface $uri, string $userAgent): RequestInterface
4845
{
4946
$this->logger?->log(LogLevel::DEBUG, 'Authentication disabled');
@@ -63,10 +60,10 @@ public function authenticateHttp(RequestInterface $request, UriInterface $uri, s
6360
public function authenticateBolt(V4_4|V5|V5_1|V5_2|V5_3|V5_4 $protocol, string $userAgent): array
6461
{
6562
if (method_exists($protocol, 'logon')) {
66-
$this->logger->log(LogLevel::DEBUG, 'HELLO', ['user_agent' => $userAgent]);
63+
$this->logger?->log(LogLevel::DEBUG, 'HELLO', ['user_agent' => $userAgent]);
6764
$protocol->hello(['user_agent' => $userAgent]);
6865
$response = ResponseHelper::getResponse($protocol);
69-
$this->logger->log(LogLevel::DEBUG, 'LOGON', ['scheme' => 'none']);
66+
$this->logger?->log(LogLevel::DEBUG, 'LOGON', ['scheme' => 'none']);
7067
$protocol->logon([
7168
'scheme' => 'none',
7269
]);
@@ -75,7 +72,7 @@ public function authenticateBolt(V4_4|V5|V5_1|V5_2|V5_3|V5_4 $protocol, string $
7572
/** @var array{server: string, connection_id: string, hints: list} */
7673
return $response->content;
7774
} else {
78-
$this->logger->log(LogLevel::DEBUG, 'HELLO', ['user_agent' => $userAgent, 'scheme' => 'none']);
75+
$this->logger?->log(LogLevel::DEBUG, 'HELLO', ['user_agent' => $userAgent, 'scheme' => 'none']);
7976
$protocol->hello([
8077
'user_agent' => $userAgent,
8178
'scheme' => 'none',

src/Authentication/OpenIDConnectAuth.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use Laudis\Neo4j\Contracts\AuthenticateInterface;
2626
use Psr\Http\Message\RequestInterface;
2727
use Psr\Http\Message\UriInterface;
28+
use Psr\Log\LogLevel;
2829

2930
use function sprintf;
3031

@@ -38,9 +39,6 @@ public function __construct(
3839
private readonly ?Neo4jLogger $logger
3940
) {}
4041

41-
/**
42-
* @psalm-mutation-free
43-
*/
4442
public function authenticateHttp(RequestInterface $request, UriInterface $uri, string $userAgent): RequestInterface
4543
{
4644
$this->logger?->log(LogLevel::DEBUG, 'Authenticating using OpenIDConnectAuth');

src/BoltFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(
4242
private readonly BasicConnectionFactoryInterface $connectionFactory,
4343
private readonly ProtocolFactory $protocolFactory,
4444
private readonly SslConfigurationFactory $sslConfigurationFactory,
45-
private readonly ?Neo4jLogger $logger
45+
private readonly ?Neo4jLogger $logger = null
4646
) {}
4747

4848
public static function create(?Neo4jLogger $logger): self

src/Common/DriverSetupManager.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ public function withFormatter(FormatterInterface $formatter): self
193193
return $tbr;
194194
}
195195

196+
/**
197+
* @psalm-mutation-free
198+
*/
196199
public function getLogger(): ?Neo4jLogger
197200
{
198201
return $this->configuration->getLogger();

src/Common/Neo4jLogger.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ public function __construct(
3535
private readonly ?LoggerInterface $logger,
3636
) {}
3737

38-
/**
39-
* @psalm-mutation-free
40-
*/
4138
public function log(string $level, string $message, array $context = []): void
4239
{
4340
if ($this->logger === null || !$this->shouldLog($level)) {

src/Contracts/AuthenticateInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
interface AuthenticateInterface
2626
{
2727
/**
28-
* @psalm-mutation-free
29-
*
3028
* Authenticates a RequestInterface with the provided configuration Uri and userAgent.
3129
*/
3230
public function authenticateHttp(RequestInterface $request, UriInterface $uri, string $userAgent): RequestInterface;

src/Http/HttpDriver.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,19 @@ public static function create(string|UriInterface $uri, ?DriverConfiguration $co
7676
$uri = Uri::create($uri);
7777
}
7878

79+
$configuration ??= DriverConfiguration::default();
7980
if ($formatter !== null) {
8081
return new self(
8182
$uri,
82-
$configuration ?? DriverConfiguration::default(),
83+
$configuration,
8384
$formatter,
8485
$authenticate ?? Authenticate::fromUrl($uri, $configuration->getLogger())
8586
);
8687
}
8788

8889
return new self(
8990
$uri,
90-
$configuration ?? DriverConfiguration::default(),
91+
$configuration,
9192
OGMFormatter::create(),
9293
$authenticate ?? Authenticate::fromUrl($uri, $configuration->getLogger())
9394
);

0 commit comments

Comments
 (0)