From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Sat, 30 Aug 2025 16:09:53 +0200
Subject: Compatibility with recent PHPUnit (12)

---
 .../Factory/AbstractBaseFactoryTest.php            |  8 ++--
 .../AccessInterceptorScopeLocalizerFactoryTest.php |  2 +-
 .../AccessInterceptorValueHolderFactoryTest.php    |  6 +--
 .../Factory/LazyLoadingGhostFactoryTest.php        |  2 +-
 .../Factory/LazyLoadingValueHolderFactoryTest.php  |  6 +--
 .../Factory/NullObjectFactoryTest.php              |  6 +--
 .../RemoteObject/Adapter/BaseAdapterTest.php       |  3 ++
 .../Factory/RemoteObjectFactoryTest.php            |  2 +-
 ...cessInterceptorScopeLocalizerFunctionalTest.php | 53 ++++++++--------------
 .../AccessInterceptorValueHolderFunctionalTest.php | 44 ++++++++----------
 .../Functional/MultipleProxyGenerationTest.php     |  4 +-
 .../Functional/NullObjectFunctionalTest.php        | 40 ++++------------
 .../Functional/RemoteObjectFunctionalTest.php      | 11 +++--
 .../Generator/MethodGeneratorTest.php              |  9 ++--
 .../Generator/Util/IdentifierSuffixerTest.php      | 15 ++----
 .../Util/ProxiedMethodReturnExpressionTest.php     |  5 +-
 .../Util/UniqueIdentifierGeneratorTest.php         | 13 ++----
 .../FileWriterGeneratorStrategyTest.php            |  2 +-
 .../Inflector/ClassNameInflectorTest.php           |  7 ++-
 .../Inflector/Util/ParameterEncoderTest.php        |  4 +-
 .../Inflector/Util/ParameterHasherTest.php         |  4 +-
 .../Util/InterceptorGeneratorTest.php              |  8 ++--
 .../Util/InterceptorGeneratorTest.php              |  8 ++--
 .../Assertion/CanProxyAssertionTest.php            |  4 +-
 .../MethodGenerator/MagicGetTest.php               |  2 +
 .../ProxyGenerator/Util/PropertiesTest.php         |  4 +-
 .../Util/ProxiedMethodsFilterTest.php              |  7 ++-
 .../Util/UnsetPropertiesGeneratorTest.php          |  4 +-
 .../Signature/SignatureGeneratorTest.php           |  7 ++-
 29 files changed, 118 insertions(+), 172 deletions(-)

diff --git a/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php b/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php
index 1adebfb..ea8ffa1 100644
--- a/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php
+++ b/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace ProxyManagerTest\Factory;
 
 use Laminas\Code\Generator\ClassGenerator;
+use PHPUnit\Framework\Attributes\RequiresPhpunit;
 use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Autoloader\AutoloaderInterface;
@@ -26,6 +27,7 @@ use function class_exists;
  * @covers \ProxyManager\Factory\AbstractBaseFactory
  * @group Coverage
  */
