From 31e25bd9b2aae8cc8414f8e326325059f19c4eb6 Mon Sep 17 00:00:00 2001 From: Ghlen Nagels Date: Mon, 26 May 2025 18:21:10 +0530 Subject: [PATCH 1/3] upgrade to driver version 3.3 --- .github/workflows/static-analysis.yml | 2 +- Dockerfile | 2 +- composer.json | 10 ++++-- docker-compose.yml | 9 +++-- phpunit.xml.dist | 9 ++++- src/Builders/ClientBuilder.php | 2 +- src/Collector/Neo4jDataCollector.php | 12 +++++-- src/Decorators/SymfonyClient.php | 27 ++++++++------ src/Decorators/SymfonyDriver.php | 14 ++++---- src/Decorators/SymfonySession.php | 18 ++++++---- src/Decorators/SymfonyTransaction.php | 16 ++++++--- src/DependencyInjection/Configuration.php | 4 ++- src/DependencyInjection/Neo4jExtension.php | 18 +++------- src/Event/FailureEvent.php | 7 ++-- src/Event/PostRunEvent.php | 7 ++-- src/Event/PreRunEvent.php | 7 ++-- .../Transaction/PostTransactionBeginEvent.php | 6 ++-- .../PostTransactionCommitEvent.php | 6 ++-- .../PostTransactionRollbackEvent.php | 6 ++-- .../Transaction/PreTransactionBeginEvent.php | 6 ++-- .../Transaction/PreTransactionCommitEvent.php | 6 ++-- .../PreTransactionRollbackEvent.php | 6 ++-- src/EventHandler.php | 24 +++++++------ src/EventListener/Neo4jProfileListener.php | 3 ++ src/Factories/ClientFactory.php | 36 ++++--------------- src/Factories/SymfonyDriverFactory.php | 2 +- src/Neo4jBundle.php | 2 +- tests/App/Controller/TestController.php | 2 +- tests/App/TestKernel.php | 2 ++ tests/Application.php | 2 +- tests/Functional/IntegrationTest.php | 20 ++++++----- tests/Functional/ProfilerTest.php | 3 +- 32 files changed, 165 insertions(+), 131 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index d0c7cc7..c11ec83 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -14,7 +14,7 @@ jobs: - 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 diff --git a/Dockerfile b/Dockerfile index d3f46b1..178d86c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-cli +FROM php:8.4-cli RUN apt-get update \ && apt-get install -y \ libzip-dev \ diff --git a/composer.json b/composer.json index 32202f9..f55278e 100644 --- a/composer.json +++ b/composer.json @@ -8,11 +8,15 @@ { "name": "Ghlen Nagels", "email": "ghlen@nagels.tech" + }, + { + "name": "Nabeel Parkar", + "email": "nabeel@nagels.tech" } ], "require": { "php": ">=8.1", - "laudis/neo4j-php-client": "^3.2", + "laudis/neo4j-php-client": "^3.3", "twig/twig": "^3.0", "ext-json": "*", "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", @@ -23,7 +27,7 @@ "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.18", + "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", @@ -35,7 +39,7 @@ "symfony/uid": "^6.4", "symfony/web-profiler-bundle": "^5.4 || ^6.0 || ^7.0", "symfony/yaml": "^5.4 || ^6.0 || ^7.0", - "vimeo/psalm": "^5.15.0" + "vimeo/psalm": "^6.11" }, "autoload": { "psr-4": { diff --git a/docker-compose.yml b/docker-compose.yml index c28d0d8..861dd4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,12 +24,15 @@ services: - neo4j-symfony neo4j: - environment: - - NEO4J_AUTH=neo4j/testtest image: neo4j:5.22 ports: - ${DOCKER_HOST_NEO4J_HTTP_PORT:-7474}:7474 - ${DOCKER_HOST_NEO4J_BOLT_PORT:-7687}:7687 + environment: + - NEO4J_AUTH=neo4j/testtest + + # advertise “neo4j:7687” instead of localhost + - NEO4J_server_default__advertised__address=neo4j + - NEO4J_server_bolt_advertised__address=neo4j:7687 networks: - neo4j-symfony - diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 73e173e..eff8e8b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,12 @@ - + ./tests/Functional diff --git a/src/Builders/ClientBuilder.php b/src/Builders/ClientBuilder.php index 2f229e7..d1b872f 100644 --- a/src/Builders/ClientBuilder.php +++ b/src/Builders/ClientBuilder.php @@ -21,7 +21,7 @@ final class ClientBuilder /** * @psalm-mutation-free * - * @param DriverSetupManager $driverSetups + * @param DriverSetupManager $driverSetups */ public function __construct( private SessionConfiguration $defaultSessionConfig, diff --git a/src/Collector/Neo4jDataCollector.php b/src/Collector/Neo4jDataCollector.php index 8543887..0b9a050 100644 --- a/src/Collector/Neo4jDataCollector.php +++ b/src/Collector/Neo4jDataCollector.php @@ -5,9 +5,11 @@ 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{ @@ -27,7 +29,8 @@ public function __construct( ) { } - 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(); @@ -75,12 +78,14 @@ public function collect(Request $request, Response $response, ?\Throwable $excep $this->data['statements'] = $mergedArray; } + #[Override] public function reset(): void { parent::reset(); $this->subscriber->reset(); } + #[Override] public function getName(): string { return 'neo4j'; @@ -125,12 +130,13 @@ public function getQueryCount(): int return count($this->data['statements']); } + #[Override] public static function getTemplate(): ?string { return '@Neo4j/web_profiler.html.twig'; } - private function recursiveToArray(mixed $obj): mixed + private function recursiveToArray(array|object $obj): mixed { if (is_array($obj)) { return array_map( @@ -139,7 +145,7 @@ private function recursiveToArray(mixed $obj): mixed ); } - if (is_object($obj) && method_exists($obj, 'toArray')) { + if (method_exists($obj, 'toArray')) { return $obj->toArray(); } diff --git a/src/Decorators/SymfonyClient.php b/src/Decorators/SymfonyClient.php index 37207ba..ccec4a7 100644 --- a/src/Decorators/SymfonyClient.php +++ b/src/Decorators/SymfonyClient.php @@ -17,17 +17,9 @@ use Laudis\Neo4j\Types\CypherList; use Laudis\Neo4j\Types\CypherMap; use Neo4j\Neo4jBundle\Factories\SymfonyDriverFactory; +use Override; -/** - * A collection of drivers with methods to run queries though them. - * - * @implements ClientInterface> - * - * @psalm-external-mutation-free - * - * @psalm-suppress ImpureMethodCall - */ -class SymfonyClient implements ClientInterface +final class SymfonyClient implements ClientInterface { /** * @var array> @@ -42,7 +34,7 @@ class SymfonyClient implements ClientInterface /** * @psalm-mutation-free * - * @param DriverSetupManager $driverSetups + * @param DriverSetupManager $driverSetups */ public function __construct( private readonly DriverSetupManager $driverSetups, @@ -62,11 +54,13 @@ public function getDefaultTransactionConfiguration(): TransactionConfiguration return $this->defaultTransactionConfiguration; } + #[Override] public function run(string $statement, iterable $parameters = [], ?string $alias = null): SummarizedResult { return $this->runStatement(Statement::create($statement, $parameters), $alias); } + #[Override] public function runStatement(Statement $statement, ?string $alias = null): SummarizedResult { return $this->runStatements([$statement], $alias)->first(); @@ -97,6 +91,7 @@ private function getSession(?string $alias = null): SymfonySession return $this->boundSessions[$alias] = $this->startSession($alias, $this->defaultSessionConfiguration); } + #[Override] public function runStatements(iterable $statements, ?string $alias = null): CypherList { $runner = $this->getRunner($alias); @@ -107,6 +102,7 @@ public function runStatements(iterable $statements, ?string $alias = null): Cyph return $runner->runStatements($statements); } + #[Override] public function beginTransaction(?iterable $statements = null, ?string $alias = null, ?TransactionConfiguration $config = null): SymfonyTransaction { $session = $this->getSession($alias); @@ -115,6 +111,7 @@ public function beginTransaction(?iterable $statements = null, ?string $alias = return $session->beginTransaction($statements, $config); } + #[Override] public function getDriver(?string $alias): SymfonyDriver { return $this->factory->createDriver( @@ -141,6 +138,7 @@ private function startSession(?string $alias, SessionConfiguration $configuratio * * @return HandlerResult */ + #[Override] public function writeTransaction(callable $tsxHandler, ?string $alias = null, ?TransactionConfiguration $config = null): mixed { if ($this->defaultSessionConfiguration->getAccessMode() === AccessMode::WRITE()) { @@ -160,6 +158,7 @@ public function writeTransaction(callable $tsxHandler, ?string $alias = null, ?T * * @return HandlerResult */ + #[Override] public function readTransaction(callable $tsxHandler, ?string $alias = null, ?TransactionConfiguration $config = null): mixed { if ($this->defaultSessionConfiguration->getAccessMode() === AccessMode::READ()) { @@ -179,21 +178,25 @@ public function readTransaction(callable $tsxHandler, ?string $alias = null, ?Tr * * @return HandlerResult */ + #[Override] public function transaction(callable $tsxHandler, ?string $alias = null, ?TransactionConfiguration $config = null) { return $this->writeTransaction($tsxHandler, $alias, $config); } + #[Override] public function verifyConnectivity(?string $driver = null): bool { return $this->driverSetups->verifyConnectivity($this->defaultSessionConfiguration, $driver); } + #[Override] public function hasDriver(string $alias): bool { return $this->driverSetups->hasDriver($alias); } + #[Override] public function bindTransaction(?string $alias = null, ?TransactionConfiguration $config = null): void { $alias ??= $this->driverSetups->getDefaultAlias(); @@ -202,6 +205,7 @@ public function bindTransaction(?string $alias = null, ?TransactionConfiguration $this->boundTransactions[$alias][] = $this->beginTransaction(null, $alias, $config); } + #[Override] public function rollbackBoundTransaction(?string $alias = null, int $depth = 1): void { $this->popTransactions(static fn (SymfonyTransaction $tsx) => $tsx->rollback(), $alias, $depth); @@ -227,6 +231,7 @@ private function popTransactions(callable $handler, ?string $alias = null, int $ } } + #[Override] public function commitBoundTransaction(?string $alias = null, int $depth = 1): void { $this->popTransactions(static fn (UnmanagedTransactionInterface $tsx) => $tsx->commit(), $alias, $depth); diff --git a/src/Decorators/SymfonyDriver.php b/src/Decorators/SymfonyDriver.php index ea2d699..dcae955 100644 --- a/src/Decorators/SymfonyDriver.php +++ b/src/Decorators/SymfonyDriver.php @@ -5,18 +5,13 @@ use Laudis\Neo4j\Basic\Driver; use Laudis\Neo4j\Contracts\DriverInterface; use Laudis\Neo4j\Databags\SessionConfiguration; -use Laudis\Neo4j\Databags\SummarizedResult; -use Laudis\Neo4j\Types\CypherMap; use Neo4j\Neo4jBundle\Factories\SymfonyDriverFactory; +use Override; /** - * @implements DriverInterface> - * - * @psalm-immutable - * - * @psalm-suppress ImpureMethodCall + * @psalm-suppress MissingImmutableAnnotation */ -class SymfonyDriver implements DriverInterface +final class SymfonyDriver implements DriverInterface { public function __construct( private readonly Driver $driver, @@ -26,16 +21,19 @@ public function __construct( ) { } + #[Override] public function createSession(?SessionConfiguration $config = null): SymfonySession { return $this->factory->createSession($this->driver, $config, $this->alias, $this->schema); } + #[Override] public function verifyConnectivity(?SessionConfiguration $config = null): bool { return $this->driver->verifyConnectivity(); } + #[Override] public function closeConnections(): void { $this->driver->closeConnections(); diff --git a/src/Decorators/SymfonySession.php b/src/Decorators/SymfonySession.php index 9cbef39..1e00a02 100644 --- a/src/Decorators/SymfonySession.php +++ b/src/Decorators/SymfonySession.php @@ -13,11 +13,9 @@ use Laudis\Neo4j\Types\CypherMap; use Neo4j\Neo4jBundle\EventHandler; use Neo4j\Neo4jBundle\Factories\SymfonyDriverFactory; +use Override; -/** - * @implements SessionInterface> - */ -class SymfonySession implements SessionInterface +final class SymfonySession implements SessionInterface { public function __construct( private readonly Session $session, @@ -28,6 +26,7 @@ public function __construct( ) { } + #[Override] public function runStatements(iterable $statements, ?TransactionConfiguration $config = null): CypherList { $tbr = []; @@ -38,7 +37,8 @@ public function runStatements(iterable $statements, ?TransactionConfiguration $c return CypherList::fromIterable($tbr); } - public function runStatement(Statement $statement, ?TransactionConfiguration $config = null) + #[Override] + public function runStatement(Statement $statement, ?TransactionConfiguration $config = null): SummarizedResult { return $this->handler->handleQuery( runHandler: fn (Statement $statement) => $this->session->runStatement($statement), @@ -49,11 +49,13 @@ public function runStatement(Statement $statement, ?TransactionConfiguration $co ); } - public function run(string $statement, iterable $parameters = [], ?TransactionConfiguration $config = null) + #[Override] + public function run(string $statement, iterable $parameters = [], ?TransactionConfiguration $config = null): SummarizedResult { return $this->runStatement(new Statement($statement, $parameters)); } + #[Override] public function beginTransaction(?iterable $statements = null, ?TransactionConfiguration $config = null): SymfonyTransaction { return $this->factory->createTransaction( @@ -73,6 +75,7 @@ public function beginTransaction(?iterable $statements = null, ?TransactionConfi * * @psalm-suppress ArgumentTypeCoercion */ + #[Override] public function writeTransaction(callable $tsxHandler, ?TransactionConfiguration $config = null) { return TransactionHelper::retry( @@ -88,6 +91,7 @@ public function writeTransaction(callable $tsxHandler, ?TransactionConfiguration * * @return HandlerResult */ + #[Override] public function readTransaction(callable $tsxHandler, ?TransactionConfiguration $config = null) { // TODO: create read transaction here. @@ -101,11 +105,13 @@ public function readTransaction(callable $tsxHandler, ?TransactionConfiguration * * @return HandlerResult */ + #[Override] public function transaction(callable $tsxHandler, ?TransactionConfiguration $config = null) { return $this->writeTransaction($tsxHandler, $config); } + #[Override] public function getLastBookmark(): Bookmark { return $this->session->getLastBookmark(); diff --git a/src/Decorators/SymfonyTransaction.php b/src/Decorators/SymfonyTransaction.php index f6d1379..9d04ee9 100644 --- a/src/Decorators/SymfonyTransaction.php +++ b/src/Decorators/SymfonyTransaction.php @@ -11,14 +11,12 @@ use Laudis\Neo4j\Types\CypherList; use Laudis\Neo4j\Types\CypherMap; use Neo4j\Neo4jBundle\EventHandler; +use Override; -/** - * @implements UnmanagedTransactionInterface> - */ -class SymfonyTransaction implements UnmanagedTransactionInterface +final class SymfonyTransaction implements UnmanagedTransactionInterface { /** - * @param UnmanagedTransactionInterface> $tsx + * @param UnmanagedTransactionInterface $tsx */ public function __construct( private readonly UnmanagedTransactionInterface $tsx, @@ -29,11 +27,13 @@ public function __construct( ) { } + #[Override] public function run(string $statement, iterable $parameters = []): SummarizedResult { return $this->runStatement(new Statement($statement, $parameters)); } + #[Override] public function runStatement(Statement $statement): SummarizedResult { return $this->handler->handleQuery(fn (Statement $statement) => $this->tsx->runStatement($statement), @@ -47,6 +47,7 @@ public function runStatement(Statement $statement): SummarizedResult /** * @psalm-suppress InvalidReturnStatement */ + #[Override] public function runStatements(iterable $statements): CypherList { $tbr = []; @@ -57,6 +58,7 @@ public function runStatements(iterable $statements): CypherList return CypherList::fromIterable($tbr); } + #[Override] public function commit(iterable $statements = []): CypherList { $results = $this->runStatements($statements); @@ -72,6 +74,7 @@ public function commit(iterable $statements = []): CypherList return $results; } + #[Override] public function rollback(): void { $this->handler->handleTransactionAction( @@ -83,16 +86,19 @@ public function rollback(): void ); } + #[Override] public function isRolledBack(): bool { return $this->tsx->isRolledBack(); } + #[Override] public function isCommitted(): bool { return $this->tsx->isCommitted(); } + #[Override] public function isFinished(): bool { return $this->tsx->isFinished(); diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index b21b8e9..78441bc 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -5,6 +5,7 @@ namespace Neo4j\Neo4jBundle\DependencyInjection; use Laudis\Neo4j\Databags\DriverConfiguration; +use Override; use Psr\Log\LogLevel; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; @@ -54,8 +55,9 @@ * @psalm-suppress PossiblyUndefinedMethod * @psalm-suppress UndefinedInterfaceMethod */ -class Configuration implements ConfigurationInterface +final class Configuration implements ConfigurationInterface { + #[Override] public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('neo4j'); diff --git a/src/DependencyInjection/Neo4jExtension.php b/src/DependencyInjection/Neo4jExtension.php index a19e6c1..ade35e5 100644 --- a/src/DependencyInjection/Neo4jExtension.php +++ b/src/DependencyInjection/Neo4jExtension.php @@ -10,9 +10,7 @@ use Neo4j\Neo4jBundle\Collector\Neo4jDataCollector; use Neo4j\Neo4jBundle\EventHandler; use Neo4j\Neo4jBundle\EventListener\Neo4jProfileListener; -use Psr\Http\Client\ClientInterface; -use Psr\Http\Message\RequestFactoryInterface; -use Psr\Http\Message\StreamFactoryInterface; +use Override; use Psr\Log\LoggerInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -25,8 +23,9 @@ /** * @psalm-import-type NormalisedDriverConfig from Configuration */ -class Neo4jExtension extends Extension +final class Neo4jExtension extends Extension { + #[Override] public function load(array $configs, ContainerBuilder $container): ContainerBuilder { $configuration = new Configuration(); @@ -48,15 +47,6 @@ public function load(array $configs, ContainerBuilder $container): ContainerBuil ->setArgument('$connections', $mergedConfig['drivers'] ?? []) ->setArgument('$defaultDriver', $mergedConfig['default_driver'] ?? null) ->setArgument('$builder', new Reference(ClientBuilder::class, ContainerInterface::NULL_ON_INVALID_REFERENCE)) - ->setArgument('$client', new Reference(ClientInterface::class, ContainerInterface::NULL_ON_INVALID_REFERENCE)) - ->setArgument( - '$streamFactory', - new Reference(StreamFactoryInterface::class, ContainerInterface::NULL_ON_INVALID_REFERENCE) - ) - ->setArgument( - '$requestFactory', - new Reference(RequestFactoryInterface::class, ContainerInterface::NULL_ON_INVALID_REFERENCE) - ) ->setArgument('$logLevel', $mergedConfig['min_log_level'] ?? null) ->setArgument('$logger', new Reference(LoggerInterface::class, ContainerInterface::NULL_ON_INVALID_REFERENCE)) ->setAbstract(false); @@ -117,11 +107,13 @@ public function load(array $configs, ContainerBuilder $container): ContainerBuil return $container; } + #[Override] public function getConfiguration(array $config, ContainerBuilder $container): Configuration { return new Configuration(); } + #[Override] public function getAlias(): string { return 'neo4j'; diff --git a/src/Event/FailureEvent.php b/src/Event/FailureEvent.php index 1aa2966..f1534c0 100644 --- a/src/Event/FailureEvent.php +++ b/src/Event/FailureEvent.php @@ -4,11 +4,12 @@ namespace Neo4j\Neo4jBundle\Event; +use DateTimeInterface; use Laudis\Neo4j\Databags\Statement; use Laudis\Neo4j\Exception\Neo4jException; use Symfony\Contracts\EventDispatcher\Event; -class FailureEvent extends Event +final class FailureEvent extends Event { public const EVENT_ID = 'neo4j.on_failure'; @@ -18,7 +19,7 @@ public function __construct( private readonly ?string $alias, private readonly ?Statement $statement, private readonly Neo4jException $exception, - private readonly \DateTimeInterface $time, + private readonly DateTimeInterface $time, private readonly ?string $scheme, private readonly ?string $transactionId, ) { @@ -45,7 +46,7 @@ public function shouldThrowException(): bool return $this->shouldThrowException; } - public function getTime(): \DateTimeInterface + public function getTime(): DateTimeInterface { return $this->time; } diff --git a/src/Event/PostRunEvent.php b/src/Event/PostRunEvent.php index 26750f4..93928a8 100644 --- a/src/Event/PostRunEvent.php +++ b/src/Event/PostRunEvent.php @@ -4,17 +4,18 @@ namespace Neo4j\Neo4jBundle\Event; +use DateTimeInterface; use Laudis\Neo4j\Databags\ResultSummary; use Symfony\Contracts\EventDispatcher\Event; -class PostRunEvent extends Event +final class PostRunEvent extends Event { public const EVENT_ID = 'neo4j.post_run'; public function __construct( private readonly ?string $alias, private readonly ResultSummary $result, - private readonly \DateTimeInterface $time, + private readonly DateTimeInterface $time, private readonly ?string $scheme, private readonly ?string $transactionId, ) { @@ -25,7 +26,7 @@ public function getResult(): ResultSummary return $this->result; } - public function getTime(): \DateTimeInterface + public function getTime(): DateTimeInterface { return $this->time; } diff --git a/src/Event/PreRunEvent.php b/src/Event/PreRunEvent.php index 360a942..8407ebc 100644 --- a/src/Event/PreRunEvent.php +++ b/src/Event/PreRunEvent.php @@ -4,17 +4,18 @@ namespace Neo4j\Neo4jBundle\Event; +use DateTimeInterface; use Laudis\Neo4j\Databags\Statement; use Symfony\Contracts\EventDispatcher\Event; -class PreRunEvent extends Event +final class PreRunEvent extends Event { public const EVENT_ID = 'neo4j.pre_run'; public function __construct( private readonly ?string $alias, private readonly Statement $statement, - private readonly \DateTimeInterface $time, + private readonly DateTimeInterface $time, private readonly ?string $scheme, private readonly ?string $transactionId, ) { @@ -26,7 +27,7 @@ public function getStatement(): Statement return $this->statement; } - public function getTime(): \DateTimeInterface + public function getTime(): DateTimeInterface { return $this->time; } diff --git a/src/Event/Transaction/PostTransactionBeginEvent.php b/src/Event/Transaction/PostTransactionBeginEvent.php index 317f28c..4fea5a7 100644 --- a/src/Event/Transaction/PostTransactionBeginEvent.php +++ b/src/Event/Transaction/PostTransactionBeginEvent.php @@ -2,13 +2,15 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -class PostTransactionBeginEvent +use DateTimeInterface; + +final class PostTransactionBeginEvent { public const EVENT_ID = 'neo4j.transaction.begin.post'; public function __construct( public readonly string $alias, - public readonly \DateTimeInterface $time, + public readonly DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/Event/Transaction/PostTransactionCommitEvent.php b/src/Event/Transaction/PostTransactionCommitEvent.php index 356fe80..ed8c7ad 100644 --- a/src/Event/Transaction/PostTransactionCommitEvent.php +++ b/src/Event/Transaction/PostTransactionCommitEvent.php @@ -2,13 +2,15 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -class PostTransactionCommitEvent +use DateTimeInterface; + +final class PostTransactionCommitEvent { public const EVENT_ID = 'neo4j.transaction.commit.post'; public function __construct( public readonly string $alias, - public readonly \DateTimeInterface $time, + public readonly DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/Event/Transaction/PostTransactionRollbackEvent.php b/src/Event/Transaction/PostTransactionRollbackEvent.php index b356427..1807ece 100644 --- a/src/Event/Transaction/PostTransactionRollbackEvent.php +++ b/src/Event/Transaction/PostTransactionRollbackEvent.php @@ -2,13 +2,15 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -class PostTransactionRollbackEvent +use DateTimeInterface; + +final class PostTransactionRollbackEvent { public const EVENT_ID = 'neo4j.transaction.rollback.post'; public function __construct( public readonly string $alias, - public readonly \DateTimeInterface $time, + public readonly DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/Event/Transaction/PreTransactionBeginEvent.php b/src/Event/Transaction/PreTransactionBeginEvent.php index 339eeb4..35f1279 100644 --- a/src/Event/Transaction/PreTransactionBeginEvent.php +++ b/src/Event/Transaction/PreTransactionBeginEvent.php @@ -2,13 +2,15 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -class PreTransactionBeginEvent +use DateTimeInterface; + +final class PreTransactionBeginEvent { public const EVENT_ID = 'neo4j.transaction.begin.pre'; public function __construct( public readonly string $alias, - public readonly \DateTimeInterface $time, + public readonly DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/Event/Transaction/PreTransactionCommitEvent.php b/src/Event/Transaction/PreTransactionCommitEvent.php index 83f547a..345ad72 100644 --- a/src/Event/Transaction/PreTransactionCommitEvent.php +++ b/src/Event/Transaction/PreTransactionCommitEvent.php @@ -2,13 +2,15 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -class PreTransactionCommitEvent +use DateTimeInterface; + +final class PreTransactionCommitEvent { public const EVENT_ID = 'neo4j.transaction.commit.pre'; public function __construct( public readonly string $alias, - public readonly \DateTimeInterface $time, + public readonly DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/Event/Transaction/PreTransactionRollbackEvent.php b/src/Event/Transaction/PreTransactionRollbackEvent.php index 9c28658..a574a57 100644 --- a/src/Event/Transaction/PreTransactionRollbackEvent.php +++ b/src/Event/Transaction/PreTransactionRollbackEvent.php @@ -2,13 +2,15 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -class PreTransactionRollbackEvent +use DateTimeInterface; + +final class PreTransactionRollbackEvent { public const EVENT_ID = 'neo4j.transaction.rollback.pre'; public function __construct( public readonly string $alias, - public readonly \DateTimeInterface $time, + public readonly DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/EventHandler.php b/src/EventHandler.php index 113b1a8..798752c 100644 --- a/src/EventHandler.php +++ b/src/EventHandler.php @@ -4,6 +4,7 @@ namespace Neo4j\Neo4jBundle; +use DateTimeImmutable; use Laudis\Neo4j\Databags\Statement; use Laudis\Neo4j\Databags\SummarizedResult; use Laudis\Neo4j\Enum\TransactionState; @@ -20,8 +21,9 @@ use Neo4j\Neo4jBundle\Factories\StopwatchEventNameFactory; use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; +use UnexpectedValueException; -class EventHandler +final class EventHandler { private ?EventDispatcherInterface $dispatcher; @@ -44,7 +46,7 @@ public function handleQuery(callable $runHandler, Statement $statement, string $ { $stopwatchName = $this->nameFactory->createQueryEventName($alias, $transactionId); - $time = new \DateTimeImmutable(); + $time = new DateTimeImmutable(); $event = new PreRunEvent( alias: $alias, statement: $statement, @@ -137,7 +139,7 @@ private function handleAction(callable $runHandler, string $alias, string $schem alias: $alias, statement: $statement, exception: $e, - time: new \DateTimeImmutable('now'), + time: new DateTimeImmutable('now'), scheme: $scheme, transactionId: $transactionId ); @@ -161,7 +163,7 @@ private function createPreAndPostEventsAndIds( TransactionState::ACTIVE => [ new PreTransactionBeginEvent( alias: $alias, - time: new \DateTimeImmutable(), + time: new DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), @@ -170,7 +172,7 @@ private function createPreAndPostEventsAndIds( TransactionState::ROLLED_BACK => [ new PreTransactionRollbackEvent( alias: $alias, - time: new \DateTimeImmutable(), + time: new DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), @@ -179,19 +181,19 @@ private function createPreAndPostEventsAndIds( TransactionState::COMMITTED => [ new PreTransactionCommitEvent( alias: $alias, - time: new \DateTimeImmutable(), + time: new DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), PreTransactionCommitEvent::EVENT_ID, ], - TransactionState::TERMINATED => throw new \UnexpectedValueException('TERMINATED is not a valid transaction state at this point'), + TransactionState::TERMINATED => throw new UnexpectedValueException('TERMINATED is not a valid transaction state at this point'), }; [$postEvent, $postEventId] = match ($nextTransactionState) { TransactionState::ACTIVE => [ new PostTransactionBeginEvent( alias: $alias, - time: new \DateTimeImmutable(), + time: new DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), @@ -200,7 +202,7 @@ private function createPreAndPostEventsAndIds( TransactionState::ROLLED_BACK => [ new PostTransactionRollbackEvent( alias: $alias, - time: new \DateTimeImmutable(), + time: new DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), @@ -209,13 +211,13 @@ private function createPreAndPostEventsAndIds( TransactionState::COMMITTED => [ new PostTransactionCommitEvent( alias: $alias, - time: new \DateTimeImmutable(), + time: new DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), PostTransactionCommitEvent::EVENT_ID, ], - TransactionState::TERMINATED => throw new \UnexpectedValueException('TERMINATED is not a valid transaction state at this point'), + TransactionState::TERMINATED => throw new UnexpectedValueException('TERMINATED is not a valid transaction state at this point'), }; return [ diff --git a/src/EventListener/Neo4jProfileListener.php b/src/EventListener/Neo4jProfileListener.php index e9a8a29..7fc4f12 100644 --- a/src/EventListener/Neo4jProfileListener.php +++ b/src/EventListener/Neo4jProfileListener.php @@ -9,6 +9,7 @@ use Laudis\Neo4j\Exception\Neo4jException; use Neo4j\Neo4jBundle\Event\FailureEvent; use Neo4j\Neo4jBundle\Event\PostRunEvent; +use Override; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Contracts\Service\ResetInterface; @@ -43,6 +44,7 @@ public function __construct(private readonly array $enabledProfiles = []) { } + #[Override] public static function getSubscribedEvents(): array { return [ @@ -100,6 +102,7 @@ public function getProfiledFailures(): array return $this->profiledFailures; } + #[Override] public function reset(): void { $this->profiledFailures = []; diff --git a/src/Factories/ClientFactory.php b/src/Factories/ClientFactory.php index dedc8ec..1912f9c 100644 --- a/src/Factories/ClientFactory.php +++ b/src/Factories/ClientFactory.php @@ -4,11 +4,11 @@ namespace Neo4j\Neo4jBundle\Factories; +use InvalidArgumentException; use Laudis\Neo4j\Authentication\Authenticate; use Laudis\Neo4j\Common\Uri; use Laudis\Neo4j\Contracts\AuthenticateInterface; use Laudis\Neo4j\Databags\DriverConfiguration; -use Laudis\Neo4j\Databags\HttpPsrBindings; use Laudis\Neo4j\Databags\SessionConfiguration; use Laudis\Neo4j\Databags\SslConfiguration; use Laudis\Neo4j\Databags\TransactionConfiguration; @@ -17,9 +17,6 @@ use Neo4j\Neo4jBundle\Builders\ClientBuilder; use Neo4j\Neo4jBundle\Decorators\SymfonyClient; use Neo4j\Neo4jBundle\DependencyInjection\Configuration; -use Psr\Http\Client\ClientInterface; -use Psr\Http\Message\RequestFactoryInterface; -use Psr\Http\Message\StreamFactoryInterface; use Psr\Log\LoggerInterface; /** @@ -30,7 +27,7 @@ * @psalm-import-type DriverAuthenticationArray from Configuration * @psalm-import-type SslConfigArray from Configuration */ -class ClientFactory +final class ClientFactory { /** * @param DriverConfigArray|null $driverConfig @@ -44,9 +41,6 @@ public function __construct( private readonly ?array $transactionConfig, private readonly array $connections, private readonly ?string $defaultDriver, - private readonly ?ClientInterface $client, - private readonly ?StreamFactoryInterface $streamFactory, - private readonly ?RequestFactoryInterface $requestFactory, private readonly ?string $logLevel, private readonly ?LoggerInterface $logger, private ClientBuilder $builder, @@ -87,9 +81,8 @@ public function create(): SymfonyClient private function makeDriverConfig(?string $logLevel = null, ?LoggerInterface $logger = null): DriverConfiguration { - $config = new DriverConfiguration( + return new DriverConfiguration( userAgent: $this->driverConfig['user_agent'] ?? null, - httpPsrBindings: null, sslConfig: $this->makeSslConfig($this->driverConfig['ssl'] ?? null), maxPoolSize: $this->driverConfig['pool_size'] ?? null, cache: null, @@ -98,21 +91,6 @@ private function makeDriverConfig(?string $logLevel = null, ?LoggerInterface $lo logLevel: $logLevel, logger: $logger, ); - - $bindings = new HttpPsrBindings(); - if ($this->client) { - $config = $config->withHttpPsrBindings($bindings->withClient($this->client)); - } - - if ($this->streamFactory) { - $config = $config->withHttpPsrBindings($bindings->withStreamFactory($this->streamFactory)); - } - - if ($this->requestFactory) { - $config = $config->withHttpPsrBindings($bindings->withRequestFactory($this->requestFactory)); - } - - return $config; } private function makeSessionConfig(): SessionConfiguration @@ -145,16 +123,16 @@ private function createAuth(?array $auth, string $dsn): AuthenticateInterface return match ($auth['type'] ?? null) { 'basic' => Authenticate::basic( - $auth['username'] ?? throw new \InvalidArgumentException('Missing username for basic authentication'), - $auth['password'] ?? throw new \InvalidArgumentException('Missing password for basic authentication') + $auth['username'] ?? throw new InvalidArgumentException('Missing username for basic authentication'), + $auth['password'] ?? throw new InvalidArgumentException('Missing password for basic authentication') ), 'kerberos' => Authenticate::kerberos( - $auth['token'] ?? throw new \InvalidArgumentException('Missing token for kerberos authentication') + $auth['token'] ?? throw new InvalidArgumentException('Missing token for kerberos authentication') ), 'dsn', null => Authenticate::fromUrl(Uri::create($dsn)), 'none' => Authenticate::disabled(), 'oid' => Authenticate::oidc( - $auth['token'] ?? throw new \InvalidArgumentException('Missing token for oid authentication') + $auth['token'] ?? throw new InvalidArgumentException('Missing token for oid authentication') ), }; } diff --git a/src/Factories/SymfonyDriverFactory.php b/src/Factories/SymfonyDriverFactory.php index 20d8168..0650912 100644 --- a/src/Factories/SymfonyDriverFactory.php +++ b/src/Factories/SymfonyDriverFactory.php @@ -13,7 +13,7 @@ use Neo4j\Neo4jBundle\EventHandler; use Symfony\Component\Uid\Factory\UuidFactory; -class SymfonyDriverFactory +final class SymfonyDriverFactory { public function __construct( private readonly EventHandler $handler, diff --git a/src/Neo4jBundle.php b/src/Neo4jBundle.php index 03973ae..91931ff 100644 --- a/src/Neo4jBundle.php +++ b/src/Neo4jBundle.php @@ -6,6 +6,6 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; -class Neo4jBundle extends Bundle +final class Neo4jBundle extends Bundle { } diff --git a/tests/App/Controller/TestController.php b/tests/App/Controller/TestController.php index 226f00e..f77be3a 100644 --- a/tests/App/Controller/TestController.php +++ b/tests/App/Controller/TestController.php @@ -8,7 +8,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; -class TestController extends AbstractController +final class TestController extends AbstractController { public function __construct(private readonly LoggerInterface $logger) { diff --git a/tests/App/TestKernel.php b/tests/App/TestKernel.php index 7512766..d716cdc 100644 --- a/tests/App/TestKernel.php +++ b/tests/App/TestKernel.php @@ -13,6 +13,7 @@ final class TestKernel extends Kernel { + #[\Override] public function registerBundles(): array { return [ @@ -23,6 +24,7 @@ public function registerBundles(): array ]; } + #[\Override] public function registerContainerConfiguration(LoaderInterface $loader): void { $loader->load(__DIR__.'/config/default.yml'); diff --git a/tests/Application.php b/tests/Application.php index 4f8ca34..94bfe6a 100644 --- a/tests/Application.php +++ b/tests/Application.php @@ -6,7 +6,7 @@ use Neo4j\Neo4jBundle\Tests\App\TestKernel; -class Application extends \Symfony\Bundle\FrameworkBundle\Console\Application +final class Application extends \Symfony\Bundle\FrameworkBundle\Console\Application { public function __construct() { diff --git a/tests/Functional/IntegrationTest.php b/tests/Functional/IntegrationTest.php index 9226402..b807cb1 100644 --- a/tests/Functional/IntegrationTest.php +++ b/tests/Functional/IntegrationTest.php @@ -1,9 +1,7 @@ expectException(\RuntimeException::class); + $this->expectException(RuntimeException::class); $this->expectExceptionMessageMatches( "/Cannot connect to any server on alias: neo4j_undefined_configs with Uris: \('bolt:\/\/(localhost|localhostt)'\)/" ); @@ -227,11 +231,11 @@ public function testPriority(): void $client = $container->get('neo4j.client'); /** @var DriverSetupManager $drivers */ $drivers = $this->getPrivateProperty($client, 'driverSetups'); - /** @var array<\SplPriorityQueue> $fallbackDriverQueue */ + /** @var array> $fallbackDriverQueue */ $driverSetups = $this->getPrivateProperty($drivers, 'driverSetups'); - /** @var \SplPriorityQueue $fallbackDriverQueue */ + /** @var SplPriorityQueue $fallbackDriverQueue */ $fallbackDriverQueue = $driverSetups['neo4j-fallback-mechanism']; - $fallbackDriverQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH); + $fallbackDriverQueue->setExtractFlags(SplPriorityQueue::EXTR_BOTH); /** @var array{data: DriverSetup, priority: int} $extractedValue */ $extractedValue = $fallbackDriverQueue->extract(); @@ -262,7 +266,7 @@ public function testDefaultLogLevel(): void private function getPrivateProperty(object $object, string $property): mixed { - $reflection = new \ReflectionClass($object); + $reflection = new ReflectionClass($object); $property = $reflection->getProperty($property); return $property->getValue($object); diff --git a/tests/Functional/ProfilerTest.php b/tests/Functional/ProfilerTest.php index cf2f48f..78b00ea 100644 --- a/tests/Functional/ProfilerTest.php +++ b/tests/Functional/ProfilerTest.php @@ -6,8 +6,9 @@ use Neo4j\Neo4jBundle\Tests\App\TestKernel; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class ProfilerTest extends WebTestCase +final class ProfilerTest extends WebTestCase { + #[\Override] protected static function getKernelClass(): string { return TestKernel::class; From 6ea062a8f19b9cace1e43b0da8dfa3283817ca5e Mon Sep 17 00:00:00 2001 From: Ghlen Nagels Date: Tue, 27 May 2025 14:43:38 +0530 Subject: [PATCH 2/3] cs fix styling --- composer.json | 2 +- src/Builders/ClientBuilder.php | 2 -- src/Collector/Neo4jDataCollector.php | 12 ++++---- src/Decorators/SymfonyClient.php | 30 ++++++++----------- src/Decorators/SymfonyDriver.php | 7 ++--- src/Decorators/SymfonySession.php | 18 +++++------ src/Decorators/SymfonyTransaction.php | 21 +++++-------- src/DependencyInjection/Configuration.php | 3 +- src/DependencyInjection/Neo4jExtension.php | 7 ++--- src/Event/FailureEvent.php | 5 ++-- src/Event/PostRunEvent.php | 5 ++-- src/Event/PreRunEvent.php | 5 ++-- .../Transaction/PostTransactionBeginEvent.php | 4 +-- .../PostTransactionCommitEvent.php | 4 +-- .../PostTransactionRollbackEvent.php | 4 +-- .../Transaction/PreTransactionBeginEvent.php | 4 +-- .../Transaction/PreTransactionCommitEvent.php | 4 +-- .../PreTransactionRollbackEvent.php | 4 +-- src/EventHandler.php | 22 +++++++------- src/EventListener/Neo4jProfileListener.php | 5 ++-- src/Factories/ClientFactory.php | 9 +++--- tests/Functional/IntegrationTest.php | 20 +++++-------- 22 files changed, 78 insertions(+), 119 deletions(-) diff --git a/composer.json b/composer.json index f55278e..c650a76 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "symfony/config": "^5.4 || ^6.0 || ^7.0" }, "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", diff --git a/src/Builders/ClientBuilder.php b/src/Builders/ClientBuilder.php index d1b872f..c1e78bc 100644 --- a/src/Builders/ClientBuilder.php +++ b/src/Builders/ClientBuilder.php @@ -20,8 +20,6 @@ final class ClientBuilder /** * @psalm-mutation-free - * - * @param DriverSetupManager $driverSetups */ public function __construct( private SessionConfiguration $defaultSessionConfig, diff --git a/src/Collector/Neo4jDataCollector.php b/src/Collector/Neo4jDataCollector.php index 0b9a050..2093c1c 100644 --- a/src/Collector/Neo4jDataCollector.php +++ b/src/Collector/Neo4jDataCollector.php @@ -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{ @@ -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(); @@ -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'; @@ -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'; diff --git a/src/Decorators/SymfonyClient.php b/src/Decorators/SymfonyClient.php index ccec4a7..6a8c090 100644 --- a/src/Decorators/SymfonyClient.php +++ b/src/Decorators/SymfonyClient.php @@ -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 { @@ -33,8 +31,6 @@ final class SymfonyClient implements ClientInterface /** * @psalm-mutation-free - * - * @param DriverSetupManager $driverSetups */ public function __construct( private readonly DriverSetupManager $driverSetups, @@ -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(); @@ -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); @@ -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); @@ -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( @@ -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()) { @@ -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()) { @@ -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(); @@ -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); @@ -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); diff --git a/src/Decorators/SymfonyDriver.php b/src/Decorators/SymfonyDriver.php index dcae955..3600611 100644 --- a/src/Decorators/SymfonyDriver.php +++ b/src/Decorators/SymfonyDriver.php @@ -6,7 +6,6 @@ use Laudis\Neo4j\Contracts\DriverInterface; use Laudis\Neo4j\Databags\SessionConfiguration; use Neo4j\Neo4jBundle\Factories\SymfonyDriverFactory; -use Override; /** * @psalm-suppress MissingImmutableAnnotation @@ -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(); diff --git a/src/Decorators/SymfonySession.php b/src/Decorators/SymfonySession.php index 1e00a02..ae2278b 100644 --- a/src/Decorators/SymfonySession.php +++ b/src/Decorators/SymfonySession.php @@ -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 { @@ -26,7 +24,7 @@ public function __construct( ) { } - #[Override] + #[\Override] public function runStatements(iterable $statements, ?TransactionConfiguration $config = null): CypherList { $tbr = []; @@ -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( @@ -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( @@ -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( @@ -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. @@ -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(); diff --git a/src/Decorators/SymfonyTransaction.php b/src/Decorators/SymfonyTransaction.php index 9d04ee9..e5446a8 100644 --- a/src/Decorators/SymfonyTransaction.php +++ b/src/Decorators/SymfonyTransaction.php @@ -9,15 +9,10 @@ use Laudis\Neo4j\Databags\SummarizedResult; use Laudis\Neo4j\Enum\TransactionState; use Laudis\Neo4j\Types\CypherList; -use Laudis\Neo4j\Types\CypherMap; use Neo4j\Neo4jBundle\EventHandler; -use Override; final class SymfonyTransaction implements UnmanagedTransactionInterface { - /** - * @param UnmanagedTransactionInterface $tsx - */ public function __construct( private readonly UnmanagedTransactionInterface $tsx, private readonly EventHandler $handler, @@ -27,13 +22,13 @@ public function __construct( ) { } - #[Override] + #[\Override] public function run(string $statement, iterable $parameters = []): SummarizedResult { return $this->runStatement(new Statement($statement, $parameters)); } - #[Override] + #[\Override] public function runStatement(Statement $statement): SummarizedResult { return $this->handler->handleQuery(fn (Statement $statement) => $this->tsx->runStatement($statement), @@ -47,7 +42,7 @@ public function runStatement(Statement $statement): SummarizedResult /** * @psalm-suppress InvalidReturnStatement */ - #[Override] + #[\Override] public function runStatements(iterable $statements): CypherList { $tbr = []; @@ -58,7 +53,7 @@ public function runStatements(iterable $statements): CypherList return CypherList::fromIterable($tbr); } - #[Override] + #[\Override] public function commit(iterable $statements = []): CypherList { $results = $this->runStatements($statements); @@ -74,7 +69,7 @@ public function commit(iterable $statements = []): CypherList return $results; } - #[Override] + #[\Override] public function rollback(): void { $this->handler->handleTransactionAction( @@ -86,19 +81,19 @@ public function rollback(): void ); } - #[Override] + #[\Override] public function isRolledBack(): bool { return $this->tsx->isRolledBack(); } - #[Override] + #[\Override] public function isCommitted(): bool { return $this->tsx->isCommitted(); } - #[Override] + #[\Override] public function isFinished(): bool { return $this->tsx->isFinished(); diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 78441bc..ac7f525 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -5,7 +5,6 @@ namespace Neo4j\Neo4jBundle\DependencyInjection; use Laudis\Neo4j\Databags\DriverConfiguration; -use Override; use Psr\Log\LogLevel; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; @@ -57,7 +56,7 @@ */ final class Configuration implements ConfigurationInterface { - #[Override] + #[\Override] public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('neo4j'); diff --git a/src/DependencyInjection/Neo4jExtension.php b/src/DependencyInjection/Neo4jExtension.php index ade35e5..09a2124 100644 --- a/src/DependencyInjection/Neo4jExtension.php +++ b/src/DependencyInjection/Neo4jExtension.php @@ -10,7 +10,6 @@ use Neo4j\Neo4jBundle\Collector\Neo4jDataCollector; use Neo4j\Neo4jBundle\EventHandler; use Neo4j\Neo4jBundle\EventListener\Neo4jProfileListener; -use Override; use Psr\Log\LoggerInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -25,7 +24,7 @@ */ final class Neo4jExtension extends Extension { - #[Override] + #[\Override] public function load(array $configs, ContainerBuilder $container): ContainerBuilder { $configuration = new Configuration(); @@ -107,13 +106,13 @@ public function load(array $configs, ContainerBuilder $container): ContainerBuil return $container; } - #[Override] + #[\Override] public function getConfiguration(array $config, ContainerBuilder $container): Configuration { return new Configuration(); } - #[Override] + #[\Override] public function getAlias(): string { return 'neo4j'; diff --git a/src/Event/FailureEvent.php b/src/Event/FailureEvent.php index f1534c0..06cbeaa 100644 --- a/src/Event/FailureEvent.php +++ b/src/Event/FailureEvent.php @@ -4,7 +4,6 @@ namespace Neo4j\Neo4jBundle\Event; -use DateTimeInterface; use Laudis\Neo4j\Databags\Statement; use Laudis\Neo4j\Exception\Neo4jException; use Symfony\Contracts\EventDispatcher\Event; @@ -19,7 +18,7 @@ public function __construct( private readonly ?string $alias, private readonly ?Statement $statement, private readonly Neo4jException $exception, - private readonly DateTimeInterface $time, + private readonly \DateTimeInterface $time, private readonly ?string $scheme, private readonly ?string $transactionId, ) { @@ -46,7 +45,7 @@ public function shouldThrowException(): bool return $this->shouldThrowException; } - public function getTime(): DateTimeInterface + public function getTime(): \DateTimeInterface { return $this->time; } diff --git a/src/Event/PostRunEvent.php b/src/Event/PostRunEvent.php index 93928a8..fb832f5 100644 --- a/src/Event/PostRunEvent.php +++ b/src/Event/PostRunEvent.php @@ -4,7 +4,6 @@ namespace Neo4j\Neo4jBundle\Event; -use DateTimeInterface; use Laudis\Neo4j\Databags\ResultSummary; use Symfony\Contracts\EventDispatcher\Event; @@ -15,7 +14,7 @@ final class PostRunEvent extends Event public function __construct( private readonly ?string $alias, private readonly ResultSummary $result, - private readonly DateTimeInterface $time, + private readonly \DateTimeInterface $time, private readonly ?string $scheme, private readonly ?string $transactionId, ) { @@ -26,7 +25,7 @@ public function getResult(): ResultSummary return $this->result; } - public function getTime(): DateTimeInterface + public function getTime(): \DateTimeInterface { return $this->time; } diff --git a/src/Event/PreRunEvent.php b/src/Event/PreRunEvent.php index 8407ebc..437bba7 100644 --- a/src/Event/PreRunEvent.php +++ b/src/Event/PreRunEvent.php @@ -4,7 +4,6 @@ namespace Neo4j\Neo4jBundle\Event; -use DateTimeInterface; use Laudis\Neo4j\Databags\Statement; use Symfony\Contracts\EventDispatcher\Event; @@ -15,7 +14,7 @@ final class PreRunEvent extends Event public function __construct( private readonly ?string $alias, private readonly Statement $statement, - private readonly DateTimeInterface $time, + private readonly \DateTimeInterface $time, private readonly ?string $scheme, private readonly ?string $transactionId, ) { @@ -27,7 +26,7 @@ public function getStatement(): Statement return $this->statement; } - public function getTime(): DateTimeInterface + public function getTime(): \DateTimeInterface { return $this->time; } diff --git a/src/Event/Transaction/PostTransactionBeginEvent.php b/src/Event/Transaction/PostTransactionBeginEvent.php index 4fea5a7..0e39c09 100644 --- a/src/Event/Transaction/PostTransactionBeginEvent.php +++ b/src/Event/Transaction/PostTransactionBeginEvent.php @@ -2,15 +2,13 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -use DateTimeInterface; - final class PostTransactionBeginEvent { public const EVENT_ID = 'neo4j.transaction.begin.post'; public function __construct( public readonly string $alias, - public readonly DateTimeInterface $time, + public readonly \DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/Event/Transaction/PostTransactionCommitEvent.php b/src/Event/Transaction/PostTransactionCommitEvent.php index ed8c7ad..e66a56e 100644 --- a/src/Event/Transaction/PostTransactionCommitEvent.php +++ b/src/Event/Transaction/PostTransactionCommitEvent.php @@ -2,15 +2,13 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -use DateTimeInterface; - final class PostTransactionCommitEvent { public const EVENT_ID = 'neo4j.transaction.commit.post'; public function __construct( public readonly string $alias, - public readonly DateTimeInterface $time, + public readonly \DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/Event/Transaction/PostTransactionRollbackEvent.php b/src/Event/Transaction/PostTransactionRollbackEvent.php index 1807ece..1c145b2 100644 --- a/src/Event/Transaction/PostTransactionRollbackEvent.php +++ b/src/Event/Transaction/PostTransactionRollbackEvent.php @@ -2,15 +2,13 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -use DateTimeInterface; - final class PostTransactionRollbackEvent { public const EVENT_ID = 'neo4j.transaction.rollback.post'; public function __construct( public readonly string $alias, - public readonly DateTimeInterface $time, + public readonly \DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/Event/Transaction/PreTransactionBeginEvent.php b/src/Event/Transaction/PreTransactionBeginEvent.php index 35f1279..ed676d2 100644 --- a/src/Event/Transaction/PreTransactionBeginEvent.php +++ b/src/Event/Transaction/PreTransactionBeginEvent.php @@ -2,15 +2,13 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -use DateTimeInterface; - final class PreTransactionBeginEvent { public const EVENT_ID = 'neo4j.transaction.begin.pre'; public function __construct( public readonly string $alias, - public readonly DateTimeInterface $time, + public readonly \DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/Event/Transaction/PreTransactionCommitEvent.php b/src/Event/Transaction/PreTransactionCommitEvent.php index 345ad72..4c529a4 100644 --- a/src/Event/Transaction/PreTransactionCommitEvent.php +++ b/src/Event/Transaction/PreTransactionCommitEvent.php @@ -2,15 +2,13 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -use DateTimeInterface; - final class PreTransactionCommitEvent { public const EVENT_ID = 'neo4j.transaction.commit.pre'; public function __construct( public readonly string $alias, - public readonly DateTimeInterface $time, + public readonly \DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/Event/Transaction/PreTransactionRollbackEvent.php b/src/Event/Transaction/PreTransactionRollbackEvent.php index a574a57..69fcc22 100644 --- a/src/Event/Transaction/PreTransactionRollbackEvent.php +++ b/src/Event/Transaction/PreTransactionRollbackEvent.php @@ -2,15 +2,13 @@ namespace Neo4j\Neo4jBundle\Event\Transaction; -use DateTimeInterface; - final class PreTransactionRollbackEvent { public const EVENT_ID = 'neo4j.transaction.rollback.pre'; public function __construct( public readonly string $alias, - public readonly DateTimeInterface $time, + public readonly \DateTimeInterface $time, public readonly string $scheme, public readonly string $transactionId, ) { diff --git a/src/EventHandler.php b/src/EventHandler.php index 798752c..834f972 100644 --- a/src/EventHandler.php +++ b/src/EventHandler.php @@ -4,7 +4,6 @@ namespace Neo4j\Neo4jBundle; -use DateTimeImmutable; use Laudis\Neo4j\Databags\Statement; use Laudis\Neo4j\Databags\SummarizedResult; use Laudis\Neo4j\Enum\TransactionState; @@ -21,7 +20,6 @@ use Neo4j\Neo4jBundle\Factories\StopwatchEventNameFactory; use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; -use UnexpectedValueException; final class EventHandler { @@ -46,7 +44,7 @@ public function handleQuery(callable $runHandler, Statement $statement, string $ { $stopwatchName = $this->nameFactory->createQueryEventName($alias, $transactionId); - $time = new DateTimeImmutable(); + $time = new \DateTimeImmutable(); $event = new PreRunEvent( alias: $alias, statement: $statement, @@ -139,7 +137,7 @@ private function handleAction(callable $runHandler, string $alias, string $schem alias: $alias, statement: $statement, exception: $e, - time: new DateTimeImmutable('now'), + time: new \DateTimeImmutable('now'), scheme: $scheme, transactionId: $transactionId ); @@ -163,7 +161,7 @@ private function createPreAndPostEventsAndIds( TransactionState::ACTIVE => [ new PreTransactionBeginEvent( alias: $alias, - time: new DateTimeImmutable(), + time: new \DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), @@ -172,7 +170,7 @@ private function createPreAndPostEventsAndIds( TransactionState::ROLLED_BACK => [ new PreTransactionRollbackEvent( alias: $alias, - time: new DateTimeImmutable(), + time: new \DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), @@ -181,19 +179,19 @@ private function createPreAndPostEventsAndIds( TransactionState::COMMITTED => [ new PreTransactionCommitEvent( alias: $alias, - time: new DateTimeImmutable(), + time: new \DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), PreTransactionCommitEvent::EVENT_ID, ], - TransactionState::TERMINATED => throw new UnexpectedValueException('TERMINATED is not a valid transaction state at this point'), + TransactionState::TERMINATED => throw new \UnexpectedValueException('TERMINATED is not a valid transaction state at this point'), }; [$postEvent, $postEventId] = match ($nextTransactionState) { TransactionState::ACTIVE => [ new PostTransactionBeginEvent( alias: $alias, - time: new DateTimeImmutable(), + time: new \DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), @@ -202,7 +200,7 @@ private function createPreAndPostEventsAndIds( TransactionState::ROLLED_BACK => [ new PostTransactionRollbackEvent( alias: $alias, - time: new DateTimeImmutable(), + time: new \DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), @@ -211,13 +209,13 @@ private function createPreAndPostEventsAndIds( TransactionState::COMMITTED => [ new PostTransactionCommitEvent( alias: $alias, - time: new DateTimeImmutable(), + time: new \DateTimeImmutable(), scheme: $scheme, transactionId: $transactionId, ), PostTransactionCommitEvent::EVENT_ID, ], - TransactionState::TERMINATED => throw new UnexpectedValueException('TERMINATED is not a valid transaction state at this point'), + TransactionState::TERMINATED => throw new \UnexpectedValueException('TERMINATED is not a valid transaction state at this point'), }; return [ diff --git a/src/EventListener/Neo4jProfileListener.php b/src/EventListener/Neo4jProfileListener.php index 7fc4f12..72fd0b8 100644 --- a/src/EventListener/Neo4jProfileListener.php +++ b/src/EventListener/Neo4jProfileListener.php @@ -9,7 +9,6 @@ use Laudis\Neo4j\Exception\Neo4jException; use Neo4j\Neo4jBundle\Event\FailureEvent; use Neo4j\Neo4jBundle\Event\PostRunEvent; -use Override; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Contracts\Service\ResetInterface; @@ -44,7 +43,7 @@ public function __construct(private readonly array $enabledProfiles = []) { } - #[Override] + #[\Override] public static function getSubscribedEvents(): array { return [ @@ -102,7 +101,7 @@ public function getProfiledFailures(): array return $this->profiledFailures; } - #[Override] + #[\Override] public function reset(): void { $this->profiledFailures = []; diff --git a/src/Factories/ClientFactory.php b/src/Factories/ClientFactory.php index 1912f9c..b7c8ea1 100644 --- a/src/Factories/ClientFactory.php +++ b/src/Factories/ClientFactory.php @@ -4,7 +4,6 @@ namespace Neo4j\Neo4jBundle\Factories; -use InvalidArgumentException; use Laudis\Neo4j\Authentication\Authenticate; use Laudis\Neo4j\Common\Uri; use Laudis\Neo4j\Contracts\AuthenticateInterface; @@ -123,16 +122,16 @@ private function createAuth(?array $auth, string $dsn): AuthenticateInterface return match ($auth['type'] ?? null) { 'basic' => Authenticate::basic( - $auth['username'] ?? throw new InvalidArgumentException('Missing username for basic authentication'), - $auth['password'] ?? throw new InvalidArgumentException('Missing password for basic authentication') + $auth['username'] ?? throw new \InvalidArgumentException('Missing username for basic authentication'), + $auth['password'] ?? throw new \InvalidArgumentException('Missing password for basic authentication') ), 'kerberos' => Authenticate::kerberos( - $auth['token'] ?? throw new InvalidArgumentException('Missing token for kerberos authentication') + $auth['token'] ?? throw new \InvalidArgumentException('Missing token for kerberos authentication') ), 'dsn', null => Authenticate::fromUrl(Uri::create($dsn)), 'none' => Authenticate::disabled(), 'oid' => Authenticate::oidc( - $auth['token'] ?? throw new InvalidArgumentException('Missing token for oid authentication') + $auth['token'] ?? throw new \InvalidArgumentException('Missing token for oid authentication') ), }; } diff --git a/tests/Functional/IntegrationTest.php b/tests/Functional/IntegrationTest.php index b807cb1..5684265 100644 --- a/tests/Functional/IntegrationTest.php +++ b/tests/Functional/IntegrationTest.php @@ -1,7 +1,7 @@ expectException(RuntimeException::class); + $this->expectException(\RuntimeException::class); $this->expectExceptionMessageMatches( "/Cannot connect to any server on alias: neo4j_undefined_configs with Uris: \('bolt:\/\/(localhost|localhostt)'\)/" ); @@ -231,11 +227,11 @@ public function testPriority(): void $client = $container->get('neo4j.client'); /** @var DriverSetupManager $drivers */ $drivers = $this->getPrivateProperty($client, 'driverSetups'); - /** @var array> $fallbackDriverQueue */ + /** @var array<\SplPriorityQueue> $fallbackDriverQueue */ $driverSetups = $this->getPrivateProperty($drivers, 'driverSetups'); - /** @var SplPriorityQueue $fallbackDriverQueue */ + /** @var \SplPriorityQueue $fallbackDriverQueue */ $fallbackDriverQueue = $driverSetups['neo4j-fallback-mechanism']; - $fallbackDriverQueue->setExtractFlags(SplPriorityQueue::EXTR_BOTH); + $fallbackDriverQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH); /** @var array{data: DriverSetup, priority: int} $extractedValue */ $extractedValue = $fallbackDriverQueue->extract(); @@ -266,7 +262,7 @@ public function testDefaultLogLevel(): void private function getPrivateProperty(object $object, string $property): mixed { - $reflection = new ReflectionClass($object); + $reflection = new \ReflectionClass($object); $property = $reflection->getProperty($property); return $property->getValue($object); From d9199f248365fba34d09833f65ee1eb466269bc7 Mon Sep 17 00:00:00 2001 From: Ghlen Nagels Date: Tue, 27 May 2025 15:08:08 +0530 Subject: [PATCH 3/3] drop symfony 5.4 support --- .github/workflows/tests.yml | 8 +++++--- composer.json | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3058801..b7d34af 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/composer.json b/composer.json index c650a76..ad4b2af 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,8 @@ "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.75", @@ -29,16 +29,16 @@ "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": {