diff --git a/.github/workflows/pre-release-tests.yml b/.github/workflows/pre-release-tests.yml index e5a43c7..17dbda6 100644 --- a/.github/workflows/pre-release-tests.yml +++ b/.github/workflows/pre-release-tests.yml @@ -40,7 +40,7 @@ jobs: strategy: matrix: php-version: [ '8.1', '8.2', '8.3', '8.4' ] - sf-version: ['6.4', '7.0', '7.1', '7.2', '7.3' ] + sf-version: ['6.4', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ] dependencies: [ 'default' ] exclude: - php-version: '8.1' @@ -51,6 +51,14 @@ jobs: sf-version: '7.2' - php-version: '8.1' sf-version: '7.3' + - php-version: '8.1' + sf-version: '7.4' + - php-version: '8.1' + sf-version: '8.0' + - php-version: '8.2' + sf-version: '8.0' + - php-version: '8.3' + sf-version: '8.0' include: - php-version: '8.4' sf-version: '6.4' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 25199f4..869a44c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: php-version: [ '8.1', '8.2', '8.3', '8.4' ] - sf-version: ['6.4', '7.0', '7.1', '7.2', '7.3' ] + sf-version: ['6.4', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ] dependencies: [ 'default' ] exclude: - php-version: '8.1' @@ -37,6 +37,14 @@ jobs: sf-version: '7.2' - php-version: '8.1' sf-version: '7.3' + - php-version: '8.1' + sf-version: '7.4' + - php-version: '8.1' + sf-version: '8.0' + - php-version: '8.2' + sf-version: '8.0' + - php-version: '8.3' + sf-version: '8.0' include: - php-version: '8.4' sf-version: '6.4' @@ -110,7 +118,6 @@ jobs: - name: PHPStan run: | - vendor/bin/simple-phpunit --version composer phpstan yaml-lint: diff --git a/Dockerfile b/Dockerfile index 5c57ef4..4bbcb61 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,16 @@ -FROM php:8.0-fpm as php +FROM php:8.5-fpm as php COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser ENV COMPOSER_ALLOW_SUPERUSER=1 RUN apt-get update && apt-get install -y \ - libfcgi0ldbl \ - zlib1g-dev \ - gettext \ - libzip-dev \ - unzip \ - git + libfcgi0ldbl \ + zlib1g-dev \ + gettext \ + libzip-dev \ + unzip \ + git RUN docker-php-ext-install zip diff --git a/README.md b/README.md index 86d3697..0d38547 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,8 @@ Say goodbye to server deployment and manual updates with [Meilisearch Cloud](htt ## 📝 Requirements -* **Require** PHP 7.4 and later. -* **Compatible** with Symfony 5.4 and later. +* **Require** PHP 8.1 and later. +* **Compatible** with Symfony 6.4 and later. For support of older versions, see older versions of this bundle. diff --git a/composer.json b/composer.json index 1591a14..fc5ee43 100644 --- a/composer.json +++ b/composer.json @@ -21,35 +21,34 @@ "php": "^8.1", "ext-json": "*", "meilisearch/meilisearch-php": "^1.16", - "symfony/config": "^6.4 || ^7.0", - "symfony/dependency-injection": "^6.4 || ^7.0", - "symfony/event-dispatcher": "^6.4 || ^7.0", - "symfony/http-kernel": "^6.4 || ^7.0", - "symfony/property-access": "^6.4 || ^7.0", - "symfony/serializer": "^6.4 || ^7.0" + "symfony/config": "^6.4 || ^7.0 || ^8.0", + "symfony/dependency-injection": "^6.4 || ^7.0 || ^8.0", + "symfony/event-dispatcher": "^6.4 || ^7.0 || ^8.0", + "symfony/http-kernel": "^6.4 || ^7.0 || ^8.0", + "symfony/property-access": "^6.4 || ^7.0 || ^8.0", + "symfony/serializer": "^6.4 || ^7.0 || ^8.0" }, "require-dev": { "doctrine/doctrine-bundle": "^2.10 || ^3.0", "doctrine/orm": "^2.12 || ^3.0", - "matthiasnoback/symfony-config-test": "^4.3 || ^5.2", - "matthiasnoback/symfony-dependency-injection-test": "^4.3 || ^5.1", + "matthiasnoback/symfony-config-test": "^6.1", + "matthiasnoback/symfony-dependency-injection-test": "^6.2", "nikic/php-parser": "^5.6.2", "nyholm/psr7": "^1.8.2", "php-cs-fixer/shim": "^3.90.0", - "phpmd/phpmd": "^2.15", "phpstan/extension-installer": "^1.4.3", "phpstan/phpstan": "^2.1.32", "phpstan/phpstan-doctrine": "^2.0.11", "phpstan/phpstan-phpunit": "^2.0.8", "phpstan/phpstan-symfony": "^2.0.8", - "phpunit/php-code-coverage": "^9.2.32", - "symfony/doctrine-bridge": "^6.4 || ^7.0", - "symfony/filesystem": "^6.4 || ^7.0", - "symfony/framework-bundle": "^6.4 || ^7.0", - "symfony/http-client": "^6.4.15 || ^7.1.8", - "symfony/phpunit-bridge": "^7.3", - "symfony/yaml": "^6.4 || ^7.0", - "symfony/var-exporter": "^6.4 || ^7.0" + "phpunit/php-code-coverage": "^10.1.16", + "phpunit/phpunit": "^10.5.60", + "symfony/doctrine-bridge": "^6.4 || ^7.0 || ^8.0", + "symfony/filesystem": "^6.4 || ^7.0 || ^8.0", + "symfony/framework-bundle": "^6.4 || ^7.0 || ^8.0", + "symfony/http-client": "^6.4.15 || ^7.1.8 || ^8.0", + "symfony/yaml": "^6.4 || ^7.0 || ^8.0", + "symfony/var-exporter": "^6.4 || ^7.0 || ^8.0" }, "autoload": { "psr-4": { @@ -69,10 +68,9 @@ } }, "scripts": { - "phpmd": "./vendor/bin/phpmd src text phpmd.xml", "phpstan": "./vendor/bin/phpstan", - "test:unit": "SYMFONY_DEPRECATIONS_HELPER='ignoreFile=./tests/baseline-ignore' ./vendor/bin/simple-phpunit --colors=always --verbose", - "test:unit:coverage": "SYMFONY_DEPRECATIONS_HELPER='ignoreFile=./tests/baseline-ignore' XDEBUG_MODE=coverage ./vendor/bin/simple-phpunit --colors=always --coverage-html=tests/coverage", + "test:unit": "./vendor/bin/phpunit --colors=always", + "test:unit:coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --colors=always --coverage-html=tests/coverage", "lint:check": "./vendor/bin/php-cs-fixer fix -v --using-cache=no --dry-run", "lint:fix": "./vendor/bin/php-cs-fixer fix -v --using-cache=no" } diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 80765e6..611c275 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -2,8 +2,6 @@ includes: - phpstan-baseline.php parameters: - bootstrapFiles: - - vendor/bin/.phpunit/phpunit/vendor/autoload.php level: 5 paths: - src diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d50518c..b43c63f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,12 +1,24 @@ - + xsi:noNamespaceSchemaLocation="vendor/bin/.phpunit/phpunit/phpunit.xsd" + displayDetailsOnIncompleteTests="true" + displayDetailsOnPhpunitDeprecations="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" + failOnDeprecation="false" + failOnNotice="true" + failOnWarning="true" + failOnRisky="true"> + src/ - + @@ -14,14 +26,14 @@ - + - tests/Integration + tests/Integration - tests/Unit + tests/Unit diff --git a/tests/Entity/Comment.php b/tests/Entity/Comment.php index 311fcdf..f08296c 100644 --- a/tests/Entity/Comment.php +++ b/tests/Entity/Comment.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * @ORM\Entity diff --git a/tests/Entity/ContentAggregator.php b/tests/Entity/ContentAggregator.php index 2346f16..4d5a93b 100644 --- a/tests/Entity/ContentAggregator.php +++ b/tests/Entity/ContentAggregator.php @@ -4,13 +4,8 @@ namespace Meilisearch\Bundle\Tests\Entity; -use Doctrine\ORM\Mapping as ORM; use Meilisearch\Bundle\Entity\Aggregator; -/** - * @ORM\Entity - */ -#[ORM\Entity] class ContentAggregator extends Aggregator { public function getIsVisible(): bool diff --git a/tests/Entity/DummyCustomGroups.php b/tests/Entity/DummyCustomGroups.php index d792358..e95ff39 100644 --- a/tests/Entity/DummyCustomGroups.php +++ b/tests/Entity/DummyCustomGroups.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * @ORM\Entity diff --git a/tests/Entity/EmptyAggregator.php b/tests/Entity/EmptyAggregator.php index ae62237..fa44def 100644 --- a/tests/Entity/EmptyAggregator.php +++ b/tests/Entity/EmptyAggregator.php @@ -4,13 +4,8 @@ namespace Meilisearch\Bundle\Tests\Entity; -use Doctrine\ORM\Mapping as ORM; use Meilisearch\Bundle\Entity\Aggregator; -/** - * @ORM\Entity - */ -#[ORM\Entity] class EmptyAggregator extends Aggregator { } diff --git a/tests/Entity/Page.php b/tests/Entity/Page.php index 2c30e2d..b10af8d 100644 --- a/tests/Entity/Page.php +++ b/tests/Entity/Page.php @@ -7,7 +7,7 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Meilisearch\Bundle\Tests\Entity\ObjectId\DummyObjectId; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * @ORM\Entity diff --git a/tests/Entity/Post.php b/tests/Entity/Post.php index e2ae2a8..91a9749 100644 --- a/tests/Entity/Post.php +++ b/tests/Entity/Post.php @@ -8,7 +8,7 @@ use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * @ORM\Entity diff --git a/tests/Integration/Command/MeilisearchCreateCommandTest.php b/tests/Integration/Command/MeilisearchCreateCommandTest.php index 32085d0..aa79265 100644 --- a/tests/Integration/Command/MeilisearchCreateCommandTest.php +++ b/tests/Integration/Command/MeilisearchCreateCommandTest.php @@ -6,6 +6,7 @@ use Meilisearch\Bundle\Tests\BaseKernelTestCase; use Meilisearch\Bundle\Tests\Entity\DynamicSettings; +use PHPUnit\Framework\Attributes\TestWith; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Tester\CommandTester; @@ -29,10 +30,8 @@ public function testExecuteIndexCreation(): void $this->assertSame($this->client->getTasks()->getResults()[0]['type'], 'indexCreation'); } - /** - * @testWith [false] - * [true] - */ + #[TestWith([false])] + #[TestWith([true])] public function testWithoutIndices(bool $updateSettings): void { $createCommand = $this->application->find('meilisearch:create'); diff --git a/tests/Kernel.php b/tests/Kernel.php index c423007..0045b16 100644 --- a/tests/Kernel.php +++ b/tests/Kernel.php @@ -9,7 +9,6 @@ use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; use Doctrine\ORM\Mapping\LegacyReflectionFields; use Meilisearch\Bundle\MeilisearchBundle; -use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\Config\Loader\LoaderInterface; @@ -51,16 +50,6 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa ]); } - if (class_exists(EntityValueResolver::class)) { - $container->prependExtensionConfig('doctrine', [ - 'orm' => [ - 'controller_resolver' => [ - 'auto_mapping' => false, - ], - ], - ]); - } - // @phpstan-ignore-next-line if (Kernel::VERSION_ID >= 70300) { $container->prependExtensionConfig('framework', [ diff --git a/tests/Unit/ConfigurationTest.php b/tests/Unit/ConfigurationTest.php index c884d63..ce420ff 100644 --- a/tests/Unit/ConfigurationTest.php +++ b/tests/Unit/ConfigurationTest.php @@ -6,6 +6,7 @@ use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait; use Meilisearch\Bundle\DependencyInjection\Configuration; +use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; final class ConfigurationTest extends KernelTestCase @@ -15,17 +16,14 @@ final class ConfigurationTest extends KernelTestCase /** * @param array $inputConfig * @param array $expectedConfig - * - * @dataProvider dataTestConfigurationTree */ + #[DataProvider('dataTestConfigurationTree')] public function testValidConfig(array $inputConfig, array $expectedConfig): void { $this->assertProcessedConfigurationEquals($inputConfig, $expectedConfig); } - /** - * @dataProvider dataTestSettingsDynamicCheckerInvalid - */ + #[DataProvider('dataTestSettingsDynamicCheckerInvalid')] public function testSettingsDynamicCheckerInvalid(mixed $value): void { $this->assertConfigurationIsInvalid([ @@ -41,9 +39,7 @@ public function testSettingsDynamicCheckerInvalid(mixed $value): void ], 'Settings must be an array.'); } - /** - * @dataProvider dataTestSettingsDynamicCheckerValid - */ + #[DataProvider('dataTestSettingsDynamicCheckerValid')] public function testSettingsDynamicCheckerValid(mixed $value): void { $this->assertConfigurationIsValid([ diff --git a/tests/baseline-ignore b/tests/baseline-ignore deleted file mode 100644 index 59ca12b..0000000 --- a/tests/baseline-ignore +++ /dev/null @@ -1,20 +0,0 @@ -%Method "ArrayAccess::offsetGet\(\)" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Meilisearch\\Contracts\\Data" now to avoid errors or add an explicit @return annotation to suppress this message.% -%Since symfony/var-exporter 7.3: The "Symfony\\Component\\VarExporter\\LazyGhostTrait" trait is deprecated, use native lazy objects instead.% -%Since symfony/var-exporter 7.3: Using ProxyHelper::generateLazyGhost\(\) is deprecated, use native lazy objects instead.% -%Class "Doctrine\\ORM\\Proxy\\Autoloader" is deprecated. Use native lazy objects instead.% -%Class "Doctrine\\ORM\\Proxy\\DefaultProxyClassNameResolver" is deprecated. Use native lazy objects instead.% -%Calling Doctrine\\ORM\\Configuration::(setProxyDir|getProxyDir) is deprecated and will not be possible in Doctrine ORM 4.0% -%Calling Doctrine\\ORM\\Configuration::(setAutoGenerateProxyClasses|getAutoGenerateProxyClasses) is deprecated and will not be possible in Doctrine ORM 4.0% -%Calling Doctrine\\ORM\\Configuration::setProxyNamespace is deprecated and will not be possible in Doctrine ORM 4.0% -%Since doctrine/doctrine-bundle 2.16: Not setting "doctrine.orm.enable_native_lazy_objects" to true is deprecated% -%The "report_fields_where_declared" configuration option is deprecated and will be removed in DoctrineBundle 3.0.% -%Implicitly marking parameter \$.+ as nullable is deprecated% -%The "Doctrine\\Bundle\\DoctrineBundle\\CacheWarmer\\DoctrineMetadataCacheWarmer::doWarmUp\(\)" method will require a new "string|null \$buildDir" argument in the next major version of its parent class "Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\AbstractPhpFileCacheWarmer", not defining it is deprecated% -%Constant E_STRICT is deprecated% -%Method "ArrayAccess::(offsetExists|offsetGet|offsetSet|offsetUnset)\(\)" might add ".+" as a native return type declaration in the future. Do the same in implementation "(Doctrine\\Common\\Collections\\.+|Doctrine\\ORM\\PersistentCollection)" now to avoid errors or add an explicit @return annotation to suppress this message% -%Method "Countable::count\(\)" might add "int" as a native return type declaration in the future. Do the same in implementation "Doctrine\\Common\\Collections\\.+" now to avoid errors or add an explicit @return annotation to suppress this message% -%Method "IteratorAggregate::getIterator\(\)" might add "\\Traversable" as a native return type declaration in the future\. Do the same in implementation "Doctrine\\Common\\Collections\\.+" now to avoid errors or add an explicit @return annotation to suppress this message% -%Return type of Doctrine\\Common\\Collections\\(ArrayCollection|AbstractLazyCollection)::count\(\) should either be compatible with Countable::count\(\): int, or the \#\[\\ReturnTypeWillChange\] attribute should be used to temporarily suppress the notice% -%Return type of Doctrine\\Common\\Collections\\(ArrayCollection|AbstractLazyCollection)::getIterator\(\) should either be compatible with IteratorAggregate::getIterator\(\): Traversable, or the \#\[\\ReturnTypeWillChange\] attribute should be used to temporarily suppress the notice% -%Return type of Doctrine\\Common\\Collections\\(ArrayCollection|AbstractLazyCollection)::(offsetExists|offsetGet|offsetSet|offsetUnset)\(\$offset.*\) should either be compatible with ArrayAccess::(offsetExists|offsetGet|offsetSet|offsetUnset)\(mixed \$offset.*\): .+, or the \#\[\\ReturnTypeWillChange\] attribute should be used to temporarily suppress the notice% -%Since doctrine/doctrine-bundle 3.1: The "auto_mapping" option is deprecated and will be removed in DoctrineBundle 4.0, as it only accepts `false` since 3.0.% diff --git a/tests/config/doctrine.yaml b/tests/config/doctrine.yaml index ddadaa0..7bc6a6a 100644 --- a/tests/config/doctrine.yaml +++ b/tests/config/doctrine.yaml @@ -9,7 +9,6 @@ doctrine: dummy_object_id: Meilisearch\Bundle\Tests\Dbal\Type\DummyObjectIdType orm: naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware - auto_mapping: true mappings: App: is_bundle: false diff --git a/tests/config/doctrine_old_proxy.yaml b/tests/config/doctrine_old_proxy.yaml index 55a8989..d0e5c02 100644 --- a/tests/config/doctrine_old_proxy.yaml +++ b/tests/config/doctrine_old_proxy.yaml @@ -10,7 +10,6 @@ doctrine: orm: auto_generate_proxy_classes: true naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware - auto_mapping: true mappings: App: is_bundle: false diff --git a/tests/config/doctrine_v2.yaml b/tests/config/doctrine_v2.yaml index 7abc037..2694ab8 100644 --- a/tests/config/doctrine_v2.yaml +++ b/tests/config/doctrine_v2.yaml @@ -11,7 +11,6 @@ doctrine: enable_native_lazy_objects: true auto_generate_proxy_classes: false naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware - auto_mapping: true mappings: App: is_bundle: false