Skip to content

Commit 77425e0

Browse files
v5.1 (#113)
1 parent af9d8e6 commit 77425e0

25 files changed

+361
-228
lines changed

.github/workflows/db.50.2204.yml

Lines changed: 1 addition & 1 deletion
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.1', '5.2', '5.3', '5.4']
16+
neo4j-version: ['5.1', '5.2', '5.3', '5.4', '5.5']
1717
php-version: ['8.0', '8.1', '8.2']
1818

1919
services:

src/Bolt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class Bolt
2626

2727
public function __construct(private IConnection $connection)
2828
{
29-
$this->setProtocolVersions(5, 4.4);
29+
$this->setProtocolVersions(5.1, 5, 4.4);
3030
}
3131

3232
/**

src/protocol/Response.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class Response
2323
public const MESSAGE_ROLLBACK = 'ROLLBACK';
2424
public const MESSAGE_ROUTE = 'ROUTE';
2525
public const MESSAGE_ACK_FAILURE = 'ACK_FAILURE';
26+
public const MESSAGE_LOGON = 'LOGON';
27+
public const MESSAGE_LOGOFF = 'LOGOFF';
2628

2729
public const SIGNATURE_SUCCESS = 0x70; //112
2830
public const SIGNATURE_FAILURE = 0x7F; //127

src/protocol/ServerState.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ class ServerState
6464
*/
6565
public const INTERRUPTED = 'INTERRUPTED';
6666

67+
/**
68+
* Connection has been established and metadata has been sent back from the HELLO message or a LOGOFF message was received whilst in ready state. Ready to accept a LOGON message with authentication information.
69+
*/
70+
public const UNAUTHENTICATED = 'UNAUTHENTICATED';
71+
6772
/**
6873
* Internal pointer for current server state
6974
*/
@@ -87,7 +92,8 @@ class ServerState
8792
self::TX_READY,
8893
self::TX_STREAMING,
8994
self::FAILED,
90-
self::INTERRUPTED
95+
self::INTERRUPTED,
96+
self::UNAUTHENTICATED
9197
];
9298

