Skip to content

Commit d1a1d4e

Browse files
Merge pull request #156 from neo4j-php/default-protocol-versions
Default protocol versions update
2 parents caa667f + 2040094 commit d1a1d4e

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/Bolt.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(private IConnection $connection)
3333
$this->track();
3434
}
3535

36-
$this->setProtocolVersions(5.6, 5.4, 5, 4.4);
36+
$this->setProtocolVersions('5.8.8', '4.4.4');
3737
}
3838

3939
private function track(): void
@@ -198,7 +198,7 @@ private function handshake(): string
198198
/**
199199
* Read and compose selected protocol version
200200
*/
201-
private function unpackProtocolVersion(string $bytes): ?string
201+
private function unpackProtocolVersion(string $bytes): string
202202
{
203203
$result = [];
204204

@@ -210,8 +210,7 @@ private function unpackProtocolVersion(string $bytes): ?string
210210
array_shift($result);
211211
}
212212

213-
$version = implode('.', array_reverse($result));
214-
return in_array($version, $this->protocolVersions) ? $version : null;
213+
return implode('.', array_reverse($result));
215214
}
216215

217216
/**

tests/structures/v5/StructuresTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Bolt\tests\structures\v5;
44

55
use Bolt\Bolt;
6-
use Bolt\protocol\{AProtocol, V4_3, V4_4, V5, V5_1};
6+
use Bolt\protocol\AProtocol;
77
use Bolt\tests\structures\v1\DateTimeTrait;
88
use Bolt\tests\structures\v1\DateTimeZoneIdTrait;
99
use Bolt\protocol\v5\structures\{
@@ -24,15 +24,14 @@
2424
*/
2525
class StructuresTest extends \Bolt\tests\structures\StructureLayer
2626
{
27-
public function testInit(): AProtocol|V4_3|V4_4|V5|V5_1
27+
public function testInit(): AProtocol
2828
{
2929
$conn = new \Bolt\connection\StreamSocket($GLOBALS['NEO_HOST'] ?? '127.0.0.1', $GLOBALS['NEO_PORT'] ?? 7687);
3030
$this->assertInstanceOf(\Bolt\connection\StreamSocket::class, $conn);
3131

3232
$bolt = new Bolt($conn);
3333
$this->assertInstanceOf(Bolt::class, $bolt);
3434

35-
/** @var AProtocol|V4_3|V4_4|V5|V5_1 $protocol */
3635
$protocol = $bolt->build();
3736
$this->assertInstanceOf(AProtocol::class, $protocol);
3837

@@ -54,7 +53,7 @@ public function testInit(): AProtocol|V4_3|V4_4|V5|V5_1
5453
/**
5554
* @depends testInit
5655
*/
57-
public function testNode(AProtocol|V4_3|V4_4|V5|V5_1 $protocol)
56+
public function testNode(AProtocol $protocol)
5857
{
5958
$protocol->begin()->getResponse();
6059

@@ -81,7 +80,7 @@ public function testNode(AProtocol|V4_3|V4_4|V5|V5_1 $protocol)
8180
/**
8281
* @depends testInit
8382
*/
84-
public function testPath(AProtocol|V4_3|V4_4|V5|V5_1 $protocol)
83+
public function testPath(AProtocol $protocol)
8584
{
8685
$protocol->begin()->getResponse();
8786

@@ -112,7 +111,7 @@ public function testPath(AProtocol|V4_3|V4_4|V5|V5_1 $protocol)
112111
/**
113112
* @depends testInit
114113
*/
115-
public function testRelationship(AProtocol|V4_3|V4_4|V5|V5_1 $protocol)
114+
public function testRelationship(AProtocol $protocol)
116115
{
117116
$protocol->begin()->getResponse();
118117

0 commit comments

Comments
 (0)