Skip to content

Commit 442f62e

Browse files
committed
Merge remote-tracking branch 'origin/main' into refactor/bolt-message-objects
2 parents abfe43f + 47d972e commit 442f62e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1821
-2282
lines changed

.github/workflows/static-analysis.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,33 @@ on:
77
pull_request:
88
branches:
99
- main
10-
1110
jobs:
1211
php-cs-fixer:
1312
name: "Lint & Analyse"
1413
runs-on: ubuntu-latest
1514
steps:
1615
- uses: actions/checkout@v2
16+
17+
# Setup the correct PHP version globally
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: '8.3.16'
22+
1723
- name: Cache Composer dependencies
1824
uses: actions/cache@v2
1925
with:
2026
path: /tmp/composer-cache
2127
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
28+
2229
- uses: php-actions/composer@v6
2330
with:
2431
progress: yes
25-
php_version: 8.3
32+
php_version: 8.3.16
2633
version: 2
34+
2735
- name: "PHP-CS-Fixer"
2836
run: vendor/bin/php-cs-fixer fix --dry-run
37+
2938
- name: "PSalm"
3039
run: vendor/bin/psalm --show-info=true

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
name: "Running Unit Tests"
1515
strategy:
1616
matrix:
17-
php: ['8.1', '8.2', '8.3']
17+
php: ['8.1.31', '8.2.27', '8.3.16']
1818

1919
steps:
2020
- uses: actions/checkout@v2

README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -308,21 +308,16 @@ composer require nyholm/psr7 nyholm/psr7-server kriswallsmith/buzz
308308

309309
## Result formats/hydration
310310

311-
In order to make the results of the bolt protocol and the http uniform, the driver provides result formatters (aka hydrators). The client is configurable with these formatters. You can even implement your own.
311+
In order to make the results of the bolt protocol and the http uniform, the driver provides and summarizes the results.
312312

