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"]' 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" 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; 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..682910c6 100644 --- a/tests/Validator/Service/NoObjectExistsFactoryTest.php +++ b/tests/Validator/Service/NoObjectExistsFactoryTest.php @@ -11,16 +11,17 @@ 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; /** * Generated by PHPUnit_SkeletonGenerator on 2017-09-04 at 11:12:27. - * - * @coversDefaultClass NoObjectExistsFactory - * @group validator */ +#[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;