From b130b15e45958f24cbbe8a6ccad9c90e3af1633d Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Fri, 16 Jun 2023 12:20:39 +0200 Subject: [PATCH 1/7] Upgrade to Symfony v5.4 minimum --- .github/workflows/tests.yml | 2 -- README.md | 2 +- composer.json | 14 +++++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 72ddc103..e8f2597c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,8 +19,6 @@ jobs: matrix: php-version: ['7.4', '8.0', '8.1', '8.2'] include: - - php-version: '7.4' - sf-version: '4.4.*' - php-version: '7.4' sf-version: '5.4.*' - php-version: '8.0' diff --git a/README.md b/README.md index ed2b2655..e002d339 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Also, see our [Documentation](https://docs.meilisearch.com/learn/tutorials/getti ## 📝 Requirements * **Require** PHP 7.4 and later. -* **Compatible** with Symfony 4.0 and later. +* **Compatible** with Symfony 5.4 and later. * **Support** Doctrine ORM and Doctrine MongoDB. ## 🤖 Compatibility with Meilisearch diff --git a/composer.json b/composer.json index cea92a73..73c6b0de 100644 --- a/composer.json +++ b/composer.json @@ -22,9 +22,9 @@ "ext-json": "*", "doctrine/doctrine-bundle": "^2.4", "meilisearch/meilisearch-php": "^1.0.0", - "symfony/filesystem": "^4.4 || ^5.0 || ^6.0", - "symfony/property-access": "^4.4 || ^5.0 || ^6.0", - "symfony/serializer": "^4.4 || ^5.0 || ^6.0" + "symfony/filesystem": "^5.4 || ^6.0", + "symfony/property-access": "^5.4 || ^6.0", + "symfony/serializer": "^5.4 || ^6.0" }, "require-dev": { "doctrine/annotations": "^2.0", @@ -39,10 +39,10 @@ "phpstan/phpstan-phpunit": "^1.3.10", "phpstan/phpstan-symfony": "^1.2.23", "phpunit/php-code-coverage": "^9.2.26", - "symfony/doctrine-bridge": "^4.4 || ^5.0 || ^6.0", - "symfony/http-client": "^4.4 || ^5.0 || ^6.0", - "symfony/phpunit-bridge": "^4.4 || ^5.0 || ^6.0", - "symfony/yaml": "^4.4 || ^5.0 || ^6.0" + "symfony/doctrine-bridge": "^5.4 || ^6.0", + "symfony/http-client": "^5.4 || ^6.0", + "symfony/phpunit-bridge": "^5.4 || ^6.0", + "symfony/yaml": "^5.4 || ^6.0" }, "autoload": { "psr-4": { From 68adc252af732acd28b6bdf790c22f2f6d334dfc Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Fri, 16 Jun 2023 12:27:11 +0200 Subject: [PATCH 2/7] Leverage Rector --- composer.json | 3 ++- rector.php | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 rector.php diff --git a/composer.json b/composer.json index 73c6b0de..872d3bcb 100644 --- a/composer.json +++ b/composer.json @@ -29,16 +29,17 @@ "require-dev": { "doctrine/annotations": "^2.0", "doctrine/orm": "^2.9", - "phpmd/phpmd": "^2.13", "matthiasnoback/symfony-dependency-injection-test": "^4.3", "nyholm/psr7": "^1.5.1", "php-cs-fixer/shim": "^3.14", + "phpmd/phpmd": "^2.13", "phpstan/extension-installer": "^1.2", "phpstan/phpstan": "^1.10.6", "phpstan/phpstan-doctrine": "^1.3.33", "phpstan/phpstan-phpunit": "^1.3.10", "phpstan/phpstan-symfony": "^1.2.23", "phpunit/php-code-coverage": "^9.2.26", + "rector/rector": "^0.17.1", "symfony/doctrine-bridge": "^5.4 || ^6.0", "symfony/http-client": "^5.4 || ^6.0", "symfony/phpunit-bridge": "^5.4 || ^6.0", diff --git a/rector.php b/rector.php new file mode 100644 index 00000000..bedd535c --- /dev/null +++ b/rector.php @@ -0,0 +1,17 @@ +paths([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]); + + $rectorConfig->sets([ + SymfonyLevelSetList::UP_TO_SYMFONY_54 + ]); +}; From 5dbe03b318971efcff354624e8a6e5ab96b44e39 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Fri, 16 Jun 2023 12:28:02 +0200 Subject: [PATCH 3/7] Run Rector --- src/Command/MeilisearchClearCommand.php | 4 ++-- src/Command/MeilisearchCreateCommand.php | 4 ++-- src/Command/MeilisearchDeleteCommand.php | 4 ++-- src/Command/MeilisearchImportCommand.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Command/MeilisearchClearCommand.php b/src/Command/MeilisearchClearCommand.php index ffbb465d..2c3f9000 100644 --- a/src/Command/MeilisearchClearCommand.php +++ b/src/Command/MeilisearchClearCommand.php @@ -4,6 +4,7 @@ namespace Meilisearch\Bundle\Command; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -26,7 +27,6 @@ public static function getDefaultDescription(): string protected function configure(): void { $this - ->setDescription(self::getDefaultDescription()) ->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names'); } @@ -54,6 +54,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('Done!'); - return 0; + return Command::SUCCESS; } } diff --git a/src/Command/MeilisearchCreateCommand.php b/src/Command/MeilisearchCreateCommand.php index d2c32157..db852eed 100644 --- a/src/Command/MeilisearchCreateCommand.php +++ b/src/Command/MeilisearchCreateCommand.php @@ -11,6 +11,7 @@ use Meilisearch\Bundle\SearchService; use Meilisearch\Bundle\SettingsProvider; use Meilisearch\Client; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -39,7 +40,6 @@ public static function getDefaultDescription(): string protected function configure(): void { $this - ->setDescription(self::getDefaultDescription()) ->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names'); } @@ -112,6 +112,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('Done!'); - return 0; + return Command::SUCCESS; } } diff --git a/src/Command/MeilisearchDeleteCommand.php b/src/Command/MeilisearchDeleteCommand.php index a316ed19..fec42c90 100644 --- a/src/Command/MeilisearchDeleteCommand.php +++ b/src/Command/MeilisearchDeleteCommand.php @@ -6,6 +6,7 @@ use Meilisearch\Bundle\Collection; use Meilisearch\Exceptions\ApiException; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -28,7 +29,6 @@ public static function getDefaultDescription(): string protected function configure(): void { $this - ->setDescription(self::getDefaultDescription()) ->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names'); } @@ -54,6 +54,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('Done!'); - return 0; + return Command::SUCCESS; } } diff --git a/src/Command/MeilisearchImportCommand.php b/src/Command/MeilisearchImportCommand.php index 8bf1a2e7..50169a35 100644 --- a/src/Command/MeilisearchImportCommand.php +++ b/src/Command/MeilisearchImportCommand.php @@ -13,6 +13,7 @@ use Meilisearch\Bundle\SettingsProvider; use Meilisearch\Client; use Meilisearch\Exceptions\TimeOutException; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -48,7 +49,6 @@ public static function getDefaultDescription(): string protected function configure(): void { $this - ->setDescription(self::getDefaultDescription()) ->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names') ->addOption( 'update-settings', @@ -189,7 +189,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('Done!'); - return 0; + return Command::SUCCESS; } /** From 9cc36be92628a669d8e1d2e5ceb0bd422451fa9c Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Sun, 25 Jun 2023 10:56:34 +0200 Subject: [PATCH 4/7] Leverage new symfony command name and description definition --- composer.json | 1 - rector.php | 17 ----------------- src/Command/IndexCommand.php | 2 +- src/Command/MeilisearchClearCommand.php | 17 +++-------------- src/Command/MeilisearchCreateCommand.php | 16 ++++------------ src/Command/MeilisearchDeleteCommand.php | 16 +++------------- src/Command/MeilisearchImportCommand.php | 16 +++------------- 7 files changed, 14 insertions(+), 71 deletions(-) delete mode 100644 rector.php diff --git a/composer.json b/composer.json index 872d3bcb..bb4de149 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,6 @@ "phpstan/phpstan-phpunit": "^1.3.10", "phpstan/phpstan-symfony": "^1.2.23", "phpunit/php-code-coverage": "^9.2.26", - "rector/rector": "^0.17.1", "symfony/doctrine-bridge": "^5.4 || ^6.0", "symfony/http-client": "^5.4 || ^6.0", "symfony/phpunit-bridge": "^5.4 || ^6.0", diff --git a/rector.php b/rector.php deleted file mode 100644 index bedd535c..00000000 --- a/rector.php +++ /dev/null @@ -1,17 +0,0 @@ -paths([ - __DIR__ . '/src', - __DIR__ . '/tests', - ]); - - $rectorConfig->sets([ - SymfonyLevelSetList::UP_TO_SYMFONY_54 - ]); -}; diff --git a/src/Command/IndexCommand.php b/src/Command/IndexCommand.php index 5b54d373..e60dcd0a 100644 --- a/src/Command/IndexCommand.php +++ b/src/Command/IndexCommand.php @@ -11,7 +11,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** - * Class IndexCommand. + * Base command class all commands extends. */ abstract class IndexCommand extends Command { diff --git a/src/Command/MeilisearchClearCommand.php b/src/Command/MeilisearchClearCommand.php index 2c3f9000..65551d29 100644 --- a/src/Command/MeilisearchClearCommand.php +++ b/src/Command/MeilisearchClearCommand.php @@ -9,25 +9,14 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -/** - * Class MeilisearchClearCommand. - */ final class MeilisearchClearCommand extends IndexCommand { - public static function getDefaultName(): string - { - return 'meili:clear'; - } - - public static function getDefaultDescription(): string - { - return 'Clear the index documents'; - } + protected static $defaultName = 'meili:clear'; + protected static $defaultDescription = 'Clear the index documents'; protected function configure(): void { - $this - ->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names'); + $this->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names'); } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Command/MeilisearchCreateCommand.php b/src/Command/MeilisearchCreateCommand.php index db852eed..252a8d3e 100644 --- a/src/Command/MeilisearchCreateCommand.php +++ b/src/Command/MeilisearchCreateCommand.php @@ -20,6 +20,9 @@ final class MeilisearchCreateCommand extends IndexCommand { private Client $searchClient; + protected static $defaultName = 'meili:create'; + protected static $defaultDescription = 'Create indexes'; + public function __construct(SearchService $searchService, Client $searchClient) { parent::__construct($searchService); @@ -27,20 +30,9 @@ public function __construct(SearchService $searchService, Client $searchClient) $this->searchClient = $searchClient; } - public static function getDefaultName(): string - { - return 'meili:create'; - } - - public static function getDefaultDescription(): string - { - return 'Create indexes'; - } - protected function configure(): void { - $this - ->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names'); + $this->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names'); } private function entitiesToIndex($indexes): array diff --git a/src/Command/MeilisearchDeleteCommand.php b/src/Command/MeilisearchDeleteCommand.php index fec42c90..dd63220f 100644 --- a/src/Command/MeilisearchDeleteCommand.php +++ b/src/Command/MeilisearchDeleteCommand.php @@ -11,25 +11,15 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -/** - * Class MeilisearchDeleteCommand. - */ final class MeilisearchDeleteCommand extends IndexCommand { - public static function getDefaultName(): string - { - return 'meili:delete'; - } - public static function getDefaultDescription(): string - { - return 'Delete the indexes'; - } + protected static $defaultName = 'meili:delete'; + protected static $defaultDescription = 'Delete the indexes'; protected function configure(): void { - $this - ->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names'); + $this->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names'); } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Command/MeilisearchImportCommand.php b/src/Command/MeilisearchImportCommand.php index 50169a35..49f49091 100644 --- a/src/Command/MeilisearchImportCommand.php +++ b/src/Command/MeilisearchImportCommand.php @@ -18,13 +18,13 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -/** - * Class MeilisearchImportCommand. - */ final class MeilisearchImportCommand extends IndexCommand { private const DEFAULT_RESPONSE_TIMEOUT = 5000; + protected static $defaultName = 'meili:import'; + protected static $defaultDescription = 'Import given entity into search engine'; + protected Client $searchClient; protected ManagerRegistry $managerRegistry; @@ -36,16 +36,6 @@ public function __construct(SearchService $searchService, ManagerRegistry $manag $this->searchClient = $searchClient; } - public static function getDefaultName(): string - { - return 'meili:import'; - } - - public static function getDefaultDescription(): string - { - return 'Import given entity into search engine'; - } - protected function configure(): void { $this From e0a4fe4a7871ac2dfe6979166f7caca9c79420a5 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Sun, 25 Jun 2023 11:09:17 +0200 Subject: [PATCH 5/7] Add Symfony v6.3 to the CI --- .github/workflows/tests.yml | 2 ++ bors.toml | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e8f2597c..275faa7f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,6 +29,8 @@ jobs: sf-version: '6.1.*' - php-version: '8.2' sf-version: '6.2.*' + - php-version: '8.2' + sf-version: '6.3.*' name: integration-tests (PHP ${{ matrix.php-version }}) (Symfony ${{ matrix.sf-version }}) steps: diff --git a/bors.toml b/bors.toml index 330d47fe..120873c9 100644 --- a/bors.toml +++ b/bors.toml @@ -3,6 +3,7 @@ status = [ 'integration-tests (PHP 8.0) (Symfony 6.0.*)', 'integration-tests (PHP 8.1) (Symfony 6.1.*)', 'integration-tests (PHP 8.2) (Symfony 6.2.*)', + 'integration-tests (PHP 8.2) (Symfony 6.3.*)', 'Code style' ] # 1 hour timeout From 6fa5d64f3768ca3365da760aa6cb8efb318dd5c2 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Mon, 10 Jul 2023 08:12:54 +0200 Subject: [PATCH 6/7] cs fix --- src/Command/MeilisearchDeleteCommand.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Command/MeilisearchDeleteCommand.php b/src/Command/MeilisearchDeleteCommand.php index dd63220f..2c6fc45e 100644 --- a/src/Command/MeilisearchDeleteCommand.php +++ b/src/Command/MeilisearchDeleteCommand.php @@ -13,7 +13,6 @@ final class MeilisearchDeleteCommand extends IndexCommand { - protected static $defaultName = 'meili:delete'; protected static $defaultDescription = 'Delete the indexes'; From 03afde9a5431ef4a72238b55122edc5c08a899db Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Tue, 11 Jul 2023 12:11:51 +0200 Subject: [PATCH 7/7] Add back method until going full attributes --- src/Command/MeilisearchClearCommand.php | 10 ++++++++++ src/Command/MeilisearchCreateCommand.php | 10 ++++++++++ src/Command/MeilisearchDeleteCommand.php | 10 ++++++++++ src/Command/MeilisearchImportCommand.php | 10 ++++++++++ 4 files changed, 40 insertions(+) diff --git a/src/Command/MeilisearchClearCommand.php b/src/Command/MeilisearchClearCommand.php index 65551d29..814caba8 100644 --- a/src/Command/MeilisearchClearCommand.php +++ b/src/Command/MeilisearchClearCommand.php @@ -14,6 +14,16 @@ final class MeilisearchClearCommand extends IndexCommand protected static $defaultName = 'meili:clear'; protected static $defaultDescription = 'Clear the index documents'; + public static function getDefaultName(): string + { + return self::$defaultName; + } + + public static function getDefaultDescription(): string + { + return self::$defaultDescription; + } + protected function configure(): void { $this->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names'); diff --git a/src/Command/MeilisearchCreateCommand.php b/src/Command/MeilisearchCreateCommand.php index 252a8d3e..2d207f09 100644 --- a/src/Command/MeilisearchCreateCommand.php +++ b/src/Command/MeilisearchCreateCommand.php @@ -30,6 +30,16 @@ public function __construct(SearchService $searchService, Client $searchClient) $this->searchClient = $searchClient; } + public static function getDefaultName(): string + { + return self::$defaultName; + } + + public static function getDefaultDescription(): string + { + return self::$defaultDescription; + } + protected function configure(): void { $this->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names'); diff --git a/src/Command/MeilisearchDeleteCommand.php b/src/Command/MeilisearchDeleteCommand.php index 2c6fc45e..1f7459e4 100644 --- a/src/Command/MeilisearchDeleteCommand.php +++ b/src/Command/MeilisearchDeleteCommand.php @@ -13,6 +13,16 @@ final class MeilisearchDeleteCommand extends IndexCommand { + public static function getDefaultName(): string + { + return self::$defaultName; + } + + public static function getDefaultDescription(): string + { + return self::$defaultDescription; + } + protected static $defaultName = 'meili:delete'; protected static $defaultDescription = 'Delete the indexes'; diff --git a/src/Command/MeilisearchImportCommand.php b/src/Command/MeilisearchImportCommand.php index 49f49091..e8aef4d6 100644 --- a/src/Command/MeilisearchImportCommand.php +++ b/src/Command/MeilisearchImportCommand.php @@ -36,6 +36,16 @@ public function __construct(SearchService $searchService, ManagerRegistry $manag $this->searchClient = $searchClient; } + public static function getDefaultName(): string + { + return self::$defaultName; + } + + public static function getDefaultDescription(): string + { + return self::$defaultDescription; + } + protected function configure(): void { $this