Skip to content

Commit f7c87b8

Browse files
committed
Merge remote-tracking branch 'origin/feat/remove-http' into feat/remove-formatter
2 parents 00d950e + ea70b29 commit f7c87b8

21 files changed

+29
-2539
lines changed

Diff for: .github/workflows/integration-test-single-server.yml

-12
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ jobs:
4242
-e PHP_VERSION=${{ matrix.php }} \
4343
-e CONNECTION=bolt://neo4j:testtest@neo4j \
4444
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
45-
- name: Test http://
46-
run: |
47-
docker compose run \
48-
-e PHP_VERSION=${{ matrix.php }} \
49-
-e CONNECTION=http://neo4j:testtest@neo4j \
50-
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
5145
tests-v5:
5246
runs-on: ubuntu-latest
5347
strategy:
@@ -81,9 +75,3 @@ jobs:
8175
-e PHP_VERSION=${{ matrix.php }} \
8276
-e CONNECTION=bolt://neo4j:testtest@neo4j \
8377
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
84-
- name: Test http://
85-
run: |
86-
docker compose run \
87-
-e PHP_VERSION=${{ matrix.php }} \
88-
-e CONNECTION=http://neo4j:testtest@neo4j \
89-
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration

Diff for: src/Authentication/BasicAuth.php

-17
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
namespace Laudis\Neo4j\Authentication;
1515

16-
use function base64_encode;
17-
1816
use Bolt\protocol\V4_4;
1917
use Bolt\protocol\V5;
2018
use Bolt\protocol\V5_1;
@@ -25,7 +23,6 @@
2523
use Laudis\Neo4j\Common\Neo4jLogger;
2624
use Laudis\Neo4j\Common\ResponseHelper;
2725
use Laudis\Neo4j\Contracts\AuthenticateInterface;
28-
use Psr\Http\Message\RequestInterface;
2926
use Psr\Http\Message\UriInterface;
3027
use Psr\Log\LogLevel;
3128

@@ -43,20 +40,6 @@ public function __construct(
4340
private readonly ?Neo4jLogger $logger,
4441
) {}
4542

