From 0f3c5b155fcb3b34c2fd33a432b24a73b1a28d8a Mon Sep 17 00:00:00 2001 From: Tom H Anderson Date: Mon, 5 Aug 2024 19:03:51 -0600 Subject: [PATCH 1/5] Removed PHP 8.0 from CI --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index ded7619f..68ee85b1 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -13,4 +13,4 @@ jobs: name: "PHPUnit" uses: "doctrine/.github/.github/workflows/continuous-integration.yml@2.1.0" with: - php-versions: '["8.0", "8.1", "8.2", "8.3"]' + php-versions: '["8.1", "8.2", "8.3"]' From 29d3cb8491004bf38c20b7097fb7a488860681ac Mon Sep 17 00:00:00 2001 From: Tom H Anderson Date: Wed, 14 Aug 2024 18:43:52 -0600 Subject: [PATCH 2/5] Changed __invoke declaration to be forward compaible --- src/Service/Authentication/AdapterFactory.php | 2 +- src/Service/Authentication/AuthenticationServiceFactory.php | 2 +- src/Service/Authentication/StorageFactory.php | 2 +- src/Service/CacheFactory.php | 2 +- src/Service/DriverFactory.php | 2 +- src/Service/EventManagerFactory.php | 2 +- src/Validator/Service/NoObjectExistsFactory.php | 5 +---- src/Validator/Service/ObjectExistsFactory.php | 5 +---- src/Validator/Service/UniqueObjectFactory.php | 5 +---- 9 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/Service/Authentication/AdapterFactory.php b/src/Service/Authentication/AdapterFactory.php index 685fa1bc..220dea39 100644 --- a/src/Service/Authentication/AdapterFactory.php +++ b/src/Service/Authentication/AdapterFactory.php @@ -21,7 +21,7 @@ final class AdapterFactory extends AbstractFactory /** * {@inheritDoc} */ - public function __invoke(ContainerInterface $container, $requestedName, array|null $options = null) + public function __invoke(ContainerInterface $container, string $requestedName, array|null $options = null): mixed { $options = $this->getOptions($container, 'authentication'); diff --git a/src/Service/Authentication/AuthenticationServiceFactory.php b/src/Service/Authentication/AuthenticationServiceFactory.php index 893ca385..221135d3 100644 --- a/src/Service/Authentication/AuthenticationServiceFactory.php +++ b/src/Service/Authentication/AuthenticationServiceFactory.php @@ -17,7 +17,7 @@ final class AuthenticationServiceFactory extends AbstractFactory /** * {@inheritDoc} */ - public function __invoke(ContainerInterface $container, $requestedName, array|null $options = null) + public function __invoke(ContainerInterface $container, string $requestedName, array|null $options = null): mixed { return new AuthenticationService( $container->get('doctrine.authenticationstorage.' . $this->getName()), diff --git a/src/Service/Authentication/StorageFactory.php b/src/Service/Authentication/StorageFactory.php index 32730b50..b531cde0 100644 --- a/src/Service/Authentication/StorageFactory.php +++ b/src/Service/Authentication/StorageFactory.php @@ -21,7 +21,7 @@ final class StorageFactory extends AbstractFactory /** * {@inheritDoc} */ - public function __invoke(ContainerInterface $container, $requestedName, array|null $options = null) + public function __invoke(ContainerInterface $container, string $requestedName, array|null $options = null): mixed { $options = $this->getOptions($container, 'authentication'); diff --git a/src/Service/CacheFactory.php b/src/Service/CacheFactory.php index 6f06b309..58b6da23 100644 --- a/src/Service/CacheFactory.php +++ b/src/Service/CacheFactory.php @@ -26,7 +26,7 @@ final class CacheFactory extends AbstractFactory * * @throws RuntimeException */ - public function __invoke(ContainerInterface $container, $requestedName, array|null $options = null) + public function __invoke(ContainerInterface $container, string $requestedName, array|null $options = null): mixed { $options = $this->getOptions($container, 'cache'); diff --git a/src/Service/DriverFactory.php b/src/Service/DriverFactory.php index 4ef28135..e707a089 100644 --- a/src/Service/DriverFactory.php +++ b/src/Service/DriverFactory.php @@ -33,7 +33,7 @@ final class DriverFactory extends AbstractFactory * * @return MappingDriver */ - public function __invoke(ContainerInterface $container, $requestedName, array|null $options = null) + public function __invoke(ContainerInterface $container, string $requestedName, array|null $options = null): mixed { $options = $this->getOptions($container, 'driver'); diff --git a/src/Service/EventManagerFactory.php b/src/Service/EventManagerFactory.php index c5ed258e..56ce215d 100644 --- a/src/Service/EventManagerFactory.php +++ b/src/Service/EventManagerFactory.php @@ -25,7 +25,7 @@ final class EventManagerFactory extends AbstractFactory /** * {@inheritDoc} */ - public function __invoke(ContainerInterface $container, $requestedName, array|null $options = null) + public function __invoke(ContainerInterface $container, string $requestedName, array|null $options = null): mixed { $options = $this->getOptions($container, 'eventmanager'); diff --git a/src/Validator/Service/NoObjectExistsFactory.php b/src/Validator/Service/NoObjectExistsFactory.php index 13574bcc..7860984d 100644 --- a/src/Validator/Service/NoObjectExistsFactory.php +++ b/src/Validator/Service/NoObjectExistsFactory.php @@ -11,10 +11,7 @@ final class NoObjectExistsFactory extends AbstractValidatorFactory { protected string $validatorClass = NoObjectExists::class; - /** - * {@inheritDoc} - */ - public function __invoke(ContainerInterface $container, $requestedName, array|null $options = null) + public function __invoke(ContainerInterface $container, string $requestedName, array|null $options = null): mixed { $repository = $this->getRepository($container, $options); diff --git a/src/Validator/Service/ObjectExistsFactory.php b/src/Validator/Service/ObjectExistsFactory.php index 6a73dcd6..d54565ff 100644 --- a/src/Validator/Service/ObjectExistsFactory.php +++ b/src/Validator/Service/ObjectExistsFactory.php @@ -11,10 +11,7 @@ final class ObjectExistsFactory extends AbstractValidatorFactory { protected string $validatorClass = ObjectExists::class; - /** - * {@inheritDoc} - */ - public function __invoke(ContainerInterface $container, $requestedName, array|null $options = null) + public function __invoke(ContainerInterface $container, string $requestedName, array|null $options = null): mixed { $repository = $this->getRepository($container, $options); diff --git a/src/Validator/Service/UniqueObjectFactory.php b/src/Validator/Service/UniqueObjectFactory.php index e2e8b39f..7634e864 100644 --- a/src/Validator/Service/UniqueObjectFactory.php +++ b/src/Validator/Service/UniqueObjectFactory.php @@ -11,10 +11,7 @@ final class UniqueObjectFactory extends AbstractValidatorFactory { protected string $validatorClass = UniqueObject::class; - /** - * {@inheritDoc} - */ - public function __invoke(ContainerInterface $container, $requestedName, array|null $options = null) + public function __invoke(ContainerInterface $container, string $requestedName, array|null $options = null): mixed { $useContext = isset($options['use_context']) ? (bool) $options['use_context'] : false; From c7dd9dc00294d293045204d8648c3de7d3c36d8f Mon Sep 17 00:00:00 2001 From: Tom H Anderson Date: Wed, 14 Aug 2024 18:42:45 -0600 Subject: [PATCH 3/5] Cleared all phpunit deprecations --- tests/Cache/DoctrineCacheStorageTest.php | 4 ++-- tests/Form/Element/ObjectMultiCheckboxTest.php | 4 ++-- tests/Form/Element/ObjectRadioTest.php | 4 ++-- tests/Form/Element/ObjectSelectTest.php | 4 ++-- tests/Form/Element/ProxyTest.php | 4 ++-- tests/ModuleTest.php | 8 ++++++-- tests/Validator/{ => Adapter}/NoObjectExistsTest.php | 0 tests/Validator/{ => Adapter}/ObjectExistsTest.php | 4 ++-- tests/Validator/{ => Adapter}/UniqueObjectTest.php | 0 tests/Validator/Service/NoObjectExistsFactoryTest.php | 8 ++++++-- tests/Validator/Service/ObjectExistsFactoryTest.php | 7 ++++--- tests/Validator/Service/UniqueObjectFactoryTest.php | 7 ++++--- 12 files changed, 32 insertions(+), 22 deletions(-) rename tests/Validator/{ => Adapter}/NoObjectExistsTest.php (100%) rename tests/Validator/{ => Adapter}/ObjectExistsTest.php (98%) rename tests/Validator/{ => Adapter}/UniqueObjectTest.php (100%) diff --git a/tests/Cache/DoctrineCacheStorageTest.php b/tests/Cache/DoctrineCacheStorageTest.php index d3396f16..82f24f0e 100644 --- a/tests/Cache/DoctrineCacheStorageTest.php +++ b/tests/Cache/DoctrineCacheStorageTest.php @@ -12,6 +12,7 @@ use Laminas\Cache\Storage\Capabilities; use Laminas\Cache\Storage\StorageInterface; use Laminas\Stdlib\ErrorHandler; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use stdClass; @@ -32,9 +33,8 @@ /** * Tests for the cache bridge - * - * @covers \DoctrineModule\Cache\DoctrineCacheStorage */ +#[CoversClass(DoctrineCacheStorage::class)] class DoctrineCacheStorageTest extends TestCase { protected AdapterOptions $options; diff --git a/tests/Form/Element/ObjectMultiCheckboxTest.php b/tests/Form/Element/ObjectMultiCheckboxTest.php index a028c365..64af878d 100644 --- a/tests/Form/Element/ObjectMultiCheckboxTest.php +++ b/tests/Form/Element/ObjectMultiCheckboxTest.php @@ -7,13 +7,13 @@ use DoctrineModule\Form\Element\ObjectMultiCheckbox; use DoctrineModule\Form\Element\Proxy; use Laminas\Form\Element; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; /** * Tests for the ObjectMultiCheckbox element - * - * @covers \DoctrineModule\Form\Element\ObjectMultiCheckbox */ +#[CoversClass(ObjectMultiCheckbox::class)] class ObjectMultiCheckboxTest extends ProxyAwareElementTestCase { /** @var ObjectMultiCheckbox */ diff --git a/tests/Form/Element/ObjectRadioTest.php b/tests/Form/Element/ObjectRadioTest.php index de158e72..6a6e563b 100644 --- a/tests/Form/Element/ObjectRadioTest.php +++ b/tests/Form/Element/ObjectRadioTest.php @@ -7,13 +7,13 @@ use DoctrineModule\Form\Element\ObjectRadio; use DoctrineModule\Form\Element\Proxy; use Laminas\Form\Element; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; /** * Tests for the ObjectRadio element - * - * @covers \DoctrineModule\Form\Element\ObjectRadio */ +#[CoversClass(ObjectRadio::class)] class ObjectRadioTest extends ProxyAwareElementTestCase { /** @var ObjectRadio */ diff --git a/tests/Form/Element/ObjectSelectTest.php b/tests/Form/Element/ObjectSelectTest.php index 91204a9c..1ae9aec7 100644 --- a/tests/Form/Element/ObjectSelectTest.php +++ b/tests/Form/Element/ObjectSelectTest.php @@ -7,13 +7,13 @@ use DoctrineModule\Form\Element\ObjectSelect; use DoctrineModule\Form\Element\Proxy; use Laminas\Form\Element; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; /** * Tests for the ObjectSelect element - * - * @covers \DoctrineModule\Form\Element\ObjectSelect */ +#[CoversClass(ObjectSelect::class)] class ObjectSelectTest extends ProxyAwareElementTestCase { /** @var ObjectSelect */ diff --git a/tests/Form/Element/ProxyTest.php b/tests/Form/Element/ProxyTest.php index 228f64a0..940d308d 100644 --- a/tests/Form/Element/ProxyTest.php +++ b/tests/Form/Element/ProxyTest.php @@ -11,6 +11,7 @@ use DoctrineModule\Form\Element\Exception\InvalidRepositoryResultException; use DoctrineModule\Form\Element\Proxy; use DoctrineModuleTest\Form\Element\TestAsset\FormObject; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -24,9 +25,8 @@ /** * Tests for the Collection pagination adapter - * - * @covers \DoctrineModule\Form\Element\Proxy */ +#[CoversClass(Proxy::class)] class ProxyTest extends TestCase { /** @var MockObject&ClassMetadata */ diff --git a/tests/ModuleTest.php b/tests/ModuleTest.php index e36817fd..79285758 100644 --- a/tests/ModuleTest.php +++ b/tests/ModuleTest.php @@ -8,6 +8,7 @@ use Laminas\Mvc\Application; use Laminas\Mvc\MvcEvent; use Laminas\ServiceManager\ServiceManager; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -16,7 +17,7 @@ use function serialize; use function unserialize; -/** @covers \DoctrineModule\Module */ +#[CoversClass(Module::class)] class ModuleTest extends TestCase { /** @var MockObject&Application */ @@ -60,7 +61,10 @@ protected function setUp(): void ->will($this->returnValue($this->application)); } - /** @covers \DoctrineModule\Module::getConfig */ + /** + * FIXME: attributes for CoversFunction needed + * old: covers \DoctrineModule\Module::getConfig + */ #[Test] public function testGetConfig(): void { diff --git a/tests/Validator/NoObjectExistsTest.php b/tests/Validator/Adapter/NoObjectExistsTest.php similarity index 100% rename from tests/Validator/NoObjectExistsTest.php rename to tests/Validator/Adapter/NoObjectExistsTest.php diff --git a/tests/Validator/ObjectExistsTest.php b/tests/Validator/Adapter/ObjectExistsTest.php similarity index 98% rename from tests/Validator/ObjectExistsTest.php rename to tests/Validator/Adapter/ObjectExistsTest.php index 89d94b45..005bb311 100644 --- a/tests/Validator/ObjectExistsTest.php +++ b/tests/Validator/Adapter/ObjectExistsTest.php @@ -8,6 +8,7 @@ use DoctrineModule\Validator\ObjectExists; use Laminas\Validator\Exception\InvalidArgumentException; use Laminas\Validator\Exception\RuntimeException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase as BaseTestCase; use stdClass; @@ -16,9 +17,8 @@ /** * Tests for the ObjectExists validator - * - * @covers \DoctrineModule\Validator\ObjectExists */ +#[CoversClass(ObjectExists::class)] class ObjectExistsTest extends BaseTestCase { #[Test] diff --git a/tests/Validator/UniqueObjectTest.php b/tests/Validator/Adapter/UniqueObjectTest.php similarity index 100% rename from tests/Validator/UniqueObjectTest.php rename to tests/Validator/Adapter/UniqueObjectTest.php diff --git a/tests/Validator/Service/NoObjectExistsFactoryTest.php b/tests/Validator/Service/NoObjectExistsFactoryTest.php index d30718d3..1cc09332 100644 --- a/tests/Validator/Service/NoObjectExistsFactoryTest.php +++ b/tests/Validator/Service/NoObjectExistsFactoryTest.php @@ -11,6 +11,8 @@ use DoctrineModule\Validator\Service\NoObjectExistsFactory; use DoctrineModuleTest\Validator\TestAsset\DummyClass; use Laminas\ServiceManager\ServiceLocatorInterface; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; @@ -18,9 +20,11 @@ /** * Generated by PHPUnit_SkeletonGenerator on 2017-09-04 at 11:12:27. * - * @coversDefaultClass NoObjectExistsFactory - * @group validator + * CoversClass is valid but there is no CoversDefaultClass attribute. + * @ coversDefaultClass NoObjectExistsFactory */ +#[CoversClass(NoObjectExistsFactory::class)] +#[Group('validator')] class NoObjectExistsFactoryTest extends TestCase { private NoObjectExistsFactory $object; diff --git a/tests/Validator/Service/ObjectExistsFactoryTest.php b/tests/Validator/Service/ObjectExistsFactoryTest.php index d36b1b35..37cf8601 100644 --- a/tests/Validator/Service/ObjectExistsFactoryTest.php +++ b/tests/Validator/Service/ObjectExistsFactoryTest.php @@ -9,16 +9,17 @@ use DoctrineModule\Validator\ObjectExists; use DoctrineModule\Validator\Service\ObjectExistsFactory; use DoctrineModuleTest\Validator\TestAsset\DummyClass; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; /** * Generated by PHPUnit_SkeletonGenerator on 2017-09-04 at 11:55:36. - * - * @coversDefaultClass ObjectExistsFactory - * @group validator */ +#[CoversClass(ObjectExistsFactory::class)] +#[Group('validator')] class ObjectExistsFactoryTest extends TestCase { protected ObjectExistsFactory $object; diff --git a/tests/Validator/Service/UniqueObjectFactoryTest.php b/tests/Validator/Service/UniqueObjectFactoryTest.php index e6270397..0c530575 100644 --- a/tests/Validator/Service/UniqueObjectFactoryTest.php +++ b/tests/Validator/Service/UniqueObjectFactoryTest.php @@ -9,16 +9,17 @@ use DoctrineModule\Validator\Service\UniqueObjectFactory; use DoctrineModule\Validator\UniqueObject; use DoctrineModuleTest\Validator\TestAsset\DummyClass; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; /** * Generated by PHPUnit_SkeletonGenerator on 2017-09-04 at 11:57:37. - * - * @coversDefaultClass UniqueObjectFactory - * @group validator */ +#[CoversClass(UniqueObjectFactory::class)] +#[Group('validator')] class UniqueObjectFactoryTest extends TestCase { private UniqueObjectFactory $object; From 8d627aea9320f707abd64cb11a259d7ba3a9a765 Mon Sep 17 00:00:00 2001 From: Tom H Anderson Date: Wed, 14 Aug 2024 18:44:43 -0600 Subject: [PATCH 4/5] Added laminas cache adapter memory --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 355c810a..41ebeaac 100644 --- a/composer.json +++ b/composer.json @@ -58,6 +58,7 @@ }, "require-dev": { "doctrine/coding-standard": "^12.0", + "laminas/laminas-cache-storage-adapter-memory": "^3.0", "php-parallel-lint/php-parallel-lint": "^1.4", "phpstan/phpstan": "^1.11", "phpunit/phpunit": "^11.3" From 70151b6defe076a38c52225702cf6fa76953c403 Mon Sep 17 00:00:00 2001 From: Tom H Anderson Date: Wed, 14 Aug 2024 18:56:10 -0600 Subject: [PATCH 5/5] Removed comment about old @coversDefaultClass annotation --- tests/Validator/Service/NoObjectExistsFactoryTest.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/Validator/Service/NoObjectExistsFactoryTest.php b/tests/Validator/Service/NoObjectExistsFactoryTest.php index 1cc09332..682910c6 100644 --- a/tests/Validator/Service/NoObjectExistsFactoryTest.php +++ b/tests/Validator/Service/NoObjectExistsFactoryTest.php @@ -19,9 +19,6 @@ /** * Generated by PHPUnit_SkeletonGenerator on 2017-09-04 at 11:12:27. - * - * CoversClass is valid but there is no CoversDefaultClass attribute. - * @ coversDefaultClass NoObjectExistsFactory */ #[CoversClass(NoObjectExistsFactory::class)] #[Group('validator')]