313-
The default formatter is the `\Laudis\Neo4j\Formatters\OGMFormatter`, which is explained extensively in [the result format section](#accessing-the-results).
313+
The default formatter is the `\Laudis\Neo4j\Formatters\SummarizedResultFormatter`, which is explained extensively in [the result format section](#accessing-the-results).
314314

315-
The driver provides three formatters by default, which are all found in the Formatter namespace:
316-
- `\Laudis\Neo4j\Formatter\BasicFormatter` which erases all the Cypher types and simply returns every value in the resulting map as a [scalar](https://www.php.net/manual/en/function.is-scalar.php), null or array value.
317-
- `\Laudis\Neo4j\Formatter\OGMFormatter` which maps the cypher types to php types as explained [here](#accessing-the-results).
318-
- `\Laudis\Neo4j\Formatter\SummarizedResultFormatter` which decorates any formatter and adds an extensive result summary.
315+
`\Laudis\Neo4j\Formatter\SummarizedResultFormatter` adds an extensive result summary.
319316

320317
The client builder provides an easy way to change the formatter:
321318

322319
```php
323-
$client = \Laudis\Neo4j\ClientBuilder::create()
324-
->withFormatter(\Laudis\Neo4j\Formatter\SummarizedResultFormatter::create())
325-
->build();
320+
$client = \Laudis\Neo4j\ClientBuilder::create()->build();
326321

327322
/**
328323
* The client will now return a result, decorated with a summary.
@@ -339,8 +334,6 @@ $summary = $summarisedResult->getSummary();
339334
$result = $summarisedResult->getResult();
340335
```
341336

342-
In order to use a custom formatter, implement the `Laudis\Neo4j\Contracts\FormatterInterface` and provide it when using the client builder.
343-
344337
## Concepts
345338

346339
The driver API described [here](https://neo4j.com/docs/driver-manual/current/) is the main target of the driver. Because of this, the client is nothing more than a driver manager. The driver creates sessions. A session runs queries through a transaction.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
"nyholm/psr7": "^1.3",
4949
"nyholm/psr7-server": "^1.0",
5050
"kriswallsmith/buzz": "^1.2",
51-
"vimeo/psalm": "^5.0",
51+
"vimeo/psalm": "^6.5",
5252
"friendsofphp/php-cs-fixer": "3.68.5",
53-
"psalm/plugin-phpunit": "^0.18",
53+
"psalm/plugin-phpunit": "^0.19",
5454
"monolog/monolog": "^2.2",
5555
"symfony/uid": "^5.0",
5656
"symfony/var-dumper": "^5.0",

psalm.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@
3030
<directory name="src"/>
3131
</errorLevel>
3232
</UnusedForeachValue>
33-
<DeprecatedClass>
34-
<errorLevel type="suppress">
35-
<directory name="tests"/>
36-
<directory name="src"/>
37-
</errorLevel>
38-
</DeprecatedClass>
39-
<DeprecatedInterface>
40-
<errorLevel type="suppress">
41-
<directory name="tests"/>
42-
<directory name="src"/>
43-
</errorLevel>
44-
</DeprecatedInterface>
4533
<MissingConstructor>
4634
<errorLevel type="suppress">
4735
<directory name="tests"/>

src/Basic/Client.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,9 @@
1818
use Laudis\Neo4j\Databags\SummarizedResult;
1919
use Laudis\Neo4j\Databags\TransactionConfiguration;
2020
use Laudis\Neo4j\Types\CypherList;
21-
use Laudis\Neo4j\Types\CypherMap;
2221

23-
/**
24-
* @implements ClientInterface<SummarizedResult<CypherMap>>
25-
*/
2622
final class Client implements ClientInterface
2723
{
28-
/**
29-
* @param ClientInterface<SummarizedResult<CypherMap>> $client
30-
*/
3124
public function __construct(
3225
private readonly ClientInterface $client,
3326
) {

src/Basic/Driver.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,13 @@
1717
use Laudis\Neo4j\Contracts\DriverInterface;
1818
use Laudis\Neo4j\Databags\DriverConfiguration;
1919
use Laudis\Neo4j\Databags\SessionConfiguration;
20-
use Laudis\Neo4j\Databags\SummarizedResult;
2120
use Laudis\Neo4j\DriverFactory;
2221
use Laudis\Neo4j\Formatter\SummarizedResultFormatter;
23-
use Laudis\Neo4j\Types\CypherMap;
2422
use Psr\Http\Message\UriInterface;
2523

26-
/**
27-
* @implements DriverInterface<SummarizedResult<CypherMap>>
28-
*/
2924
final class Driver implements DriverInterface
3025
{
3126
/**
32-
* @param DriverInterface<SummarizedResult<CypherMap>> $driver
33-
*
3427
* @psalm-external-mutation-free
3528
*/
3629
public function __construct(
@@ -53,7 +46,6 @@ public function verifyConnectivity(?SessionConfiguration $config = null): bool
5346

5447
public static function create(string|UriInterface $uri, ?DriverConfiguration $configuration = null, ?AuthenticateInterface $authenticate = null): self
5548
{
56-
/** @var DriverInterface<SummarizedResult<CypherMap>> */
5749
$driver = DriverFactory::create($uri, $configuration, $authenticate, SummarizedResultFormatter::create());
5850

5951
return new self($driver);

src/Basic/Session.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,9 @@
1919
use Laudis\Neo4j\Databags\SummarizedResult;
2020
use Laudis\Neo4j\Databags\TransactionConfiguration;
2121
use Laudis\Neo4j\Types\CypherList;
22-
use Laudis\Neo4j\Types\CypherMap;
2322

24-
/**
25-
* @implements SessionInterface<SummarizedResult<CypherMap>>
26-
*/
2723
final class Session implements SessionInterface
2824
{
29-
/**
30-
* @param SessionInterface<SummarizedResult<CypherMap>> $session
31-
*/
3225
public function __construct(
3326
private readonly SessionInterface $session,
3427
) {
@@ -37,25 +30,20 @@ public function __construct(
3730
/**
3831
* @param iterable<Statement> $statements
3932
*
40-
* @return CypherList<SummarizedResult<CypherMap>>
33+
* @return CypherList<SummarizedResult>
4134
*/
4235
public function runStatements(iterable $statements, ?TransactionConfiguration $config = null): CypherList
4336
{
4437
return $this->session->runStatements($statements, $config);
4538
}
4639

47-
/**
48-
* @return SummarizedResult<CypherMap>
49-
*/
5040
public function runStatement(Statement $statement, ?TransactionConfiguration $config = null): SummarizedResult
5141
{
5242
return $this->session->runStatement($statement, $config);
5343
}
5444

5545
/**
5646
* @param iterable<string, mixed> $parameters
57-
*
58-
* @return SummarizedResult<CypherMap>
5947
*/
6048
public function run(string $statement, iterable $parameters = [], ?TransactionConfiguration $config = null): SummarizedResult
6149
{

src/Basic/UnmanagedTransaction.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,22 @@
1717
use Laudis\Neo4j\Databags\Statement;
1818
use Laudis\Neo4j\Databags\SummarizedResult;
1919
use Laudis\Neo4j\Types\CypherList;
20-
use Laudis\Neo4j\Types\CypherMap;
2120

22-
/**
23-
* @implements UnmanagedTransactionInterface<SummarizedResult<CypherMap>>
24-
*/
2521
final class UnmanagedTransaction implements UnmanagedTransactionInterface
2622
{
27-
/**
28-
* @param UnmanagedTransactionInterface<SummarizedResult<CypherMap>> $tsx
29-
*/
3023
public function __construct(
3124
private readonly UnmanagedTransactionInterface $tsx,
3225
) {
3326
}
3427

3528
/**
3629
* @param iterable<string, mixed> $parameters
37-
*
38-
* @return SummarizedResult<CypherMap>
3930
*/
4031
public function run(string $statement, iterable $parameters = []): SummarizedResult
4132
{
4233
return $this->tsx->run($statement, $parameters);
4334
}
4435

45-
/**
46-
* @return SummarizedResult<CypherMap>
47-
*/
4836
public function runStatement(Statement $statement): SummarizedResult
4937
{
5038
return $this->tsx->runStatement($statement);
@@ -53,7 +41,7 @@ public function runStatement(Statement $statement): SummarizedResult
5341
/**
5442
* @param iterable<Statement> $statements
5543
*
56-
* @return CypherList<SummarizedResult<CypherMap>>
44+
* @return CypherList<SummarizedResult>
5745
*/
5846
public function runStatements(iterable $statements): CypherList
5947
{
@@ -63,7 +51,7 @@ public function runStatements(iterable $statements): CypherList
6351
/**
6452
* @param iterable<Statement> $statements
6553
*
66-
* @return CypherList<SummarizedResult<CypherMap>>
54+
* @return CypherList<SummarizedResult>
6755
*/
6856
public function commit(iterable $statements = []): CypherList
6957
{

src/Bolt/BoltConnection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
use Laudis\Neo4j\Common\Neo4jLogger;
2828
use Laudis\Neo4j\Contracts\AuthenticateInterface;
2929
use Laudis\Neo4j\Contracts\ConnectionInterface;
30-
use Laudis\Neo4j\Contracts\FormatterInterface;
3130
use Laudis\Neo4j\Databags\BookmarkHolder;
3231
use Laudis\Neo4j\Databags\DatabaseInfo;
3332
use Laudis\Neo4j\Databags\Neo4jError;
3433
use Laudis\Neo4j\Enum\AccessMode;
3534
use Laudis\Neo4j\Enum\ConnectionProtocol;
3635
use Laudis\Neo4j\Exception\Neo4jException;
36+
use Laudis\Neo4j\Formatter\SummarizedResultFormatter;
3737
use Laudis\Neo4j\Types\CypherList;
3838
use Psr\Http\Message\UriInterface;
3939
use Psr\Log\LogLevel;
@@ -43,7 +43,7 @@
4343
/**
4444
* @implements ConnectionInterface<array{0: V4_4|V5|V5_1|V5_2|V5_3|V5_4|null, 1: Connection}>
4545
*
46-
* @psalm-import-type BoltMeta from FormatterInterface
46+
* @psalm-import-type BoltMeta from SummarizedResultFormatter
4747
*/
4848
class BoltConnection implements ConnectionInterface
4949
{

0 commit comments

Comments
 (0)