9399
/**

src/protocol/V5_1.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace Bolt\protocol;
4+
5+
/**
6+
* Class Protocol version 5.1
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_1 extends AProtocol
14+
{
15+
use \Bolt\protocol\v5\AvailableStructures;
16+
17+
use \Bolt\protocol\v1\ResetMessage;
18+
19+
use \Bolt\protocol\v3\RunMessage;
20+
use \Bolt\protocol\v3\BeginMessage;
21+
use \Bolt\protocol\v3\CommitMessage;
22+
use \Bolt\protocol\v3\RollbackMessage;
23+
use \Bolt\protocol\v3\GoodbyeMessage;
24+
25+
use \Bolt\protocol\v4\PullMessage;
26+
use \Bolt\protocol\v4\DiscardMessage;
27+
28+
use \Bolt\protocol\v4_4\RouteMessage;
29+
30+
use \Bolt\protocol\v5_1\HelloMessage;
31+
use \Bolt\protocol\v5_1\LogonMessage;
32+
use \Bolt\protocol\v5_1\LogoffMessage;
33+
}

src/protocol/v1/ResetMessage.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,7 @@
22

33
namespace Bolt\protocol\v1;
44

5-
use Bolt\protocol\{
6-
ServerState,
7-
Response,
8-
V1,
9-
V2,
10-
V3,
11-
V4,
12-
V4_1,
13-
V4_2,
14-
V4_3,
15-
V4_4,
16-
V5
17-
};
5+
use Bolt\protocol\{ServerState, Response, V1, V2, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1};
186
use Bolt\error\BoltException;
197

208
trait ResetMessage
@@ -26,7 +14,7 @@ trait ResetMessage
2614
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-reset
2715
* @throws BoltException
2816
*/
29-
public function reset(): V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5
17+
public function reset(): V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
3018
{
3119
$this->write($this->packer->pack(0x0F));
3220
$this->pipelinedMessages[] = __FUNCTION__;

src/protocol/v3/BeginMessage.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@
22

33
namespace Bolt\protocol\v3;
44

5-
use Bolt\protocol\{
6-
ServerState,
7-
Response,
8-
V3,
9-
V4,
10-
V4_1,
11-
V4_2,
12-
V4_3,
13-
V4_4,
14-
V5
15-
};
5+
use Bolt\protocol\{ServerState, Response, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1};
166
use Bolt\error\BoltException;
177

188
trait BeginMessage
@@ -24,7 +14,7 @@ trait BeginMessage
2414
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-begin
2515
* @throws BoltException
2616
*/
27-
public function begin(array $extra = []): V3|V4|V4_1|V4_2|V4_3|V4_4|V5
17+
public function begin(array $extra = []): V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
2818
{
2919
$this->serverState->is(ServerState::READY);
3020
$this->write($this->packer->pack(0x11, (object)$extra));

src/protocol/v3/CommitMessage.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@
22

33
namespace Bolt\protocol\v3;
44

5-
use Bolt\protocol\{
6-
ServerState,
7-
Response,
8-
V3,
9-
V4,
10-
V4_1,
11-
V4_2,
12-
V4_3,
13-
V4_4,
14-
V5
15-
};
5+
use Bolt\protocol\{ServerState, Response, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1};
166
use Bolt\error\BoltException;
177

188
trait CommitMessage
@@ -24,7 +14,7 @@ trait CommitMessage
2414
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-commit
2515
* @throws BoltException
2616
*/
27-
public function commit(): V3|V4|V4_1|V4_2|V4_3|V4_4|V5
17+
public function commit(): V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
2818
{
2919
$this->serverState->is(ServerState::TX_READY, ServerState::TX_STREAMING);
3020
$this->write($this->packer->pack(0x12));

src/protocol/v3/RollbackMessage.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@
22

33
namespace Bolt\protocol\v3;
44

5-
use Bolt\protocol\{
6-
ServerState,
7-
Response,
8-
V3,
9-
V4,
10-
V4_1,
11-
V4_2,
12-
V4_3,
13-
V4_4,
14-
V5
15-
};
5+
use Bolt\protocol\{ServerState, Response, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1};
166
use Bolt\error\BoltException;
177

188
trait RollbackMessage
@@ -24,7 +14,7 @@ trait RollbackMessage
2414
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-rollback
2515
* @throws BoltException
2616
*/
27-
public function rollback(): V3|V4|V4_1|V4_2|V4_3|V4_4|V5
17+
public function rollback(): V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
2818
{
2919
$this->serverState->is(ServerState::TX_READY, ServerState::TX_STREAMING);
3020
$this->write($this->packer->pack(0x13));

src/protocol/v3/RunMessage.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@
22

33
namespace Bolt\protocol\v3;
44

5-
use Bolt\protocol\{
6-
ServerState,
7-
Response,
8-
V3,
9-
V4,
10-
V4_1,
11-
V4_2,
12-
V4_3,
13-
V4_4,
14-
V5
15-
};
5+
use Bolt\protocol\{ServerState, Response, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1};
166
use Bolt\error\BoltException;
177

188
trait RunMessage
@@ -24,7 +14,7 @@ trait RunMessage
2414
* @link https://www.neo4j.com/docs/bolt/current/bolt/message/#messages-run
2515
* @throws BoltException
2616
*/
27-
public function run(string $query, array $parameters = [], array $extra = []): V3|V4|V4_1|V4_2|V4_3|V4_4|V5
17+
public function run(string $query, array $parameters = [], array $extra = []): V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
2818
{
2919
$this->serverState->is(ServerState::READY, ServerState::TX_READY, ServerState::STREAMING, ServerState::TX_STREAMING);
3020

0 commit comments

Comments
 (0)