Skip to content

Small CI optimisations #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@ jobs:
name: "Lint & Analyse"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: php-actions/composer@v6
with:
progress: yes
php_version: 8.1
php_version: 8.4
version: 2
- name: "PHP-CS-Fixer"
run: composer check-cs
- name: "PSalm"
run: composer psalm
- name: Lint & Analyse
uses: php-actions/composer@v6
env:
PHP_CS_FIXER_IGNORE_ENV: "1"
with:
php_version: "8.4"
version: 2
command: check-cs

- name: Run Psalm
uses: php-actions/composer@v6
with:
php_version: "8.4"
version: 2
command: psalm

8 changes: 5 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ jobs:
strategy:
max-parallel: 10
matrix:
php: [ '8.1', '8.2', '8.3' ]
sf_version: [ '5.4', '6.4', '7.1' ]
php: [ '8.1', '8.2', '8.4' ]
sf_version: [ '6.4', '7.2', '7.3' ]
exclude:
- php: 8.1
sf_version: 7.1
sf_version: 7.2
- php: 8.1
sf_version: 7.3

steps:
- uses: actions/checkout@v2
Expand Down
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@
"laudis/neo4j-php-client": "^3.3",
"twig/twig": "^3.0",
"ext-json": "*",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/config": "^5.4 || ^6.0 || ^7.0"
"symfony/dependency-injection": "^6.4 || ^7.2",
"symfony/config": "^6.4 || ^7.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.30",
"friendsofphp/php-cs-fixer": "^3.75",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.3 || ^5.0",
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.19.5",
"psalm/plugin-symfony": "^5.0",
"symfony/console": "^5.4 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0",
"symfony/routing": "^5.4 || ^6.0 || ^7.0",
"symfony/stopwatch": "^6.4",
"symfony/console": "^6.4 || ^7.2",
"symfony/framework-bundle": "^6.4 || ^7.2",
"symfony/http-kernel": "^6.4 || ^7.2",
"symfony/routing": "^6.4 || ^7.2",
"symfony/stopwatch": "^6.4 || ^7.2",
"symfony/test-pack": "^1.1",
"symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/uid": "^6.4",
"symfony/web-profiler-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0",
"symfony/twig-bundle": "^6.4 || ^7.2",
"symfony/uid": "^6.4 || ^7.2",
"symfony/web-profiler-bundle": "^6.4 || ^7.2",
"symfony/yaml": "^6.4 || ^7.2",
"vimeo/psalm": "^6.11"
},
"autoload": {
Expand Down
2 changes: 0 additions & 2 deletions src/Builders/ClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ final class ClientBuilder

/**
* @psalm-mutation-free
*
* @param DriverSetupManager $driverSetups
*/
public function __construct(
private SessionConfiguration $defaultSessionConfig,
Expand Down
12 changes: 5 additions & 7 deletions src/Collector/Neo4jDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
namespace Neo4j\Neo4jBundle\Collector;

use Neo4j\Neo4jBundle\EventListener\Neo4jProfileListener;
use Override;
use Symfony\Bundle\FrameworkBundle\DataCollector\AbstractDataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Throwable;

/**
* @var array{
Expand All @@ -29,8 +27,8 @@ public function __construct(
) {
}

#[Override]
public function collect(Request $request, Response $response, ?Throwable $exception = null): void
#[\Override]
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
$t = $this;
$profiledSummaries = $this->subscriber->getProfiledSummaries();
Expand Down Expand Up @@ -78,14 +76,14 @@ public function collect(Request $request, Response $response, ?Throwable $except
$this->data['statements'] = $mergedArray;
}

#[Override]
#[\Override]
public function reset(): void
{
parent::reset();
$this->subscriber->reset();
}

#[Override]
#[\Override]
public function getName(): string
{
return 'neo4j';
Expand Down Expand Up @@ -130,7 +128,7 @@ public function getQueryCount(): int
return count($this->data['statements']);
}

#[Override]
#[\Override]
public static function getTemplate(): ?string
{
return '@Neo4j/web_profiler.html.twig';
Expand Down
30 changes: 13 additions & 17 deletions src/Decorators/SymfonyClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
use Laudis\Neo4j\Databags\TransactionConfiguration;
use Laudis\Neo4j\Enum\AccessMode;
use Laudis\Neo4j\Types\CypherList;
use Laudis\Neo4j\Types\CypherMap;
use Neo4j\Neo4jBundle\Factories\SymfonyDriverFactory;
use Override;

final class SymfonyClient implements ClientInterface
{
Expand All @@ -33,8 +31,6 @@ final class SymfonyClient implements ClientInterface

/**
* @psalm-mutation-free
*
* @param DriverSetupManager $driverSetups
*/
public function __construct(
private readonly DriverSetupManager $driverSetups,
Expand All @@ -54,13 +50,13 @@ public function getDefaultTransactionConfiguration(): TransactionConfiguration
return $this->defaultTransactionConfiguration;
}

#[Override]
#[\Override]
public function run(string $statement, iterable $parameters = [], ?string $alias = null): SummarizedResult
{
return $this->runStatement(Statement::create($statement, $parameters), $alias);
}

#[Override]
#[\Override]
public function runStatement(Statement $statement, ?string $alias = null): SummarizedResult
{
return $this->runStatements([$statement], $alias)->first();
Expand Down Expand Up @@ -91,7 +87,7 @@ private function getSession(?string $alias = null): SymfonySession
return $this->boundSessions[$alias] = $this->startSession($alias, $this->defaultSessionConfiguration);
}

#[Override]
#[\Override]
public function runStatements(iterable $statements, ?string $alias = null): CypherList
{
$runner = $this->getRunner($alias);
Expand All @@ -102,7 +98,7 @@ public function runStatements(iterable $statements, ?string $alias = null): Cyph
return $runner->runStatements($statements);
}

#[Override]
#[\Override]
public function beginTransaction(?iterable $statements = null, ?string $alias = null, ?TransactionConfiguration $config = null): SymfonyTransaction
{
$session = $this->getSession($alias);
Expand All @@ -111,7 +107,7 @@ public function beginTransaction(?iterable $statements = null, ?string $alias =
return $session->beginTransaction($statements, $config);
}

#[Override]
#[\Override]
public function getDriver(?string $alias): SymfonyDriver
{
return $this->factory->createDriver(
Expand All @@ -138,7 +134,7 @@ private function startSession(?string $alias, SessionConfiguration $configuratio
*
* @return HandlerResult
*/
#[Override]
#[\Override]
public function writeTransaction(callable $tsxHandler, ?string $alias = null, ?TransactionConfiguration $config = null): mixed
{
if ($this->defaultSessionConfiguration->getAccessMode() === AccessMode::WRITE()) {
Expand All @@ -158,7 +154,7 @@ public function writeTransaction(callable $tsxHandler, ?string $alias = null, ?T
*
* @return HandlerResult
*/
#[Override]
#[\Override]
public function readTransaction(callable $tsxHandler, ?string $alias = null, ?TransactionConfiguration $config = null): mixed
{
if ($this->defaultSessionConfiguration->getAccessMode() === AccessMode::READ()) {
Expand All @@ -178,25 +174,25 @@ public function readTransaction(callable $tsxHandler, ?string $alias = null, ?Tr
*
* @return HandlerResult
*/
#[Override]
#[\Override]
public function transaction(callable $tsxHandler, ?string $alias = null, ?TransactionConfiguration $config = null)
{
return $this->writeTransaction($tsxHandler, $alias, $config);
}

#[Override]
#[\Override]
public function verifyConnectivity(?string $driver = null): bool
{
return $this->driverSetups->verifyConnectivity($this->defaultSessionConfiguration, $driver);
}

#[Override]
#[\Override]
public function hasDriver(string $alias): bool
{
return $this->driverSetups->hasDriver($alias);
}

#[Override]
#[\Override]
public function bindTransaction(?string $alias = null, ?TransactionConfiguration $config = null): void
{
$alias ??= $this->driverSetups->getDefaultAlias();
Expand All @@ -205,7 +201,7 @@ public function bindTransaction(?string $alias = null, ?TransactionConfiguration
$this->boundTransactions[$alias][] = $this->beginTransaction(null, $alias, $config);
}

#[Override]
#[\Override]
public function rollbackBoundTransaction(?string $alias = null, int $depth = 1): void
{
$this->popTransactions(static fn (SymfonyTransaction $tsx) => $tsx->rollback(), $alias, $depth);
Expand All @@ -231,7 +227,7 @@ private function popTransactions(callable $handler, ?string $alias = null, int $
}
}

#[Override]
#[\Override]
public function commitBoundTransaction(?string $alias = null, int $depth = 1): void
{
$this->popTransactions(static fn (UnmanagedTransactionInterface $tsx) => $tsx->commit(), $alias, $depth);
Expand Down
7 changes: 3 additions & 4 deletions src/Decorators/SymfonyDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Laudis\Neo4j\Contracts\DriverInterface;
use Laudis\Neo4j\Databags\SessionConfiguration;
use Neo4j\Neo4jBundle\Factories\SymfonyDriverFactory;
use Override;

/**
* @psalm-suppress MissingImmutableAnnotation
Expand All @@ -21,19 +20,19 @@ public function __construct(
) {
}

#[Override]
#[\Override]
public function createSession(?SessionConfiguration $config = null): SymfonySession
{
return $this->factory->createSession($this->driver, $config, $this->alias, $this->schema);
}

#[Override]
#[\Override]
public function verifyConnectivity(?SessionConfiguration $config = null): bool
{
return $this->driver->verifyConnectivity();
}

#[Override]
#[\Override]
public function closeConnections(): void
{
$this->driver->closeConnections();
Expand Down
18 changes: 8 additions & 10 deletions src/Decorators/SymfonySession.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
use Laudis\Neo4j\Databags\SummarizedResult;
use Laudis\Neo4j\Databags\TransactionConfiguration;
use Laudis\Neo4j\Types\CypherList;
use Laudis\Neo4j\Types\CypherMap;
use Neo4j\Neo4jBundle\EventHandler;
use Neo4j\Neo4jBundle\Factories\SymfonyDriverFactory;
use Override;

final class SymfonySession implements SessionInterface
{
Expand All @@ -26,7 +24,7 @@ public function __construct(
) {
}

#[Override]
#[\Override]
public function runStatements(iterable $statements, ?TransactionConfiguration $config = null): CypherList
{
$tbr = [];
Expand All @@ -37,7 +35,7 @@ public function runStatements(iterable $statements, ?TransactionConfiguration $c
return CypherList::fromIterable($tbr);
}

#[Override]
#[\Override]
public function runStatement(Statement $statement, ?TransactionConfiguration $config = null): SummarizedResult
{
return $this->handler->handleQuery(
Expand All @@ -49,13 +47,13 @@ public function runStatement(Statement $statement, ?TransactionConfiguration $co
);
}

#[Override]
#[\Override]
public function run(string $statement, iterable $parameters = [], ?TransactionConfiguration $config = null): SummarizedResult
{
return $this->runStatement(new Statement($statement, $parameters));
}

#[Override]
#[\Override]
public function beginTransaction(?iterable $statements = null, ?TransactionConfiguration $config = null): SymfonyTransaction
{
return $this->factory->createTransaction(
Expand All @@ -75,7 +73,7 @@ public function beginTransaction(?iterable $statements = null, ?TransactionConfi
*
* @psalm-suppress ArgumentTypeCoercion
*/
#[Override]
#[\Override]
public function writeTransaction(callable $tsxHandler, ?TransactionConfiguration $config = null)
{
return TransactionHelper::retry(
Expand All @@ -91,7 +89,7 @@ public function writeTransaction(callable $tsxHandler, ?TransactionConfiguration
*
* @return HandlerResult
*/
#[Override]
#[\Override]
public function readTransaction(callable $tsxHandler, ?TransactionConfiguration $config = null)
{
// TODO: create read transaction here.
Expand All @@ -105,13 +103,13 @@ public function readTransaction(callable $tsxHandler, ?TransactionConfiguration
*
* @return HandlerResult
*/
#[Override]
#[\Override]
public function transaction(callable $tsxHandler, ?TransactionConfiguration $config = null)
{
return $this->writeTransaction($tsxHandler, $config);
}

#[Override]
#[\Override]
public function getLastBookmark(): Bookmark
{
return $this->session->getLastBookmark();
Expand Down
Loading