Skip to content

Commit a285c4f

Browse files
Merge pull request #154 from neo4j-php/bolt_57_58
Bolt 5.7 and 5.8
2 parents d04d6d7 + 21e7a24 commit a285c4f

29 files changed

+157
-61
lines changed

.github/workflows/db.50.2204.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
neo4j-version: ['5.4', '5.6', '5.8', '5.12', '5.13', '5.23']
16+
neo4j-version: ['5.4', '5.6', '5.8', '5.12', '5.13', '5.23', '5.26']
1717
php-version: ['8.1', '8.2', '8.3', '8.4']
1818

1919
services:

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ all available versions and keep up with protocol messages architecture and speci
1818

1919
## :label: Version support
2020

21-
We are trying to keep up and this library supports **Bolt <= 5.6**.
21+
We are trying to keep up and this library supports **Bolt <= 5.8**.
2222

2323
https://www.neo4j.com/docs/bolt/current/bolt-compatibility/
2424

@@ -126,17 +126,17 @@ _`run` executes query in auto-commit transaction if explicit transaction was not
126126

127127
### Cypher query parameters
128128

129-
| Neo4j | PHP |
130-
|------------|-----------------------------------------------------------------------------------------------------------------------------------|
131-
| Null | null |
132-
| Boolean | boolean |
133-
| Integer | integer |
134-
| Float | float |
135-
| Bytes | [Bytes class](https://github.com/neo4j-php/Bolt/blob/master/src/structures/Bytes.php) |
136-
| String | string |
137-
| List | array with consecutive numeric keys from 0 |
138-
| Dictionary | object or array which is not considered as list |
139-
| Structure | Classes implementing `IStructure` by protocol version ([docs](https://www.neo4j.com/docs/bolt/current/bolt/structure-semantics/)) |
129+
| Neo4j | PHP |
130+
|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
131+
| Null | null |
132+
| Boolean | boolean |
133+
| Integer | integer |
134+
| Float | float |
135+
| Bytes | [Bytes class]([https://github.com/neo4j-php/Bolt/blob/master/src/structures/Bytes.php](https://github.com/neo4j-php/Bolt/blob/master/src/packstream/Bytes.php)) |
136+
| String | string |
137+
| List | array with consecutive numeric keys from 0 |
138+
| Dictionary | object or array which is not considered as list |
139+
| Structure | Classes implementing `IStructure` by protocol version ([docs](https://www.neo4j.com/docs/bolt/current/bolt/structure-semantics/)) |
140140

141141
List or dictionary can be also provided as instance of class implementing `Bolt\packstream\IPackListGenerator`
142142
or `Bolt\PackStream\IPackDictionaryGenerator`. This approach helps with memory management while working with big amount

src/protocol/V5_6.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Bolt\protocol;
44

55
/**
6-
* Class Protocol version 5.4
6+
* Class Protocol version 5.6
77
*
88
* @author Michal Stefanak
99
* @link https://github.com/neo4j-php/Bolt

src/protocol/V5_7.php

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace Bolt\protocol;
4+
5+
/**
6+
* Class Protocol version 5.7
7+
*
8+
* @author Michal Stefanak
9+
* @link https://github.com/neo4j-php/Bolt
10+
* @see https://www.neo4j.com/docs/bolt/current/bolt/message/
11+
* @package Bolt\protocol
12+
*/
13+
class V5_7 extends AProtocol
14+
{
15+
use \Bolt\protocol\v5\AvailableStructures;
16+
use \Bolt\protocol\v5_1\ServerStateTransition;
17+
18+
use \Bolt\protocol\v1\ResetMessage;
19+
20+
use \Bolt\protocol\v3\RunMessage;
21+
use \Bolt\protocol\v3\BeginMessage;
22+
use \Bolt\protocol\v3\CommitMessage;
23+
use \Bolt\protocol\v3\RollbackMessage;
24+
use \Bolt\protocol\v3\GoodbyeMessage;
25+
26+
use \Bolt\protocol\v4\PullMessage;
27+
use \Bolt\protocol\v4\DiscardMessage;
28+
29+
use \Bolt\protocol\v4_4\RouteMessage;
30+
31+
use \Bolt\protocol\v5_1\LogonMessage;
32+
use \Bolt\protocol\v5_1\LogoffMessage;
33+
34+
use \Bolt\protocol\v5_3\HelloMessage;
35+
36+
use \Bolt\protocol\v5_4\TelemetryMessage;
37+
}

src/protocol/V5_8.php

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace Bolt\protocol;
4+
5+
/**
6+
* Class Protocol version 5.8
7+
*
8+
* @author Michal Stefanak
9+
* @link https://github.com/neo4j-php/Bolt
10+
* @see https://www.neo4j.com/docs/bolt/current/bolt/message/
11+
* @package Bolt\protocol
12+
*/
13+
class V5_8 extends AProtocol
14+
{
15+
use \Bolt\protocol\v5\AvailableStructures;
16+
use \Bolt\protocol\v5_1\ServerStateTransition;
17+
18+
use \Bolt\protocol\v1\ResetMessage;
19+
20+
use \Bolt\protocol\v3\RunMessage;
21+
use \Bolt\protocol\v3\BeginMessage;
22+
use \Bolt\protocol\v3\CommitMessage;
23+
use \Bolt\protocol\v3\RollbackMessage;
24+
use \Bolt\protocol\v3\GoodbyeMessage;
25+
26+
use \Bolt\protocol\v4\PullMessage;
27+
use \Bolt\protocol\v4\DiscardMessage;
28+
29+
use \Bolt\protocol\v4_4\RouteMessage;
30+
31+
use \Bolt\protocol\v5_1\LogonMessage;
32+
use \Bolt\protocol\v5_1\LogoffMessage;
33+
34+
use \Bolt\protocol\v5_3\HelloMessage;
35+
36+
use \Bolt\protocol\v5_4\TelemetryMessage;
37+
}

src/protocol/v1/AckFailureMessage.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Bolt\protocol\v1;
44

55
use Bolt\enum\Message;
6-
use Bolt\protocol\{V1, V2};
76
use Bolt\error\BoltException;
87

98
trait AckFailureMessage
@@ -16,7 +15,7 @@ trait AckFailureMessage
1615
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-ack-failure
1716
* @throws BoltException
1817
*/
19-
public function ackFailure(): V1|V2
18+
public function ackFailure(): static
2019
{
2120
$this->write($this->packer->pack(0x0E));
2221
$this->pipelinedMessages[] = Message::ACK_FAILURE;

src/protocol/v1/DiscardAllMessage.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Bolt\protocol\v1;
44

55
use Bolt\enum\Message;
6-
use Bolt\protocol\{V1, V2, V3};
76
use Bolt\error\BoltException;
87

98
trait DiscardAllMessage
@@ -15,7 +14,7 @@ trait DiscardAllMessage
1514
* https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-discard
1615
* @throws BoltException
1716
*/
18-
public function discardAll(): V1|V2|V3
17+
public function discardAll(): static
1918
{
2019
$this->write($this->packer->pack(0x2F));
2120
$this->pipelinedMessages[] = Message::DISCARD_ALL;

src/protocol/v1/InitMessage.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Bolt\protocol\v1;
44

55
use Bolt\enum\Message;
6-
use Bolt\protocol\{V1, V2};
76
use Bolt\error\BoltException;
87

98
trait InitMessage
@@ -15,7 +14,7 @@ trait InitMessage
1514
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-init
1615
* @throws BoltException
1716
*/
18-
public function init(string $userAgent, array $authToken): V1|V2
17+
public function init(string $userAgent, array $authToken): static
1918
{
2019
$this->write($this->packer->pack(0x01, $userAgent, $authToken));
2120
$this->pipelinedMessages[] = Message::INIT;

src/protocol/v1/PullAllMessage.php

+2-7
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
namespace Bolt\protocol\v1;
44

55
use Bolt\enum\{Message, Signature};
6-
use Bolt\protocol\{
7-
Response,
8-
V1,
9-
V2,
10-
V3
11-
};
6+
use Bolt\protocol\Response;
127
use Bolt\error\BoltException;
138

149
trait PullAllMessage
@@ -20,7 +15,7 @@ trait PullAllMessage
2015
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#message-pull
2116
* @throws BoltException
2217
*/
23-
public function pullAll(): V1|V2|V3
18+
public function pullAll(): static
2419
{
2520
$this->write($this->packer->pack(0x3F));
2621
$this->pipelinedMessages[] = Message::PULL_ALL;

src/protocol/v1/ResetMessage.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Bolt\protocol\v1;
44

55
use Bolt\enum\Message;
6-
use Bolt\protocol\{V1, V2, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1, V5_2, V5_3, V5_4, V5_6};
76
use Bolt\error\BoltException;
87

98
trait ResetMessage
@@ -15,7 +14,7 @@ trait ResetMessage
1514
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-reset
1615
* @throws BoltException
1716
*/
18-
public function reset(): V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1|V5_2|V5_3|V5_4|V5_6
17+
public function reset(): static
1918
{
2019
$this->write($this->packer->pack(0x0F));
2120
$this->pipelinedMessages[] = Message::RESET;

src/protocol/v1/RunMessage.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Bolt\protocol\v1;
44

55
use Bolt\enum\Message;
6-
use Bolt\protocol\{V1, V2};
76
use Bolt\error\BoltException;
87

98
trait RunMessage
@@ -15,7 +14,7 @@ trait RunMessage
1514
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-run
1615
* @throws BoltException
1716
*/
18-
public function run(string $query, array $parameters = []): V1|V2
17+
public function run(string $query, array $parameters = []): static
1918
{
2019
$this->write($this->packer->pack(0x10, $query, (object)$parameters));
2120
$this->pipelinedMessages[] = Message::RUN;

src/protocol/v3/BeginMessage.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Bolt\protocol\v3;
44

55
use Bolt\enum\Message;
6-
use Bolt\protocol\{V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1, V5_2, V5_3, V5_4, V5_6};
76
use Bolt\error\BoltException;
87

98
trait BeginMessage
@@ -15,7 +14,7 @@ trait BeginMessage
1514
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-begin
1615
* @throws BoltException
1716
*/
18-
public function begin(array $extra = []): V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1|V5_2|V5_3|V5_4|V5_6
17+
public function begin(array $extra = []): static
1918
{
2019
$this->write($this->packer->pack(0x11, (object)$extra));
2120
$this->pipelinedMessages[] = Message::BEGIN;

src/protocol/v3/CommitMessage.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Bolt\protocol\v3;
44

55
use Bolt\enum\Message;
6-
use Bolt\protocol\{Response, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1, V5_2, V5_3, V5_4, V5_6};
6+
use Bolt\protocol\Response;
77
use Bolt\error\BoltException;
88

99
trait CommitMessage
@@ -15,7 +15,7 @@ trait CommitMessage
1515
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-commit
1616
* @throws BoltException
1717
*/
18-
public function commit(): V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1|V5_2|V5_3|V5_4|V5_6
18+
public function commit(): static
1919
{
2020
$this->write($this->packer->pack(0x12));
2121
$this->pipelinedMessages[] = Message::COMMIT;

src/protocol/v3/HelloMessage.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Bolt\protocol\v3;
44

55
use Bolt\enum\Message;
6-
use Bolt\protocol\{V3, V4, V4_1, V4_2, V4_3, V4_4, V5};
76
use Bolt\error\BoltException;
87

98
trait HelloMessage
@@ -16,7 +15,7 @@ trait HelloMessage
1615
* @param array $extra Use \Bolt\helpers\Auth to generate appropriate array
1716
* @throws BoltException
1817
*/
19-
public function hello(array $extra): V3|V4|V4_1|V4_2|V4_3|V4_4|V5
18+
public function hello(array $extra): static
2019
{
2120
$this->write($this->packer->pack(0x01, $extra));
2221
$this->pipelinedMessages[] = Message::HELLO;

src/protocol/v3/RollbackMessage.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Bolt\protocol\v3;
44

55
use Bolt\enum\Message;
6-
use Bolt\protocol\{Response, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1, V5_2, V5_3, V5_4, V5_6};
6+
use Bolt\protocol\Response;
77
use Bolt\error\BoltException;
88

99
trait RollbackMessage
@@ -15,7 +15,7 @@ trait RollbackMessage
1515
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-rollback
1616
* @throws BoltException
1717
*/
18-
public function rollback(): V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1|V5_2|V5_3|V5_4|V5_6
18+
public function rollback(): static
1919
{
2020
$this->write($this->packer->pack(0x13));
2121
$this->pipelinedMessages[] = Message::ROLLBACK;

src/protocol/v3/RunMessage.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Bolt\protocol\v3;
44

55
use Bolt\enum\Message;
6-
use Bolt\protocol\{Response, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1, V5_2, V5_3, V5_4, V5_6};
6+
use Bolt\protocol\Response;
77
use Bolt\error\BoltException;
88

99
trait RunMessage
@@ -15,7 +15,7 @@ trait RunMessage
1515
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-run
1616
* @throws BoltException
1717
*/
18-
public function run(string $query, array $parameters = [], array $extra = []): V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1|V5_2|V5_3|V5_4|V5_6
18+
public function run(string $query, array $parameters = [], array $extra = []): static
1919
{
2020
$this->write($this->packer->pack(
2121
0x10,

src/protocol/v4/DiscardMessage.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Bolt\enum\Message;
66
use Bolt\enum\Signature;
7-
use Bolt\protocol\{Response, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1, V5_2, V5_3, V5_4, V5_6};
7+
use Bolt\protocol\Response;
88
use Bolt\error\BoltException;
99

1010
trait DiscardMessage
@@ -17,7 +17,7 @@ trait DiscardMessage
1717
* @param array $extra [n::Integer, qid::Integer]
1818
* @throws BoltException
1919
*/
20-
public function discard(array $extra = []): V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1|V5_2|V5_3|V5_4|V5_6
20+
public function discard(array $extra = []): static
2121
{
2222
if (!array_key_exists('n', $extra))
2323
$extra['n'] = -1;

src/protocol/v4/PullMessage.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Bolt\protocol\v4;
44

55
use Bolt\enum\{Message, Signature};
6-
use Bolt\protocol\{Response, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1, V5_2, V5_3, V5_4, V5_6};
6+
use Bolt\protocol\Response;
77
use Bolt\error\BoltException;
88

99
trait PullMessage
@@ -16,7 +16,7 @@ trait PullMessage
1616
* @param array $extra [n::Integer, qid::Integer]
1717
* @throws BoltException
1818
*/
19-
public function pull(array $extra = []): V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1|V5_2|V5_3|V5_4|V5_6
19+
public function pull(array $extra = []): static
2020
{
2121
if (!array_key_exists('n', $extra))
2222
$extra['n'] = -1;

src/protocol/v4_1/HelloMessage.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Bolt\protocol\v4_1;
44

5-
use Bolt\protocol\{V3, V4, V4_1, V4_2, V4_3, V4_4, V5};
65
use Bolt\error\BoltException;
76

87
trait HelloMessage
@@ -19,7 +18,7 @@ trait HelloMessage
1918
* @param array $extra Use \Bolt\helpers\Auth to generate appropiate array
2019
* @throws BoltException
2120
*/
22-
public function hello(array $extra): V3|V4|V4_1|V4_2|V4_3|V4_4|V5
21+
public function hello(array $extra): static
2322
{
2423
if (isset($extra['routing']) && is_array($extra['routing']))
2524
$extra['routing'] = (object)$extra['routing'];

src/protocol/v4_3/RouteMessage.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Bolt\protocol\v4_3;
44

55
use Bolt\enum\Message;
6-
use Bolt\protocol\{V4_3};
76
use Bolt\error\BoltException;
87

98
trait RouteMessage
@@ -15,7 +14,7 @@ trait RouteMessage
1514
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-route
1615
* @throws BoltException
1716
*/
18-
public function route(array $routing, array $bookmarks = [], ?string $db = null): V4_3
17+
public function route(array $routing, array $bookmarks = [], ?string $db = null): static
1918
{
2019
$this->write($this->packer->pack(0x66, (object)$routing, $bookmarks, $db));
2120
$this->pipelinedMessages[] = Message::ROUTE;

0 commit comments

Comments
 (0)