Skip to content

Commit dd41be5

Browse files
committed
Fixed test_tx_func_run
1 parent 4e6d009 commit dd41be5

24 files changed

+86
-234
lines changed

src/Authentication/NoAuth.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Laudis\Neo4j\Bolt\BoltMessageFactory;
1919
use Laudis\Neo4j\Common\Neo4jLogger;
2020
use Laudis\Neo4j\Contracts\AuthenticateInterface;
21+
use Laudis\Neo4j\Enum\ConnectionProtocol;
2122
use Psr\Http\Message\UriInterface;
2223

2324
use function sprintf;
@@ -38,7 +39,7 @@ public function authenticateBolt(BoltConnection $connection, string $userAgent):
3839
{
3940
$factory = $this->createMessageFactory($connection);
4041

41-
if (method_exists($connection, 'logon')) {
42+
if ($connection->getProtocol()->compare(ConnectionProtocol::BOLT_V5_1()) >= 0) {
4243
$helloMetadata = ['user_agent' => $userAgent];
4344

4445
$factory->createHelloMessage($helloMetadata)->send()->getResponse();

src/Bolt/BoltConnection.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
use Laudis\Neo4j\Contracts\ConnectionInterface;
3030
use Laudis\Neo4j\Databags\BookmarkHolder;
3131
use Laudis\Neo4j\Databags\DatabaseInfo;
32-
use Laudis\Neo4j\Databags\Neo4jError;
3332
use Laudis\Neo4j\Enum\AccessMode;
3433
use Laudis\Neo4j\Enum\ConnectionProtocol;
3534
use Laudis\Neo4j\Exception\Neo4jException;

src/Bolt/BoltUnmanagedTransaction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public function __construct(
5858
/**
5959
* @param iterable<Statement> $statements
6060
*
61-
* @return CypherList<SummarizedResult>
62-
*@throws TransactionException|Throwable
61+
* @throws TransactionException|Throwable
6362
*
63+
* @return CypherList<SummarizedResult>
6464
*/
6565
public function commit(iterable $statements = []): CypherList
6666
{

src/Bolt/Messages/BoltCommitMessage.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515

1616
use Bolt\enum\ServerState;
1717
use Bolt\protocol\Response;
18-
use Bolt\protocol\V4_4;
19-
use Bolt\protocol\V5;
20-
use Bolt\protocol\V5_1;
21-
use Bolt\protocol\V5_2;
22-
use Bolt\protocol\V5_3;
23-
use Bolt\protocol\V5_4;
2418
use Laudis\Neo4j\Bolt\BoltConnection;
2519
use Laudis\Neo4j\Common\Neo4jLogger;
2620
use Laudis\Neo4j\Contracts\BoltMessage;

src/Bolt/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ private function startTransaction(TransactionConfiguration $config, SessionConfi
202202
$this->config,
203203
$config,
204204
$this->bookmarkHolder,
205-
new BoltMessageFactory($connection, $this->getLogger()) ,
205+
new BoltMessageFactory($connection, $this->getLogger()),
206206
);
207207
}
208208

src/Databags/Notification.php

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,22 @@
1414
namespace Laudis\Neo4j\Databags;
1515

1616
use InvalidArgumentException;
17+
use Laudis\Neo4j\Types\AbstractCypherObject;
1718

18-
final class Notification
19+
/**
20+
* @psalm-immutable
21+
*
22+
* @template-extends AbstractCypherObject<string, string|Position>
23+
*/
24+
final class Notification extends AbstractCypherObject
1925
{
2026
public function __construct(
21-
private string $severity,
22-
private string $description,
23-
private string $code,
24-
private Position $position,
25-
private string $title,
26-
private string $category,
27+
private readonly string $severity,
28+
private readonly string $description,
29+
private readonly string $code,
30+
private readonly Position $position,
31+
private readonly string $title,
32+
private readonly string $category,
2733
) {
2834
}
2935

@@ -92,9 +98,38 @@ public function getCategory(): string
9298
}
9399

94100
/**
101+
* Matches inherited return type: array<string, string|Position>.
102+
*
95103
* @psalm-external-mutation-free
104+
*
105+
* @return array<string, string|Position>
96106
*/
97107
public function toArray(): array
108+
{
109+
return [
110+
'severity' => $this->severity,
111+
'description' => $this->description,
112+
'code' => $this->code,
113+
'position' => $this->position,
114+
'title' => $this->title,
115+
'category' => $this->category,
116+
];
117+
}
118+
119+
/**
120+
* If you still want a version with the position converted to array,
121+
* use this custom method instead of overriding toArray().
122+
*
123+
* @return array{
124+
* severity: string,
125+
* description: string,
126+
* code: string,
127+
* position: array<string, float|int|null|string>,
128+
* title: string,
129+
* category: string
130+
* }
131+
*/
132+
public function toSerializedArray(): array
98133
{
99134
return [
100135
'severity' => $this->severity,

src/Databags/PlanArguments.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@
1313

1414
namespace Laudis\Neo4j\Databags;
1515

16-
final class PlanArguments
16+
use Laudis\Neo4j\Types\AbstractCypherObject;
17+
18+
/**
19+
* @psalm-immutable
20+
*
21+
* @template-extends AbstractCypherObject<string, int|float|string|null>
22+
*/
23+
final class PlanArguments extends AbstractCypherObject
1724
{
1825
public function __construct(
1926
public readonly ?int $globalMemory = null,

src/Databags/Position.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@
1313

1414
namespace Laudis\Neo4j\Databags;
1515

16+
use Laudis\Neo4j\Types\AbstractCypherObject;
17+
1618
/**
1719
* @psalm-immutable
20+
*
21+
*@template-extends AbstractCypherObject<string, int|float|string|null>
1822
*/
19-
final class Position
23+
final class Position extends AbstractCypherObject
2024
{
2125
public function __construct(
22-
private int $column,
23-
private int $offset,
24-
private int $line,
26+
private readonly int $column,
27+
private readonly int $offset,
28+
private readonly int $line,
2529
) {
2630
}
2731

src/Databags/ProfiledQueryPlan.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ final class ProfiledQueryPlan
1818
/**
1919
* @param list<ProfiledQueryPlan> $children
2020
* @param list<string> $identifiers
21+
*
22+
* @psalm-immutable
2123
*/
2224
public function __construct(
2325
public readonly PlanArguments $arguments,

src/Databags/SummarizedResult.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,16 @@ final class SummarizedResult extends CypherList
3434
private array $keys;
3535

3636
/**
37-
* @param iterable<mixed, CypherMap<OGMTypes>>|callable():Generator<mixed, CypherMap<OGMTypes>> $iterable
38-
* @param list<string> $iterable
39-
*
4037
* @psalm-mutation-free
41-
* @param list<string> $keys
42-
38+
*
39+
* @param iterable<mixed, CypherMap<OGMTypes>>|callable():Generator<mixed, CypherMap<OGMTypes>> $iterable
40+
* @param list<string> $keys
4341
*/
4442
public function __construct(?ResultSummary &$summary, iterable|callable $iterable = [], array $keys)
4543
{
4644
parent::__construct($iterable);
4745
$this->summary = &$summary;
48-
$this->keys = array_values($keys);
46+
$this->keys = $keys;
4947
}
5048

5149
/**

0 commit comments

Comments
 (0)