Skip to content

Commit

Permalink
Drop support for symfony 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ilario-pierbattista committed Nov 11, 2023
1 parent a9d7804 commit 86246c7
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 26 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="true"/>
</php>
<testsuites>
<testsuite name="MongoBundle Test Suite">
Expand Down
9 changes: 6 additions & 3 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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
]);
};
8 changes: 2 additions & 6 deletions src/Capsule/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Command/DropCollectionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion src/Command/DropDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/Command/LoadFixturesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Check failure on line 26 in src/DependencyInjection/Configuration.php

View workflow job for this annotation

GitHub Actions / PHPStan

Ignored error pattern #^Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:children\(\)\.$# in path /home/runner/work/mongodb-bundle/mongodb-bundle/src/DependencyInjection/Configuration.php is expected to occur 3 times, but occurred 7 times.
self::addClients($rootBuilder->children());
Expand Down
6 changes: 1 addition & 5 deletions src/Services/ClientRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Command/AbstractCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down

0 comments on commit 86246c7

Please sign in to comment.