46-
public function authenticateHttp(RequestInterface $request, UriInterface $uri, string $userAgent): RequestInterface
47-
{
48-
$this->logger?->log(LogLevel::DEBUG, 'Authenticating using BasicAuth');
49-
$combo = base64_encode($this->username.':'.$this->password);
50-
51-
/**
52-
* @psalm-suppress ImpureMethodCall Request is a pure object:
53-
*
54-
* @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message-meta.md#why-value-objects
55-
*/
56-
return $request->withHeader('Authorization', 'Basic '.$combo)
57-
->withHeader('User-Agent', $userAgent);
58-
}
59-
6043
/**
6144
* @throws Exception
6245
*

Diff for: src/ClientBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*/
4242
final class ClientBuilder
4343
{
44-
public const SUPPORTED_SCHEMES = ['', 'bolt', 'bolt+s', 'bolt+ssc', 'neo4j', 'neo4j+s', 'neo4j+ssc', 'http', 'https'];
44+
public const SUPPORTED_SCHEMES = ['', 'bolt', 'bolt+s', 'bolt+ssc', 'neo4j', 'neo4j+s', 'neo4j+ssc'];
4545

4646
/**
4747
* @psalm-mutation-free

Diff for: src/Contracts/AuthenticateInterface.php

-6
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,10 @@
1919
use Bolt\protocol\V5_2;
2020
use Bolt\protocol\V5_3;
2121
use Bolt\protocol\V5_4;
22-
use Psr\Http\Message\RequestInterface;
2322
use Psr\Http\Message\UriInterface;
2423

2524
interface AuthenticateInterface
2625
{
27-
/**
28-
* Authenticates a RequestInterface with the provided configuration Uri and userAgent.
29-
*/
30-
public function authenticateHttp(RequestInterface $request, UriInterface $uri, string $userAgent): RequestInterface;
31-
3226
/**
3327
* Authenticates a Bolt connection with the provided configuration Uri and userAgent.
3428
*

Diff for: src/Databags/DriverConfiguration.php

+1-35
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,13 @@ final class DriverConfiguration
3939
public const DEFAULT_POOL_SIZE = 0x2F;
4040
public const DEFAULT_CACHE_IMPLEMENTATION = Cache::class;
4141
public const DEFAULT_ACQUIRE_CONNECTION_TIMEOUT = 2.0;
42-
/** @var callable():(HttpPsrBindings|null)|HttpPsrBindings|null */
43-
private $httpPsrBindings;
4442
/** @var callable():(CacheInterface|null)|CacheInterface|null */
4543
private $cache;
4644
/** @var callable():(SemaphoreFactoryInterface|null)|SemaphoreFactoryInterface|null */
4745
private $semaphoreFactory;
4846
private ?Neo4jLogger $logger;
4947

5048
/**
51-
* @param callable():(HttpPsrBindings|null)|HttpPsrBindings|null $httpPsrBindings
5249
* @param callable():(CacheInterface|null)|CacheInterface|null $cache
5350
* @param callable():(SemaphoreFactoryInterface|null)|SemaphoreFactoryInterface|null $semaphore
5451
* @param string|null $logLevel The log level to use. If null, LogLevel::INFO is used.
@@ -57,7 +54,6 @@ final class DriverConfiguration
5754
*/
5855
public function __construct(
5956
private string|null $userAgent,
60-
callable|HttpPsrBindings|null $httpPsrBindings,
6157
private SslConfiguration $sslConfig,
6258
private int|null $maxPoolSize,
6359
CacheInterface|callable|null $cache,
@@ -66,7 +62,6 @@ public function __construct(
6662
?string $logLevel,
6763
?LoggerInterface $logger
6864
) {
69-
$this->httpPsrBindings = $httpPsrBindings;
7065
$this->cache = $cache;
7166
$this->semaphoreFactory = $semaphore;
7267
if ($logger !== null) {
@@ -77,13 +72,10 @@ public function __construct(
7772
}
7873

7974
/**
80-
* @param callable():(HttpPsrBindings|null)|HttpPsrBindings|null $httpPsrBindings
81-
*
8275
* @pure
8376
*/
8477
public static function create(
8578
?string $userAgent,
86-
callable|HttpPsrBindings|null $httpPsrBindings,
8779
SslConfiguration $sslConfig,
8880
int $maxPoolSize,
8981
CacheInterface $cache,
@@ -94,7 +86,6 @@ public static function create(
9486
): self {
9587
return new self(
9688
$userAgent,
97-
$httpPsrBindings,
9889
$sslConfig,
9990
$maxPoolSize,
10091
$cache,
@@ -107,15 +98,14 @@ public static function create(
10798

10899
/**
109100
* Creates a default configuration with a user agent based on the driver version
110-
* and HTTP PSR implementation auto-detected from the environment.
101+
* auto-detected from the environment.
111102
*
112103
* @pure
113104
*/
114105
public static function default(): self
115106
{
116107
return new self(
117108
null,
118-
HttpPsrBindings::default(),
119109
SslConfiguration::default(),
120110
null,
121111
null,
@@ -160,21 +150,6 @@ public function withUserAgent($userAgent): self
160150
return $tbr;
161151
}
162152

163-
/**
164-
* Creates a new configuration with the provided bindings.
165-
*
166-
* @param callable():(HttpPsrBindings|null)|HttpPsrBindings|null $bindings
167-
*
168-
* @psalm-immutable
169-
*/
170-
public function withHttpPsrBindings($bindings): self
171-
{
172-
$tbr = clone $this;
173-
$tbr->httpPsrBindings = $bindings;
174-
175-
return $tbr;
176-
}
177-
178153
/**
179154
* @psalm-immutable
180155
*/
@@ -194,15 +169,6 @@ public function getSslConfiguration(): SslConfiguration
194169
return $this->sslConfig;
195170
}
196171

197-
public function getHttpPsrBindings(): HttpPsrBindings
198-
{
199-
$this->httpPsrBindings = (is_callable($this->httpPsrBindings)) ? call_user_func(
200-
$this->httpPsrBindings
201-
) : $this->httpPsrBindings;
202-
203-
return $this->httpPsrBindings ??= HttpPsrBindings::default();
204-
}
205-
206172
public function getMaxPoolSize(): int
207173
{
208174
return $this->maxPoolSize ?? self::DEFAULT_POOL_SIZE;

Diff for: src/Databags/HttpPsrBindings.php

-133
This file was deleted.

Diff for: src/DriverFactory.php

+3-23
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ final class DriverFactory
3939
*
4040
* @param FormatterInterface<U> $formatter
4141
*
42+
* @throws UnsupportedScheme
43+
*
4244
* @return (
4345
* func_num_args() is 4
4446
* ? DriverInterface<U>
@@ -62,7 +64,7 @@ public static function create(string|UriInterface $uri, ?DriverConfiguration $co
6264
return self::createNeo4jDriver($uri, $configuration, $authenticate, $formatter);
6365
}
6466

65-
return self::createHttpDriver($uri, $configuration, $authenticate, $formatter);
67+
throw UnsupportedScheme::make($scheme, ['bolt', 'bolt+s', 'bolt+ssc', 'neo4j', 'neo4j+s', 'neo4j+ssc']);
6668
}
6769

6870
/**
@@ -104,26 +106,4 @@ private static function createNeo4jDriver(string|UriInterface $uri, ?DriverConfi
104106

105107
return Neo4jDriver::create($uri, $configuration, $authenticate);
106108
}
107-
108-
/**
109-
* @template U
110-
*
111-
* @param FormatterInterface<U> $formatter
112-
*
113-
* @return (
114-
* func_num_args() is 4
115-
* ? DriverInterface<U>
116-
* : DriverInterface<OGMResults>
117-
* )
118-
*
119-
* @pure
120-
*/
121-
private static function createHttpDriver(string|UriInterface $uri, ?DriverConfiguration $configuration, ?AuthenticateInterface $authenticate, ?FormatterInterface $formatter = null): DriverInterface
122-
{
123-
if ($formatter !== null) {
124-
return HttpDriver::create($uri, $configuration, $authenticate, $formatter);
125-
}
126-
127-
return HttpDriver::create($uri, $configuration, $authenticate);
128-
}
129109
}

Diff for: src/Enum/ConnectionProtocol.php

-8
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
* @method static ConnectionProtocol BOLT_V5_2()
4242
* @method static ConnectionProtocol BOLT_V5_3()
4343
* @method static ConnectionProtocol BOLT_V5_4()
44-
* @method static ConnectionProtocol HTTP()
4544
*
4645
* @extends TypedEnum<string>
4746
*
@@ -62,13 +61,6 @@ final class ConnectionProtocol extends TypedEnum implements JsonSerializable
6261
private const BOLT_V5_2 = '5.2';
6362
private const BOLT_V5_3 = '5.3';
6463
private const BOLT_V5_4 = '5.4';
65-
private const HTTP = 'http';
66-
67-
public function isBolt(): bool
68-
{
69-
/** @psalm-suppress ImpureMethodCall */
70-
return $this !== self::HTTP();
71-
}
7264

7365
/**
7466
* @pure

Diff for: src/Formatter/OGMFormatter.php

Whitespace-only changes.

0 commit comments

Comments
 (0)