Skip to content

Commit 85cca34

Browse files
committed
chore: CS and Psalm fixes
1 parent e24a8b7 commit 85cca34

File tree

5 files changed

+29
-14
lines changed

5 files changed

+29
-14
lines changed

src/Collector/Neo4jDataCollector.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ public function collect(Request $request, Response $response, ?\Throwable $excep
3232
$profiledSummaries = $this->subscriber->getProfiledSummaries();
3333
$successfulStatements = array_map(
3434
static function (string $key, mixed $value) {
35-
if ('result' !== $key) {
36-
return [...$value, 'status' => 'success'];
35+
if ('result' !== $key && /* Is always array */ is_array($value)) {
36+
return [
37+
...$value,
38+
'status' => 'success',
39+
];
3740
}
3841

3942
return array_map(
40-
static function (string $key, mixed $obj) {
43+
static function (mixed $obj) {
4144
if (is_object($obj) && method_exists($obj, 'toArray')) {
4245
return $obj->toArray();
4346
}

src/Event/PostRunEvent.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class PostRunEvent extends Event
1212
public const EVENT_ID = 'neo4j.post_run';
1313

1414
public function __construct(
15-
private ?string $alias,
16-
private ResultSummary $result,
17-
private \DateTimeInterface $time
15+
private readonly ?string $alias,
16+
private readonly ResultSummary $result,
17+
private readonly \DateTimeInterface $time
1818
) {
1919
}
2020

src/EventListener/Neo4jProfileListener.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Neo4j\Neo4jBundle\EventListener;
66

7-
use DateTimeInterface;
87
use Laudis\Neo4j\Databags\ResultSummary;
98
use Laudis\Neo4j\Databags\Statement;
109
use Laudis\Neo4j\Exception\Neo4jException;
@@ -19,13 +18,21 @@ final class Neo4jProfileListener implements EventSubscriberInterface, ResetInter
1918
* @var list<array{
2019
* result: ResultSummary,
2120
* alias: string|null,
22-
* time: DateTimeInterface
21+
* time: string,
22+
* start_time: float|int,
23+
* end_time: float|int
2324
* }>
2425
*/
2526
private array $profiledSummaries = [];
2627

2728
/**
28-
* @var list<array{exception: Neo4jException, statement: Statement, alias: string|null}>
29+
* @var list<array{
30+
* exception: Neo4jException,
31+
* statement: Statement,
32+
* alias: string|null,
33+
* time: string,
34+
* timestamp: int
35+
* }>
2936
*/
3037
private array $profiledFailures = [];
3138

@@ -80,7 +87,13 @@ public function getProfiledSummaries(): array
8087
}
8188

8289
/**
83-
* @return list<array{exception: Neo4jException, statement: Statement, alias: string|null}>
90+
* @return list<array{
91+
* exception: Neo4jException,
92+
* statement: Statement,
93+
* alias: string|null,
94+
* time: string,
95+
* timestamp: int
96+
* }>
8497
*/
8598
public function getProfiledFailures(): array
8699
{

src/SymfonyClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class SymfonyClient implements ClientInterface
2525
* @param ClientInterface<SummarizedResult<CypherMap>> $client
2626
*/
2727
public function __construct(
28-
private ClientInterface $client,
29-
private EventHandler $handler
28+
private readonly ClientInterface $client,
29+
private readonly EventHandler $handler
3030
) {
3131
}
3232

tests/App/Controller/TestController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ public function __construct(
1616

1717
public function __invoke(Profiler $profiler): Response
1818
{
19-
// dd($profiler->loadProfile('0a1909'));
2019
// Successful statement
2120
$this->client->run('MATCH (n) RETURN n');
2221
try {
2322
// Failing statement
2423
$this->client->run('MATCH (n) {x: $x}', ['x' => 1]);
25-
} catch (\Exception $e) {
24+
} catch (\Exception) {
2625
// ignore
2726
}
2827

0 commit comments

Comments
 (0)