diff --git a/CHANGELOG.md b/CHANGELOG.md index dee05b79..3449610c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added * CI coverage for PHP 8.1 and 8.2 ### Removed -* Removed support for PHP < 7.4 +* Support for PHP < 7.4 +* Support for Symfony < 4.4 * Docker images dev-dependency from https://github.com/ilario-pierbattista/docker-php-mongodb-bundle ## [1.5.0] (2022-01-06) diff --git a/composer.json b/composer.json index ea225825..c1027ff7 100644 --- a/composer.json +++ b/composer.json @@ -22,12 +22,12 @@ "php": "^7.4 || ^8.0", "ext-mongodb": "^1.6", "mongodb/mongodb": "^1.5", - "symfony/framework-bundle": "^3.4 || ^4.3 || ^5.0 || ^6.0" + "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0" }, "require-dev": { "matthiasnoback/symfony-dependency-injection-test": "^4", - "symfony/web-profiler-bundle": "^3.4 || ^4.3 || ^5.0 || ^6.0", - "symfony/console": "^3.4 || ^4.3 || ^5.0 || ^6.0", + "symfony/web-profiler-bundle": "^4.4 || ^5.0 || ^6.0", + "symfony/console": "^4.4 || ^5.0 || ^6.0", "phpunit/phpunit": "^9.6.13", "symfony/phpunit-bridge": "^6.0", "facile-it/facile-coding-standard": "^0.4.0", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0445e193..79a0cf93 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -13,7 +13,7 @@ - + diff --git a/rector.php b/rector.php index 6da0e7d8..321b6225 100644 --- a/rector.php +++ b/rector.php @@ -2,10 +2,11 @@ declare(strict_types=1); -use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; +use Rector\PHPUnit\PHPUnit100\Rector\Class_\AddProphecyTraitRector; +use Rector\PHPUnit\Set\PHPUnitLevelSetList; use Rector\PHPUnit\Set\PHPUnitSetList; -use Rector\Set\ValueObject\LevelSetList; +use Rector\Symfony\Set\SymfonyLevelSetList; return static function (RectorConfig $rectorConfig): void { $rectorConfig->paths([ @@ -14,9 +15,11 @@ ]); // register a single rule - $rectorConfig->rule(\Rector\PHPUnit\PHPUnit100\Rector\Class_\AddProphecyTraitRector::class); + $rectorConfig->rule(AddProphecyTraitRector::class); $rectorConfig->sets([ PHPUnitSetList::PHPUNIT_90, + PHPUnitLevelSetList::UP_TO_PHPUNIT_90, + SymfonyLevelSetList::UP_TO_SYMFONY_44 ]); }; diff --git a/src/Capsule/Collection.php b/src/Capsule/Collection.php index 49e84757..574eb03c 100644 --- a/src/Capsule/Collection.php +++ b/src/Capsule/Collection.php @@ -215,11 +215,7 @@ private function prepareQuery(string $method, $filters, $data, array $options): ); $event = new QueryEvent($query); - if (Kernel::VERSION_ID >= 40300) { - $this->eventDispatcher->dispatch($event, QueryEvent::QUERY_PREPARED); - } else { - $this->eventDispatcher->dispatch(QueryEvent::QUERY_PREPARED, $event); - } + $this->eventDispatcher->dispatch($event, QueryEvent::QUERY_PREPARED); return $query; } @@ -258,7 +254,7 @@ private function notifyQueryExecution(Query $queryLog) if (Kernel::VERSION_ID >= 40300) { $this->eventDispatcher->dispatch($event, QueryEvent::QUERY_EXECUTED); } else { - $this->eventDispatcher->dispatch(QueryEvent::QUERY_EXECUTED, $event); + $this->eventDispatcher->dispatch($event, QueryEvent::QUERY_EXECUTED); } } diff --git a/src/Command/DropCollectionCommand.php b/src/Command/DropCollectionCommand.php index 044aaa6c..4e4b719e 100644 --- a/src/Command/DropCollectionCommand.php +++ b/src/Command/DropCollectionCommand.php @@ -28,7 +28,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $collection = $input->getArgument('collection'); diff --git a/src/Command/DropDatabaseCommand.php b/src/Command/DropDatabaseCommand.php index 9b9175f8..c17cdf83 100644 --- a/src/Command/DropDatabaseCommand.php +++ b/src/Command/DropDatabaseCommand.php @@ -26,7 +26,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->io->writeln(sprintf('Dropping database %s', $this->connection->getDatabaseName())); $this->connection->drop(); diff --git a/src/Command/LoadFixturesCommand.php b/src/Command/LoadFixturesCommand.php index b961a792..6bbb7e0d 100644 --- a/src/Command/LoadFixturesCommand.php +++ b/src/Command/LoadFixturesCommand.php @@ -42,7 +42,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->io->writeln('Loading mongo fixtures'); /** @var Application $application */ diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 3ee2da1c..08a75911 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -21,9 +21,7 @@ final class Configuration implements ConfigurationInterface public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('mongo_db_bundle'); - $rootBuilder = \method_exists(TreeBuilder::class, 'getRootNode') - ? $treeBuilder->getRootNode() - : $treeBuilder->root('mongo_db_bundle'); + $rootBuilder = $treeBuilder->getRootNode(); self::addDataCollection($rootBuilder->children()); self::addClients($rootBuilder->children()); diff --git a/src/Services/ClientRegistry.php b/src/Services/ClientRegistry.php index 8b63a9c5..0663639e 100644 --- a/src/Services/ClientRegistry.php +++ b/src/Services/ClientRegistry.php @@ -121,11 +121,7 @@ public function getClient(string $name, ?string $databaseName = null): Client $this->clients[$clientKey] = $this->buildClient($name, $conf->getUri(), $options, $conf->getDriverOptions()); $event = new ConnectionEvent($clientKey); - if (Kernel::VERSION_ID >= 40300) { - $this->eventDispatcher->dispatch($event, ConnectionEvent::CLIENT_CREATED); - } else { - $this->eventDispatcher->dispatch(ConnectionEvent::CLIENT_CREATED, $event); - } + $this->eventDispatcher->dispatch($event, ConnectionEvent::CLIENT_CREATED); } return $this->clients[$clientKey]; diff --git a/tests/Functional/Command/AbstractCommandTest.php b/tests/Functional/Command/AbstractCommandTest.php index fafe448c..5247b77f 100644 --- a/tests/Functional/Command/AbstractCommandTest.php +++ b/tests/Functional/Command/AbstractCommandTest.php @@ -70,7 +70,7 @@ protected function configure() ->setDescription('fake test command'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->io->writeln('Executed');