+#[RequiresPhpunit('< 12')]
 final class AbstractBaseFactoryTest extends TestCase
 {
     /**
@@ -116,14 +118,14 @@ final class AbstractBaseFactoryTest extends TestCase
             ->expects(self::once())
             ->method('__invoke')
             ->with($generatedClass)
-            ->will(self::returnCallback(static function (string $className): bool {
+            ->willReturnCallback(static function (string $className): bool {
                 eval('class ' . $className . ' extends \\stdClass {}');
 
                 return true;
-            }));
+            });
 
         $this->signatureChecker->expects(self::atLeastOnce())->method('checkSignature');
-        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->will(self::returnArgument(0));
+        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->willReturnArgument(0);
         $this
             ->generator
             ->expects(self::once())
diff --git a/tests/ProxyManagerTest/Factory/AccessInterceptorScopeLocalizerFactoryTest.php b/tests/ProxyManagerTest/Factory/AccessInterceptorScopeLocalizerFactoryTest.php
index 472f833..eb3415c 100644
--- a/tests/ProxyManagerTest/Factory/AccessInterceptorScopeLocalizerFactoryTest.php
+++ b/tests/ProxyManagerTest/Factory/AccessInterceptorScopeLocalizerFactoryTest.php
@@ -175,7 +175,7 @@ final class AccessInterceptorScopeLocalizerFactoryTest extends TestCase
             ->willReturn(LazyLoadingMock::class);
 
         $this->signatureChecker->expects(self::atLeastOnce())->method('checkSignature');
-        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->will(self::returnArgument(0));
+        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->willReturnArgument(0);
 
         $factory            = new AccessInterceptorScopeLocalizerFactory($this->config);
         $prefixInterceptors = [
diff --git a/tests/ProxyManagerTest/Factory/AccessInterceptorValueHolderFactoryTest.php b/tests/ProxyManagerTest/Factory/AccessInterceptorValueHolderFactoryTest.php
index 69724a6..f70e966 100644
--- a/tests/ProxyManagerTest/Factory/AccessInterceptorValueHolderFactoryTest.php
+++ b/tests/ProxyManagerTest/Factory/AccessInterceptorValueHolderFactoryTest.php
@@ -127,8 +127,8 @@ final class AccessInterceptorValueHolderFactoryTest extends TestCase
         $generator      = $this->createMock(GeneratorStrategyInterface::class);
         $autoloader     = $this->createMock(AutoloaderInterface::class);
 
-        $this->config->method('getGeneratorStrategy')->will(self::returnValue($generator));
-        $this->config->method('getProxyAutoloader')->will(self::returnValue($autoloader));
+        $this->config->method('getGeneratorStrategy')->willReturn($generator);
+        $this->config->method('getProxyAutoloader')->willReturn($autoloader);
 
         $generator
             ->expects(self::once())
@@ -170,7 +170,7 @@ final class AccessInterceptorValueHolderFactoryTest extends TestCase
             ->willReturn(EmptyClass::class);
 
         $this->signatureChecker->expects(self::atLeastOnce())->method('checkSignature');
-        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->will(self::returnArgument(0));
+        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->willReturnArgument(0);
 
         $factory            = new AccessInterceptorValueHolderFactory($this->config);
         $prefixInterceptors = [
diff --git a/tests/ProxyManagerTest/Factory/LazyLoadingGhostFactoryTest.php b/tests/ProxyManagerTest/Factory/LazyLoadingGhostFactoryTest.php
index 829bd93..b4eba68 100644
--- a/tests/ProxyManagerTest/Factory/LazyLoadingGhostFactoryTest.php
+++ b/tests/ProxyManagerTest/Factory/LazyLoadingGhostFactoryTest.php
@@ -155,7 +155,7 @@ final class LazyLoadingGhostFactoryTest extends TestCase
             ->willReturn(LazyLoadingMock::class);
 
         $this->signatureChecker->expects(self::atLeastOnce())->method('checkSignature');
-        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->will(self::returnArgument(0));
+        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->willReturnArgument(0);
 
         $factory     = new LazyLoadingGhostFactory($this->config);
         $initializer = static function (): bool {
diff --git a/tests/ProxyManagerTest/Factory/LazyLoadingValueHolderFactoryTest.php b/tests/ProxyManagerTest/Factory/LazyLoadingValueHolderFactoryTest.php
index 4a6c3c4..9930158 100644
--- a/tests/ProxyManagerTest/Factory/LazyLoadingValueHolderFactoryTest.php
+++ b/tests/ProxyManagerTest/Factory/LazyLoadingValueHolderFactoryTest.php
@@ -118,8 +118,8 @@ final class LazyLoadingValueHolderFactoryTest extends TestCase
         $generator      = $this->createMock(GeneratorStrategyInterface::class);
         $autoloader     = $this->createMock(AutoloaderInterface::class);
 
-        $this->config->method('getGeneratorStrategy')->will(self::returnValue($generator));
-        $this->config->method('getProxyAutoloader')->will(self::returnValue($autoloader));
+        $this->config->method('getGeneratorStrategy')->willReturn($generator);
+        $this->config->method('getProxyAutoloader')->willReturn($autoloader);
 
         $generator
             ->expects(self::once())
@@ -158,7 +158,7 @@ final class LazyLoadingValueHolderFactoryTest extends TestCase
             ->willReturn(EmptyClass::class);
 
         $this->signatureChecker->expects(self::atLeastOnce())->method('checkSignature');
-        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->will(self::returnArgument(0));
+        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->willReturnArgument(0);
 
         $factory     = new LazyLoadingValueHolderFactory($this->config);
         $initializer = static function (): bool {
diff --git a/tests/ProxyManagerTest/Factory/NullObjectFactoryTest.php b/tests/ProxyManagerTest/Factory/NullObjectFactoryTest.php
index 4c81917..8d34c91 100644
--- a/tests/ProxyManagerTest/Factory/NullObjectFactoryTest.php
+++ b/tests/ProxyManagerTest/Factory/NullObjectFactoryTest.php
@@ -97,8 +97,8 @@ final class NullObjectFactoryTest extends TestCase
         $generator      = $this->createMock(GeneratorStrategyInterface::class);
         $autoloader     = $this->createMock(AutoloaderInterface::class);
 
-        $this->config->method('getGeneratorStrategy')->will(self::returnValue($generator));
-        $this->config->method('getProxyAutoloader')->will(self::returnValue($autoloader));
+        $this->config->method('getGeneratorStrategy')->willReturn($generator);
+        $this->config->method('getProxyAutoloader')->willReturn($autoloader);
 
         $generator
             ->expects(self::once())
@@ -137,7 +137,7 @@ final class NullObjectFactoryTest extends TestCase
             ->willReturn(NullObjectMock::class);
 
         $this->signatureChecker->expects(self::atLeastOnce())->method('checkSignature');
-        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->will(self::returnArgument(0));
+        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->willReturnArgument(0);
 
         $factory = new NullObjectFactory($this->config);
         $factory->createProxy($instance);
diff --git a/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/BaseAdapterTest.php b/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/BaseAdapterTest.php
index 0dbac97..f861a08 100644
--- a/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/BaseAdapterTest.php
+++ b/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/BaseAdapterTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace ProxyManagerTest\Factory\RemoteObject\Adapter;
 
 use Laminas\Server\Client;
+use PHPUnit\Framework\Attributes\RequiresPhpunit;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Factory\RemoteObject\Adapter\BaseAdapter;
 
@@ -22,6 +23,7 @@ final class BaseAdapterTest extends TestCase
      * @covers \ProxyManager\Factory\RemoteObject\Adapter\BaseAdapter::call
      * @covers \ProxyManager\Factory\RemoteObject\Adapter\Soap::getServiceName
      */
+    #[RequiresPhpunit('< 12')]
     public function testBaseAdapter(): void
     {
         $client = $this
@@ -56,6 +58,7 @@ final class BaseAdapterTest extends TestCase
      * @covers \ProxyManager\Factory\RemoteObject\Adapter\BaseAdapter::call
      * @covers \ProxyManager\Factory\RemoteObject\Adapter\Soap::getServiceName
      */
+    #[RequiresPhpunit('< 12')]
     public function testBaseAdapterWithServiceMap(): void
     {
         $client = $this
diff --git a/tests/ProxyManagerTest/Factory/RemoteObjectFactoryTest.php b/tests/ProxyManagerTest/Factory/RemoteObjectFactoryTest.php
index 37c7537..6eab081 100644
--- a/tests/ProxyManagerTest/Factory/RemoteObjectFactoryTest.php
+++ b/tests/ProxyManagerTest/Factory/RemoteObjectFactoryTest.php
@@ -134,7 +134,7 @@ final class RemoteObjectFactoryTest extends TestCase
             ->willReturn(stdClass::class);
 
         $this->signatureChecker->expects(self::atLeastOnce())->method('checkSignature');
-        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->will(self::returnArgument(0));
+        $this->classSignatureGenerator->expects(self::once())->method('addSignature')->willReturnArgument(0);
 
         $adapter = $this->createMock(AdapterInterface::class);
         $factory = new RemoteObjectFactory($adapter, $this->config);
diff --git a/tests/ProxyManagerTest/Functional/AccessInterceptorScopeLocalizerFunctionalTest.php b/tests/ProxyManagerTest/Functional/AccessInterceptorScopeLocalizerFunctionalTest.php
index 7f7cbc2..5f1765d 100644
--- a/tests/ProxyManagerTest/Functional/AccessInterceptorScopeLocalizerFunctionalTest.php
+++ b/tests/ProxyManagerTest/Functional/AccessInterceptorScopeLocalizerFunctionalTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace ProxyManagerTest\Functional;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\ExpectationFailedException;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Configuration;
@@ -46,9 +47,8 @@ final class AccessInterceptorScopeLocalizerFunctionalTest extends TestCase
 {
     /**
      * @param mixed[] $params
-     *
-     * @dataProvider getProxyMethods
      */
+    #[DataProvider('getProxyMethods')]
     public function testMethodCalls($instance, string $method, array $params, $expectedValue): void
     {
         $proxy = (new AccessInterceptorScopeLocalizerFactory())->createProxy($instance);
@@ -105,9 +105,8 @@ final class AccessInterceptorScopeLocalizerFunctionalTest extends TestCase
 
     /**
      * @param mixed[] $params
-     *
-     * @dataProvider getProxyMethods
      */
+    #[DataProvider('getProxyMethods')]
     public function testMethodCallsWithSuffixListener(
         $instance,
         string $method,
@@ -168,9 +167,8 @@ final class AccessInterceptorScopeLocalizerFunctionalTest extends TestCase
 
     /**
      * @param mixed[] $params
-     *
-     * @dataProvider getProxyMethods
      */
+    #[DataProvider('getProxyMethods')]
     public function testMethodCallsAfterUnSerialization(
         $instance,
         string $method,
@@ -190,9 +188,8 @@ final class AccessInterceptorScopeLocalizerFunctionalTest extends TestCase
 
     /**
      * @param mixed[] $params
-     *
-     * @dataProvider getProxyMethods
      */
+    #[DataProvider('getProxyMethods')]
     public function testMethodCallsAfterCloning(
         $instance,
         string $method,
@@ -209,9 +206,7 @@ final class AccessInterceptorScopeLocalizerFunctionalTest extends TestCase
         $this->assertProxySynchronized($instance, $proxy);
     }
 
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
+    #[DataProvider('getPropertyAccessProxies')]
     public function testPropertyReadAccess(
         $instance,
         AccessInterceptorInterface $proxy,
@@ -222,23 +217,13 @@ final class AccessInterceptorScopeLocalizerFunctionalTest extends TestCase
         $this->assertProxySynchronized($instance, $proxy);
     }
 
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
-    public function testPropertyWriteAccess($instance, AccessInterceptorInterface $proxy, string $publicProperty): void
-    {
-        $newValue               = uniqid('value', true);
-        $proxy->$publicProperty = $newValue;
-
-        self::assertSame($newValue, $proxy->$publicProperty);
-        $this->assertProxySynchronized($instance, $proxy);
-    }
-
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
-    public function testPropertyExistence($instance, AccessInterceptorInterface $proxy, string $publicProperty): void
-    {
+    #[DataProvider('getPropertyAccessProxies')]
+    public function testPropertyExistence(
+        $instance,
+        AccessInterceptorInterface $proxy,
+        string $publicProperty,
+        $propertyValue
+    ): void {
         self::assertSame(isset($instance->$publicProperty), isset($proxy->$publicProperty));
         $this->assertProxySynchronized($instance, $proxy);
 
@@ -247,11 +232,13 @@ final class AccessInterceptorScopeLocalizerFunctionalTest extends TestCase
         $this->assertProxySynchronized($instance, $proxy);
     }
 
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
-    public function testPropertyUnset($instance, AccessInterceptorInterface $proxy, string $publicProperty): void
-    {
+    #[DataProvider('getPropertyAccessProxies')]
+    public function testPropertyUnset(
+        $instance,
+        AccessInterceptorInterface $proxy,
+        string $publicProperty,
+        $propertyValue
+    ): void {
         self::markTestSkipped('It is currently not possible to synchronize properties un-setting');
         unset($proxy->$publicProperty);
 
diff --git a/tests/ProxyManagerTest/Functional/AccessInterceptorValueHolderFunctionalTest.php b/tests/ProxyManagerTest/Functional/AccessInterceptorValueHolderFunctionalTest.php
index 8818657..4d54084 100644
--- a/tests/ProxyManagerTest/Functional/AccessInterceptorValueHolderFunctionalTest.php
+++ b/tests/ProxyManagerTest/Functional/AccessInterceptorValueHolderFunctionalTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace ProxyManagerTest\Functional;
 
 use Generator;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\ExpectationFailedException;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Factory\AccessInterceptorValueHolderFactory;
@@ -51,9 +52,8 @@ final class AccessInterceptorValueHolderFunctionalTest extends TestCase
 {
     /**
      * @param mixed[] $params
-     *
-     * @dataProvider getProxyMethods
      */
+    #[DataProvider('getProxyMethods')]
     public function testMethodCalls($instance, string $method, array $params, $expectedValue): void
     {
         $proxy    = (new AccessInterceptorValueHolderFactory())->createProxy($instance);
@@ -106,9 +106,8 @@ final class AccessInterceptorValueHolderFunctionalTest extends TestCase
 
     /**
      * @param mixed[] $params
-     *
-     * @dataProvider getProxyMethods
      */
+    #[DataProvider('getProxyMethods')]
     public function testMethodCallsWithSuffixListener(
         $instance,
         string $method,
@@ -167,9 +166,8 @@ final class AccessInterceptorValueHolderFunctionalTest extends TestCase
 
     /**
      * @param mixed[] $params
-     *
-     * @dataProvider getProxyMethods
      */
+    #[DataProvider('getProxyMethods')]
     public function testMethodCallsAfterUnSerialization(
         $instance,
         string $method,
@@ -187,9 +185,8 @@ final class AccessInterceptorValueHolderFunctionalTest extends TestCase
 
     /**
      * @param mixed[] $params
-     *
-     * @dataProvider getProxyMethods
      */
+    #[DataProvider('getProxyMethods')]
     public function testMethodCallsAfterCloning(
         $instance,
         string $method,
@@ -206,9 +203,7 @@ final class AccessInterceptorValueHolderFunctionalTest extends TestCase
         self::assertEquals($instance, $cloned->getWrappedValueHolderValue());
     }
 
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
+    #[DataProvider('getPropertyAccessProxies')]
     public function testPropertyReadAccess(
         $instance,
         AccessInterceptorValueHolderInterface $proxy,
@@ -219,13 +214,12 @@ final class AccessInterceptorValueHolderFunctionalTest extends TestCase
         self::assertEquals($instance, $proxy->getWrappedValueHolderValue());
     }
 
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
+    #[DataProvider('getPropertyAccessProxies')]
     public function testPropertyWriteAccess(
         $instance,
         AccessInterceptorValueHolderInterface $proxy,
-        string $publicProperty
+        string $publicProperty,
+        $propertyValue
     ): void {
         $newValue               = uniqid('', true);
         $proxy->$publicProperty = $newValue;
@@ -238,13 +232,12 @@ final class AccessInterceptorValueHolderFunctionalTest extends TestCase
         self::assertSame($newValue, $wrappedValue->$publicProperty);
     }
 
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
+    #[DataProvider('getPropertyAccessProxies')]
     public function testPropertyExistence(
         $instance,
         AccessInterceptorValueHolderInterface $proxy,
-        string $publicProperty
+        string $publicProperty,
+        $propertyValue
     ): void {
         self::assertSame(isset($instance->$publicProperty), isset($proxy->$publicProperty));
         self::assertEquals($instance, $proxy->getWrappedValueHolderValue());
@@ -259,13 +252,12 @@ final class AccessInterceptorValueHolderFunctionalTest extends TestCase
         self::assertFalse(isset($proxy->$publicProperty));
     }
 
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
+    #[DataProvider('getPropertyAccessProxies')]
     public function testPropertyUnset(
         $instance,
         AccessInterceptorValueHolderInterface $proxy,
-        string $publicProperty
+        string $publicProperty,
+        $propertyValue
     ): void {
         $instance = $proxy->getWrappedValueHolderValue() ?? $instance;
         unset($proxy->$publicProperty);
@@ -526,8 +518,8 @@ final class AccessInterceptorValueHolderFunctionalTest extends TestCase
 
     /**
      * @group        276
-     * @dataProvider getMethodsThatAccessPropertiesOnOtherObjectsInTheSameScope
      */
+    #[DataProvider('getMethodsThatAccessPropertiesOnOtherObjectsInTheSameScope')]
     public function testWillInterceptAccessToPropertiesViaFriendClassAccess(
         $callerObject,
         $realInstance,
@@ -558,8 +550,8 @@ final class AccessInterceptorValueHolderFunctionalTest extends TestCase
 
     /**
      * @group        276
-     * @dataProvider getMethodsThatAccessPropertiesOnOtherObjectsInTheSameScope
      */
+    #[DataProvider('getMethodsThatAccessPropertiesOnOtherObjectsInTheSameScope')]
     public function testWillInterceptAccessToPropertiesViaFriendClassAccessEvenIfDeSerialized(
         $callerObject,
         $realInstance,
@@ -591,8 +583,8 @@ final class AccessInterceptorValueHolderFunctionalTest extends TestCase
 
     /**
      * @group        276
-     * @dataProvider getMethodsThatAccessPropertiesOnOtherObjectsInTheSameScope
      */
+    #[DataProvider('getMethodsThatAccessPropertiesOnOtherObjectsInTheSameScope')]
     public function testWillInterceptAccessToPropertiesViaFriendClassAccessEvenIfCloned(
         $callerObject,
         $realInstance,
diff --git a/tests/ProxyManagerTest/Functional/MultipleProxyGenerationTest.php b/tests/ProxyManagerTest/Functional/MultipleProxyGenerationTest.php
index faf62ce..ff65111 100644
--- a/tests/ProxyManagerTest/Functional/MultipleProxyGenerationTest.php
+++ b/tests/ProxyManagerTest/Functional/MultipleProxyGenerationTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace ProxyManagerTest\Functional;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory;
 use ProxyManager\Factory\AccessInterceptorValueHolderFactory;
@@ -56,9 +57,8 @@ final class MultipleProxyGenerationTest extends TestCase
     /**
      * Verifies that proxies generated from different factories will retain their specific implementation
      * and won't conflict
-     *
-     * @dataProvider getTestedClasses
      */
+    #[DataProvider('getTestedClasses')]
     public function testCanGenerateMultipleDifferentProxiesForSameClass($object): void
     {
         if (null === $object && PHP_VERSION_ID < 70400) {
diff --git a/tests/ProxyManagerTest/Functional/NullObjectFunctionalTest.php b/tests/ProxyManagerTest/Functional/NullObjectFunctionalTest.php
index 9946b5c..2e303a7 100644
--- a/tests/ProxyManagerTest/Functional/NullObjectFunctionalTest.php
+++ b/tests/ProxyManagerTest/Functional/NullObjectFunctionalTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace ProxyManagerTest\Functional;
 
 use Error;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Factory\NullObjectFactory;
 use ProxyManager\Proxy\NullObjectInterface;
@@ -42,9 +43,8 @@ final class NullObjectFunctionalTest extends TestCase
     /**
      * @param mixed[] $params
      * @psalm-param class-string $className
-     *
-     * @dataProvider getProxyMethods
      */
+    #[DataProvider('getProxyMethods')]
     public function testMethodCalls(string $className, string $method, array $params): void
     {
         $proxy = (new NullObjectFactory())->createProxy($className);
@@ -55,9 +55,8 @@ final class NullObjectFunctionalTest extends TestCase
     /**
      * @param mixed[] $params
      * @psalm-param class-string $className
-     *
-     * @dataProvider getProxyMethods
      */
+    #[DataProvider('getProxyMethods')]
     public function testMethodCallsAfterUnSerialization(string $className, string $method, array $params): void
     {
         $proxy = unserialize(serialize((new NullObjectFactory())->createProxy($className)));
@@ -69,9 +68,8 @@ final class NullObjectFunctionalTest extends TestCase
     /**
      * @param mixed[] $params
      * @psalm-param class-string $className
-     *
-     * @dataProvider getProxyMethods
      */
+    #[DataProvider('getProxyMethods')]
     public function testMethodCallsAfterCloning(string $className, string $method, array $params): void
     {
         $proxy = (new NullObjectFactory())->createProxy($className);
@@ -79,9 +77,7 @@ final class NullObjectFunctionalTest extends TestCase
         $this->assertNullMethodCall(clone $proxy, $method, $params);
     }
 
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
+    #[DataProvider('getPropertyAccessProxies')]
     public function testPropertyReadAccess(NullObjectInterface $proxy, string $publicProperty): void
     {
         if (! $this->propertyHasDefaultNullableValue(new ReflectionProperty($proxy, $publicProperty))) {
@@ -93,9 +89,7 @@ final class NullObjectFunctionalTest extends TestCase
         self::assertNull($proxy->$publicProperty);
     }
 
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
+    #[DataProvider('getPropertyAccessProxies')]
     public function testPropertyWriteAccess(NullObjectInterface $proxy, string $publicProperty): void
     {
         $newValue               = uniqid('', true);
@@ -104,9 +98,7 @@ final class NullObjectFunctionalTest extends TestCase
         self::assertSame($newValue, $proxy->$publicProperty);
     }
 
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
+    #[DataProvider('getPropertyAccessProxies')]
     public function testPropertyExistence(NullObjectInterface $proxy, string $publicProperty): void
     {
         if (! $this->propertyHasDefaultNullableValue(new ReflectionProperty($proxy, $publicProperty))) {
@@ -118,9 +110,7 @@ final class NullObjectFunctionalTest extends TestCase
         self::assertNull($proxy->$publicProperty);
     }
 
-    /**
-     * @dataProvider getPropertyAccessProxies
-     */
+    #[DataProvider('getPropertyAccessProxies')]
     public function testPropertyUnset(NullObjectInterface $proxy, string $publicProperty): void
     {
         unset($proxy->$publicProperty);
@@ -157,55 +147,46 @@ final class NullObjectFunctionalTest extends TestCase
                 BaseClass::class,
                 'publicMethod',
                 [],
-                'publicMethodDefault',
             ],
             [
                 BaseClass::class,
                 'publicTypeHintedMethod',
                 ['param' => new stdClass()],
-                'publicTypeHintedMethodDefault',
             ],
             [
                 BaseClass::class,
                 'publicByReferenceMethod',
                 [],
-                'publicByReferenceMethodDefault',
             ],
             [
                 BaseInterface::class,
                 'publicMethod',
                 [],
-                'publicMethodDefault',
             ],
             [
                 ClassWithSelfHint::class,
                 'selfHintMethod',
                 ['parameter' => $selfHintParam],
-                $selfHintParam,
             ],
             [
                 ClassWithParentHint::class,
                 'parentHintMethod',
                 ['parameter' => $empty],
-                $empty,
             ],
             [
                 ClassWithMethodWithVariadicFunction::class,
                 'buz',
                 ['Ocramius', 'Malukenho'],
-                null,
             ],
             [
                 ClassWithMethodWithByRefVariadicFunction::class,
                 'tuz',
                 ['Ocramius', 'Malukenho'],
-                null,
             ],
             [
                 VoidCounter::class,
                 'increment',
                 [random_int(10, 1000)],
-                null,
             ],
         ];
     }
@@ -225,12 +206,10 @@ final class NullObjectFunctionalTest extends TestCase
             [
                 $factory->createProxy(BaseClass::class),
                 'publicProperty',
-                'publicPropertyDefault',
             ],
             [
                 $serialized,
                 'publicProperty',
-                'publicPropertyDefault',
             ],
         ];
 
@@ -242,17 +221,14 @@ final class NullObjectFunctionalTest extends TestCase
             [
                 $factory->createProxy(ClassWithPublicStringTypedProperty::class),
                 'typedProperty',
-                'Typed property initialized value',
             ],
             [
                 $factory->createProxy(ClassWithPublicStringNullableTypedProperty::class),
                 'typedNullableProperty',
-                'Typed nullable property initialized value',
             ],
             [
                 $factory->createProxy(ClassWithPublicStringNullableNullDefaultTypedProperty::class),
                 'typedNullableNullDefaultProperty',
-                null,
             ],
         ]);
     }
diff --git a/tests/ProxyManagerTest/Functional/RemoteObjectFunctionalTest.php b/tests/ProxyManagerTest/Functional/RemoteObjectFunctionalTest.php
index 367b28c..35711e4 100644
--- a/tests/ProxyManagerTest/Functional/RemoteObjectFunctionalTest.php
+++ b/tests/ProxyManagerTest/Functional/RemoteObjectFunctionalTest.php
@@ -6,6 +6,7 @@ namespace ProxyManagerTest\Functional;
 
 use Generator;
 use Laminas\Server\Client;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Factory\RemoteObject\Adapter\JsonRpc as JsonRpcAdapter;
 use ProxyManager\Factory\RemoteObject\Adapter\XmlRpc as XmlRpcAdapter;
@@ -88,9 +89,9 @@ final class RemoteObjectFunctionalTest extends TestCase
      * @param mixed[]       $callParametersExpectedByAdapter
      * @psalm-param class-string<OriginalClass>|OriginalClass $instanceOrClassName
      *
-     * @dataProvider getProxyMethods
      * @psalm-template OriginalClass of object
      */
+    #[DataProvider('getProxyMethods')]
     public function testXmlRpcMethodCalls(
         $instanceOrClassName,
         string $method,
@@ -112,9 +113,9 @@ final class RemoteObjectFunctionalTest extends TestCase
      * @param mixed[]       $parametersForProxy
      * @psalm-param class-string<OriginalClass>|OriginalClass $instanceOrClassName
      *
-     * @dataProvider getProxyMethods
      * @psalm-template OriginalClass of object
      */
+    #[DataProvider('getProxyMethods')]
     public function testJsonRpcMethodCalls(
         $instanceOrClassName,
         string $method,
@@ -134,9 +135,9 @@ final class RemoteObjectFunctionalTest extends TestCase
     /**
      * @psalm-param class-string<OriginalClass>|OriginalClass $instanceOrClassName
      *
-     * @dataProvider getPropertyAccessProxies
      * @psalm-template OriginalClass of object
      */
+    #[DataProvider('getPropertyAccessProxies')]
     public function testJsonRpcPropertyReadAccess($instanceOrClassName, string $publicProperty, $propertyValue): void
     {
         if (false !== strpos($instanceOrClassName, 'TypedProp') && \PHP_VERSION_ID < 70400) {
@@ -330,8 +331,8 @@ final class RemoteObjectFunctionalTest extends TestCase
 
     /**
      * @group        276
-     * @dataProvider getMethodsThatAccessPropertiesOnOtherObjectsInTheSameScope
      */
+    #[DataProvider('getMethodsThatAccessPropertiesOnOtherObjectsInTheSameScope')]
     public function testWillInterceptAccessToPropertiesViaFriendClassAccess(
         $callerObject,
         $realInstance,
@@ -358,8 +359,8 @@ final class RemoteObjectFunctionalTest extends TestCase
 
     /**
      * @group        276
-     * @dataProvider getMethodsThatAccessPropertiesOnOtherObjectsInTheSameScope
      */
+    #[DataProvider('getMethodsThatAccessPropertiesOnOtherObjectsInTheSameScope')]
     public function testWillInterceptAccessToPropertiesViaFriendClassAccessEvenIfCloned(
         $callerObject,
         $realInstance,
diff --git a/tests/ProxyManagerTest/Generator/MethodGeneratorTest.php b/tests/ProxyManagerTest/Generator/MethodGeneratorTest.php
index 3c6d7ac..abb81bd 100644
--- a/tests/ProxyManagerTest/Generator/MethodGeneratorTest.php
+++ b/tests/ProxyManagerTest/Generator/MethodGeneratorTest.php
@@ -6,6 +6,7 @@ namespace ProxyManagerTest\Generator;
 
 use Laminas\Code\Generator\ParameterGenerator;
 use Laminas\Code\Reflection\MethodReflection;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Generator\MethodGenerator;
 use ProxyManagerTestAsset\BaseClass;
@@ -103,9 +104,7 @@ final class MethodGeneratorTest extends TestCase
         self::assertSame(stdClass::class, $param->getType());
     }
 
-    /**
-     * @dataProvider scalarTypeHintedMethods
-     */
+    #[DataProvider('scalarTypeHintedMethods')]
     public function testGenerateMethodWithScalarTypeHinting(string $methodName, string $type): void
     {
         $method = MethodGenerator::fromReflectionWithoutBodyAndDocBlock(new MethodReflection(
@@ -167,9 +166,7 @@ final class MethodGeneratorTest extends TestCase
         self::assertStringMatchesFormat('%a : void%a', $method->generate());
     }
 
-    /**
-     * @dataProvider returnTypeHintsProvider
-     */
+    #[DataProvider('returnTypeHintsProvider')]
     public function testReturnTypeHintGeneration(string $methodName, string $expectedType): void
     {
         $method = MethodGenerator::fromReflectionWithoutBodyAndDocBlock(new MethodReflection(
diff --git a/tests/ProxyManagerTest/Generator/Util/IdentifierSuffixerTest.php b/tests/ProxyManagerTest/Generator/Util/IdentifierSuffixerTest.php
index 89efd16..242987e 100644
--- a/tests/ProxyManagerTest/Generator/Util/IdentifierSuffixerTest.php
+++ b/tests/ProxyManagerTest/Generator/Util/IdentifierSuffixerTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace ProxyManagerTest\Generator\Util;
 
 use Composer\InstalledVersions;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Generator\Util\IdentifierSuffixer;
 
@@ -22,9 +23,7 @@ use function substr;
  */
 final class IdentifierSuffixerTest extends TestCase
 {
-    /**
-     * @dataProvider getBaseIdentifierNames
-     */
+    #[DataProvider('getBaseIdentifierNames')]
     public function testGeneratesSuffixedIdentifiers(string $name): void
     {
         self::assertSame(
@@ -35,8 +34,8 @@ final class IdentifierSuffixerTest extends TestCase
 
     /**
      * @requires function \Composer\InstalledVersions::getRawData
-     * @dataProvider getBaseIdentifierNames
      */
+    #[DataProvider('getBaseIdentifierNames')]
     public function testGeneratedSuffixDependsOnPackageInstalledVersions(string $name): void
     {
         $hashedData = sha1(serialize(
@@ -51,9 +50,7 @@ final class IdentifierSuffixerTest extends TestCase
         );
     }
 
-    /**
-     * @dataProvider getBaseIdentifierNames
-     */
+    #[DataProvider('getBaseIdentifierNames')]
     public function testGeneratesValidIdentifiers(string $name): void
     {
         self::assertMatchesRegularExpression(
@@ -62,9 +59,7 @@ final class IdentifierSuffixerTest extends TestCase
         );
     }
 
-    /**
-     * @dataProvider getBaseIdentifierNames
-     */
+    #[DataProvider('getBaseIdentifierNames')]
     public static function testGeneratedIdentifierSuffix(string $name): void
     {
         // 5 generated characters are enough to keep idiots from tampering with these properties "the easy way"
diff --git a/tests/ProxyManagerTest/Generator/Util/ProxiedMethodReturnExpressionTest.php b/tests/ProxyManagerTest/Generator/Util/ProxiedMethodReturnExpressionTest.php
index 39bc8cf..b7084f3 100644
--- a/tests/ProxyManagerTest/Generator/Util/ProxiedMethodReturnExpressionTest.php
+++ b/tests/ProxyManagerTest/Generator/Util/ProxiedMethodReturnExpressionTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace ProxyManagerTest\Generator\Util;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Generator\Util\ProxiedMethodReturnExpression;
 use ProxyManagerTestAsset\VoidMethodTypeHintedClass;
@@ -17,9 +18,7 @@ use ReflectionMethod;
  */
 final class ProxiedMethodReturnExpressionTest extends TestCase
 {
-    /**
-     * @dataProvider returnExpressionsProvider
-     */
+    #[DataProvider('returnExpressionsProvider')]
     public function testGeneratedReturnExpression(
         string $expression,
         ?ReflectionMethod $originalMethod,
diff --git a/tests/ProxyManagerTest/Generator/Util/UniqueIdentifierGeneratorTest.php b/tests/ProxyManagerTest/Generator/Util/UniqueIdentifierGeneratorTest.php
index 1cbc792..f2c2939 100644
--- a/tests/ProxyManagerTest/Generator/Util/UniqueIdentifierGeneratorTest.php
+++ b/tests/ProxyManagerTest/Generator/Util/UniqueIdentifierGeneratorTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace ProxyManagerTest\Generator\Util;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Generator\Util\UniqueIdentifierGenerator;
 
@@ -17,9 +18,7 @@ use function strlen;
  */
 final class UniqueIdentifierGeneratorTest extends TestCase
 {
-    /**
-     * @dataProvider getBaseIdentifierNames
-     */
+    #[DataProvider('getBaseIdentifierNames')]
     public function testGeneratesUniqueIdentifiers(string $name): void
     {
         self::assertNotSame(
@@ -28,9 +27,7 @@ final class UniqueIdentifierGeneratorTest extends TestCase
         );
     }
 
-    /**
-     * @dataProvider getBaseIdentifierNames
-     */
+    #[DataProvider('getBaseIdentifierNames')]
     public function testGeneratesValidIdentifiers(string $name): void
     {
         self::assertMatchesRegularExpression(
@@ -39,9 +36,7 @@ final class UniqueIdentifierGeneratorTest extends TestCase
         );
     }
 
-    /**
-     * @dataProvider getBaseIdentifierNames
-     */
+    #[DataProvider('getBaseIdentifierNames')]
     public function testGeneratedIdentifierEntropy(string $name): void
     {
         self::assertGreaterThan(14, strlen(UniqueIdentifierGenerator::getIdentifier($name)));
diff --git a/tests/ProxyManagerTest/GeneratorStrategy/FileWriterGeneratorStrategyTest.php b/tests/ProxyManagerTest/GeneratorStrategy/FileWriterGeneratorStrategyTest.php
index db39428..1b56007 100644
--- a/tests/ProxyManagerTest/GeneratorStrategy/FileWriterGeneratorStrategyTest.php
+++ b/tests/ProxyManagerTest/GeneratorStrategy/FileWriterGeneratorStrategyTest.php
@@ -61,7 +61,7 @@ final class FileWriterGeneratorStrategyTest extends TestCase
         $locator
             ->method('getProxyFileName')
             ->with($fqcn)
-            ->will(self::returnValue($tmpFile));
+            ->willReturn($tmpFile);
 
         $body = $generator->generate(new ClassGenerator($fqcn));
 
diff --git a/tests/ProxyManagerTest/Inflector/ClassNameInflectorTest.php b/tests/ProxyManagerTest/Inflector/ClassNameInflectorTest.php
index 04a5b0e..48eadcb 100644
--- a/tests/ProxyManagerTest/Inflector/ClassNameInflectorTest.php
+++ b/tests/ProxyManagerTest/Inflector/ClassNameInflectorTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace ProxyManagerTest\Inflector;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Inflector\ClassNameInflector;
 use ProxyManager\Inflector\ClassNameInflectorInterface;
@@ -19,9 +20,8 @@ final class ClassNameInflectorTest extends TestCase
     /**
      * @param class-string $realClassName
      * @param class-string $proxyClassName
-     *
-     * @dataProvider getClassNames
      */
+    #[DataProvider('getClassNames')]
     public function testInflector(string $realClassName, string $proxyClassName): void
     {
         $inflector = new ClassNameInflector('ProxyNS');
@@ -92,9 +92,8 @@ final class ClassNameInflectorTest extends TestCase
     /**
      * @param class-string         $className
      * @param array<string, mixed> $parameters
-     *
-     * @dataProvider getClassAndParametersCombinations
      */
+    #[DataProvider('getClassAndParametersCombinations')]
     public function testClassNameIsValidClassIdentifier(string $className, array $parameters): void
     {
         $inflector = new ClassNameInflector('ProxyNS');
diff --git a/tests/ProxyManagerTest/Inflector/Util/ParameterEncoderTest.php b/tests/ProxyManagerTest/Inflector/Util/ParameterEncoderTest.php
index a395b69..68fed0c 100644
--- a/tests/ProxyManagerTest/Inflector/Util/ParameterEncoderTest.php
+++ b/tests/ProxyManagerTest/Inflector/Util/ParameterEncoderTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace ProxyManagerTest\Inflector\Util;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Inflector\Util\ParameterEncoder;
 
@@ -16,10 +17,9 @@ final class ParameterEncoderTest extends TestCase
 {
     /**
      * @param mixed[] $parameters
-     *
-     * @dataProvider getParameters
      * @covers \ProxyManager\Inflector\Util\ParameterEncoder::encodeParameters
      */
+    #[DataProvider('getParameters')]
     public function testGeneratesValidClassName(array $parameters): void
     {
         $encoder = new ParameterEncoder();
diff --git a/tests/ProxyManagerTest/Inflector/Util/ParameterHasherTest.php b/tests/ProxyManagerTest/Inflector/Util/ParameterHasherTest.php
index 38d374e..5dcc364 100644
--- a/tests/ProxyManagerTest/Inflector/Util/ParameterHasherTest.php
+++ b/tests/ProxyManagerTest/Inflector/Util/ParameterHasherTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace ProxyManagerTest\Inflector\Util;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Inflector\Util\ParameterHasher;
 
@@ -16,10 +17,9 @@ final class ParameterHasherTest extends TestCase
 {
     /**
      * @param mixed[] $parameters
-     *
-     * @dataProvider getParameters
      * @covers \ProxyManager\Inflector\Util\ParameterHasher::hashParameters
      */
+    #[DataProvider('getParameters')]
     public function testGeneratesValidClassName(array $parameters, string $expectedHash): void
     {
         $encoder = new ParameterHasher();
diff --git a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGeneratorTest.php b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGeneratorTest.php
index 5fea44e..59e29c1 100644
--- a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGeneratorTest.php
+++ b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGeneratorTest.php
@@ -32,7 +32,7 @@ final class InterceptorGeneratorTest extends TestCase
         $bar->method('getName')->willReturn('bar');
         $baz->method('getName')->willReturn('baz');
         $method->method('getName')->willReturn('fooMethod');
-        $method->method('getParameters')->will(self::returnValue([$bar, $baz]));
+        $method->method('getParameters')->willReturn([$bar, $baz]);
         $prefixInterceptors->method('getName')->willReturn('pre');
         $suffixInterceptors->method('getName')->willReturn('post');
 
@@ -85,7 +85,7 @@ PHP;
         $bar->method('getName')->willReturn('bar');
         $baz->method('getName')->willReturn('baz');
         $method->method('getName')->willReturn('fooMethod');
-        $method->method('getParameters')->will(self::returnValue([$bar, $baz]));
+        $method->method('getParameters')->willReturn([$bar, $baz]);
         $prefixInterceptors->method('getName')->willReturn('pre');
         $suffixInterceptors->method('getName')->willReturn('post');
 
@@ -141,7 +141,7 @@ PHP;
         $bar->method('getName')->willReturn('bar');
         $baz->method('getName')->willReturn('baz');
         $method->method('getName')->willReturn('fooMethod');
-        $method->method('getParameters')->will(self::returnValue([$bar, $baz]));
+        $method->method('getParameters')->willReturn([$bar, $baz]);
         $prefixInterceptors->method('getName')->willReturn('pre');
         $suffixInterceptors->method('getName')->willReturn('post');
 
@@ -196,7 +196,7 @@ PHP;
         $baz->method('getName')->willReturn('baz');
         $baz->method('getPassedByReference')->willReturn(true);
         $method->method('getName')->willReturn('fooMethod');
-        $method->method('getParameters')->will(self::returnValue([$bar, $baz]));
+        $method->method('getParameters')->willReturn([$bar, $baz]);
         $prefixInterceptors->method('getName')->willReturn('pre');
         $suffixInterceptors->method('getName')->willReturn('post');
 
diff --git a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGeneratorTest.php b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGeneratorTest.php
index b3025fd..0d2bde6 100644
--- a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGeneratorTest.php
+++ b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGeneratorTest.php
@@ -33,7 +33,7 @@ final class InterceptorGeneratorTest extends TestCase
         $bar->method('getName')->willReturn('bar');
         $baz->method('getName')->willReturn('baz');
         $method->method('getName')->willReturn('fooMethod');
-        $method->method('getParameters')->will(self::returnValue([$bar, $baz]));
+        $method->method('getParameters')->willReturn([$bar, $baz]);
         $valueHolder->method('getName')->willReturn('foo');
         $prefixInterceptors->method('getName')->willReturn('pre');
         $suffixInterceptors->method('getName')->willReturn('post');
@@ -89,7 +89,7 @@ PHP;
         $bar->method('getName')->willReturn('bar');
         $baz->method('getName')->willReturn('baz');
         $method->method('getName')->willReturn('fooMethod');
-        $method->method('getParameters')->will(self::returnValue([$bar, $baz]));
+        $method->method('getParameters')->willReturn([$bar, $baz]);
         $valueHolder->method('getName')->willReturn('foo');
         $prefixInterceptors->method('getName')->willReturn('pre');
         $suffixInterceptors->method('getName')->willReturn('post');
@@ -148,7 +148,7 @@ PHP;
         $bar->method('getName')->willReturn('bar');
         $baz->method('getName')->willReturn('baz');
         $method->method('getName')->willReturn('fooMethod');
-        $method->method('getParameters')->will(self::returnValue([$bar, $baz]));
+        $method->method('getParameters')->willReturn([$bar, $baz]);
         $valueHolder->method('getName')->willReturn('foo');
         $prefixInterceptors->method('getName')->willReturn('pre');
         $suffixInterceptors->method('getName')->willReturn('post');
@@ -206,7 +206,7 @@ PHP;
         $baz->method('getName')->willReturn('baz');
         $baz->method('getPassedByReference')->willReturn(true);
         $method->method('getName')->willReturn('fooMethod');
-        $method->method('getParameters')->will(self::returnValue([$bar, $baz]));
+        $method->method('getParameters')->willReturn([$bar, $baz]);
         $valueHolder->method('getName')->willReturn('foo');
         $prefixInterceptors->method('getName')->willReturn('pre');
         $suffixInterceptors->method('getName')->willReturn('post');
diff --git a/tests/ProxyManagerTest/ProxyGenerator/Assertion/CanProxyAssertionTest.php b/tests/ProxyManagerTest/ProxyGenerator/Assertion/CanProxyAssertionTest.php
index 7cd7595..09bb592 100644
--- a/tests/ProxyManagerTest/ProxyGenerator/Assertion/CanProxyAssertionTest.php
+++ b/tests/ProxyManagerTest/ProxyGenerator/Assertion/CanProxyAssertionTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace ProxyManagerTest\ProxyGenerator\Assertion;
 
 use BadMethodCallException;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Exception\InvalidProxiedClassException;
 use ProxyManager\ProxyGenerator\Assertion\CanProxyAssertion;
@@ -75,9 +76,8 @@ final class CanProxyAssertionTest extends TestCase
 
     /**
      * @psalm-param class-string $className
-     *
-     * @dataProvider validClasses
      */
+    #[DataProvider('validClasses')]
     public function testAllowedClass(string $className): void
     {
         CanProxyAssertion::assertClassCanBeProxied(new ReflectionClass($className));
diff --git a/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicGetTest.php b/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicGetTest.php
index fac04a2..3577c07 100644
--- a/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicGetTest.php
+++ b/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicGetTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace ProxyManagerTest\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator;
 
 use Laminas\Code\Generator\PropertyGenerator;
+use PHPUnit\Framework\Attributes\RequiresPhpunit;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\MagicGet;
 use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap;
@@ -22,6 +23,7 @@ final class MagicGetTest extends TestCase
     /**
      * @covers \ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\MagicGet::__construct
      */
+    #[RequiresPhpunit('< 12')]
     public function testBodyStructure(): void
     {
         $reflection       = new ReflectionClass(EmptyClass::class);
diff --git a/tests/ProxyManagerTest/ProxyGenerator/Util/PropertiesTest.php b/tests/ProxyManagerTest/ProxyGenerator/Util/PropertiesTest.php
index 2b3754f..dd022fc 100644
--- a/tests/ProxyManagerTest/ProxyGenerator/Util/PropertiesTest.php
+++ b/tests/ProxyManagerTest/ProxyGenerator/Util/PropertiesTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace ProxyManagerTest\ProxyGenerator\Util;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\ProxyGenerator\Util\Properties;
 use ProxyManagerTestAsset\ClassWithAbstractProtectedMethod;
@@ -402,9 +403,8 @@ final class PropertiesTest extends TestCase
 
     /**
      * @param string $propertyName with property name
-     *
-     * @dataProvider propertiesToSkipFixture
      */
+    #[DataProvider('propertiesToSkipFixture')]
     public function testSkipPropertiesByFiltering(string $propertyName): void
     {
         $properties = Properties::fromReflectionClass(
diff --git a/tests/ProxyManagerTest/ProxyGenerator/Util/ProxiedMethodsFilterTest.php b/tests/ProxyManagerTest/ProxyGenerator/Util/ProxiedMethodsFilterTest.php
index cdb4155..672c604 100644
--- a/tests/ProxyManagerTest/ProxyGenerator/Util/ProxiedMethodsFilterTest.php
+++ b/tests/ProxyManagerTest/ProxyGenerator/Util/ProxiedMethodsFilterTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace ProxyManagerTest\ProxyGenerator\Util;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\ProxyGenerator\Util\ProxiedMethodsFilter;
 use ProxyManagerTestAsset\BaseClass;
@@ -35,9 +36,8 @@ final class ProxiedMethodsFilterTest extends TestCase
     /**
      * @param array<int, string>|null $excludes
      * @param string[]                $expectedMethods
-     *
-     * @dataProvider expectedMethods
      */
+    #[DataProvider('expectedMethods')]
     public function testFiltering(ReflectionClass $reflectionClass, ?array $excludes, array $expectedMethods): void
     {
         $filtered = ProxiedMethodsFilter::getProxiedMethods($reflectionClass, $excludes);
@@ -58,9 +58,8 @@ final class ProxiedMethodsFilterTest extends TestCase
     /**
      * @param array<int, string>|null $excludes
      * @param string[]                $expectedMethods
-     *
-     * @dataProvider expectedAbstractPublicMethods
      */
+    #[DataProvider('expectedAbstractPublicMethods')]
     public function testFilteringOfAbstractPublic(
         ReflectionClass $reflectionClass,
         ?array $excludes,
diff --git a/tests/ProxyManagerTest/ProxyGenerator/Util/UnsetPropertiesGeneratorTest.php b/tests/ProxyManagerTest/ProxyGenerator/Util/UnsetPropertiesGeneratorTest.php
index 67e19af..209435c 100644
--- a/tests/ProxyManagerTest/ProxyGenerator/Util/UnsetPropertiesGeneratorTest.php
+++ b/tests/ProxyManagerTest/ProxyGenerator/Util/UnsetPropertiesGeneratorTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace ProxyManagerTest\ProxyGenerator\Util;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\ProxyGenerator\Util\Properties;
 use ProxyManager\ProxyGenerator\Util\UnsetPropertiesGenerator;
@@ -25,9 +26,8 @@ final class UnsetPropertiesGeneratorTest extends TestCase
 {
     /**
      * @psalm-param class-string $className
-     *
-     * @dataProvider classNamesProvider
      */
+    #[DataProvider('classNamesProvider')]
     public function testGeneratedCode(string $className, string $expectedCode, string $instanceName): void
     {
         if (false !== strpos($className, 'ReadOnlyProp') && \PHP_VERSION_ID < 80100) {
diff --git a/tests/ProxyManagerTest/Signature/SignatureGeneratorTest.php b/tests/ProxyManagerTest/Signature/SignatureGeneratorTest.php
index 6f70620..a6095d1 100644
--- a/tests/ProxyManagerTest/Signature/SignatureGeneratorTest.php
+++ b/tests/ProxyManagerTest/Signature/SignatureGeneratorTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace ProxyManagerTest\Signature;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use ProxyManager\Signature\SignatureGenerator;
 
@@ -24,9 +25,8 @@ final class SignatureGeneratorTest extends TestCase
 
     /**
      * @param array<string, array<string>> $parameters
-     *
-     * @dataProvider signatures
      */
+    #[DataProvider('signatures')]
     public function testGenerateSignature(array $parameters, string $expected): void
     {
         self::assertSame($expected, $this->signatureGenerator->generateSignature($parameters));
@@ -34,9 +34,8 @@ final class SignatureGeneratorTest extends TestCase
 
     /**
      * @param array<string, array<string>> $parameters
-     *
-     * @dataProvider signatureKeys
      */
+    #[DataProvider('signatureKeys')]
     public function testGenerateSignatureKey(array $parameters, string $expected): void
     {
         self::assertSame($expected, $this->signatureGenerator->generateSignatureKey($parameters));
