From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Thu, 27 Feb 2025 23:04:19 +0100
Subject: Modernize PHPUnit syntax

---
 tests/Composer/Test/Advisory/AuditorTest.php       |   9 +-
 tests/Composer/Test/AllFunctionalTest.php          |   8 +-
 .../Test/Autoload/AutoloadGeneratorTest.php        |  90 ++++----
 tests/Composer/Test/Autoload/ClassLoaderTest.php   |   4 +-
 tests/Composer/Test/CacheTest.php                  |  14 +-
 .../Test/Command/BaseDependencyCommandTest.php     |  22 +-
 tests/Composer/Test/Command/BumpCommandTest.php    |   3 +-
 .../Test/Command/CheckPlatformReqsCommandTest.php  |   3 +-
 tests/Composer/Test/Command/ConfigCommandTest.php  |   5 +-
 tests/Composer/Test/Command/FundCommandTest.php    |   3 +-
 tests/Composer/Test/Command/HomeCommandTest.php    |   3 +-
 tests/Composer/Test/Command/InstallCommandTest.php |   3 +-
 .../Composer/Test/Command/ReinstallCommandTest.php |   3 +-
 tests/Composer/Test/Command/RemoveCommandTest.php  |   5 +-
 tests/Composer/Test/Command/RequireCommandTest.php |   5 +-
 .../Composer/Test/Command/RunScriptCommandTest.php |  13 +-
 tests/Composer/Test/Command/SearchCommandTest.php  |   3 +-
 .../Test/Command/SelfUpdateCommandTest.php         |   5 +-
 tests/Composer/Test/Command/ShowCommandTest.php    |   7 +-
 tests/Composer/Test/Command/StatusCommandTest.php  |   3 +-
 .../Composer/Test/Command/SuggestsCommandTest.php  |   3 +-
 tests/Composer/Test/Command/UpdateCommandTest.php  |   5 +-
 .../Composer/Test/Command/ValidateCommandTest.php  |   3 +-
 tests/Composer/Test/CompletionFunctionalTest.php   |   4 +-
 .../Composer/Test/Config/JsonConfigSourceTest.php  |   7 +-
 tests/Composer/Test/ConfigTest.php                 |  14 +-
 .../Test/DependencyResolver/PoolBuilderTest.php    |   3 +-
 .../Test/DependencyResolver/PoolOptimizerTest.php  |   3 +-
 tests/Composer/Test/DocumentationTest.php          |   5 +-
 .../Test/Downloader/ArchiveDownloaderTest.php      |  19 +-
 .../Test/Downloader/DownloadManagerTest.php        | 231 +++++++++++----------
 .../Test/Downloader/FileDownloaderTest.php         |  36 ++--
 .../Test/Downloader/FossilDownloaderTest.php       |  16 +-
 .../Composer/Test/Downloader/GitDownloaderTest.php | 113 +++++-----
 .../Composer/Test/Downloader/HgDownloaderTest.php  |  16 +-
 .../Test/Downloader/PerforceDownloaderTest.php     |  26 +--
 .../Composer/Test/Downloader/ZipDownloaderTest.php |  62 +++---
 .../Test/EventDispatcher/EventDispatcherTest.php   |  59 +++---
 tests/Composer/Test/FactoryTest.php                |   2 +-
 .../IgnoreAllPlatformRequirementFilterTest.php     |   5 +-
 .../IgnoreListPlatformRequirementFilterTest.php    |   7 +-
 .../IgnoreNothingPlatformRequirementFilterTest.php |   5 +-
 .../PlatformRequirementFilterFactoryTest.php       |   4 +-
 tests/Composer/Test/IO/ConsoleIOTest.php           |  10 +-
 tests/Composer/Test/InstalledVersionsTest.php      |  25 +--
 .../Test/Installer/BinaryInstallerTest.php         |   5 +-
 .../Test/Installer/InstallationManagerTest.php     |  42 ++--
 .../Test/Installer/LibraryInstallerTest.php        |  29 ++-
 .../Test/Installer/MetapackageInstallerTest.php    |   8 +-
 .../Installer/SuggestedPackagesReporterTest.php    |  14 +-
 tests/Composer/Test/InstallerTest.php              |  45 ++--
 tests/Composer/Test/Json/ComposerSchemaTest.php    |   5 +-
 tests/Composer/Test/Json/JsonManipulatorTest.php   |  13 +-
 .../Test/Json/JsonValidationExceptionTest.php      |   3 +-
 .../Test/Package/Archiver/GitExcludeFilterTest.php |   4 +-
 .../Test/Package/Archiver/ZipArchiverTest.php      |   5 +-
 tests/Composer/Test/Package/BasePackageTest.php    |  25 +--
 .../Composer/Test/Package/CompletePackageTest.php  |  13 +-
 .../Test/Package/Dumper/ArrayDumperTest.php        |   4 +-
 .../Test/Package/Loader/ArrayLoaderTest.php        |  14 +-
 .../Package/Loader/ValidatingArrayLoaderTest.php   |  13 +-
 tests/Composer/Test/Package/LockerTest.php         |  24 +--
 .../Test/Package/Version/VersionBumperTest.php     |   5 +-
 .../Test/Package/Version/VersionGuesserTest.php    |   5 +-
 .../Test/Package/Version/VersionParserTest.php     |   8 +-
 .../Test/Package/Version/VersionSelectorTest.php   |  27 ++-
 tests/Composer/Test/Platform/VersionTest.php       |  13 +-
 tests/Composer/Test/Plugin/PluginInstallerTest.php |  59 +++---
 .../Question/StrictConfirmationQuestionTest.php    |   9 +-
 .../Test/Repository/ComposerRepositoryTest.php     |  14 +-
 .../Test/Repository/CompositeRepositoryTest.php    |   4 +-
 .../Test/Repository/FilesystemRepositoryTest.php   |  24 +--
 .../Test/Repository/FilterRepositoryTest.php       |   4 +-
 .../Test/Repository/PlatformRepositoryTest.php     |  11 +-
 .../Test/Repository/RepositoryFactoryTest.php      |   4 +-
 .../Test/Repository/RepositoryManagerTest.php      |  10 +-
 .../Test/Repository/RepositoryUtilsTest.php        |   3 +-
 .../Test/Repository/Vcs/FossilDriverTest.php       |   5 +-
 .../Test/Repository/Vcs/GitBitbucketDriverTest.php |   5 +-
 .../Test/Repository/Vcs/GitHubDriverTest.php       |  29 ++-
 .../Test/Repository/Vcs/GitLabDriverTest.php       |   9 +-
 .../Composer/Test/Repository/Vcs/HgDriverTest.php  |   5 +-
 .../Test/Repository/Vcs/PerforceDriverTest.php     |  17 +-
 .../Composer/Test/Repository/Vcs/SvnDriverTest.php |   5 +-
 tests/Composer/Test/Util/AuthHelperTest.php        |  16 +-
 tests/Composer/Test/Util/BitbucketTest.php         |   5 +-
 tests/Composer/Test/Util/ErrorHandlerTest.php      |   3 +-
 tests/Composer/Test/Util/FilesystemTest.php        |  13 +-
 tests/Composer/Test/Util/GitTest.php               |  16 +-
 tests/Composer/Test/Util/Http/ProxyItemTest.php    |   9 +-
 tests/Composer/Test/Util/Http/ProxyManagerTest.php |  10 +-
 tests/Composer/Test/Util/Http/RequestProxyTest.php |  11 +-
 tests/Composer/Test/Util/HttpDownloaderTest.php    |   4 +-
 tests/Composer/Test/Util/NoProxyPatternTest.php    |  17 +-
 tests/Composer/Test/Util/PackageSorterTest.php     |   4 +-
 tests/Composer/Test/Util/ProcessExecutorTest.php   |   8 +-
 tests/Composer/Test/Util/RemoteFilesystemTest.php  |   8 +-
 .../Test/Util/StreamContextFactoryTest.php         |   8 +-
 tests/Composer/Test/Util/SvnTest.php               |   4 +-
 tests/Composer/Test/Util/TlsHelperTest.php         |   4 +-
 tests/Composer/Test/Util/UrlTest.php               |   8 +-
 101 files changed, 742 insertions(+), 841 deletions(-)

diff --git a/tests/Composer/Test/Advisory/AuditorTest.php b/tests/Composer/Test/Advisory/AuditorTest.php
index 42e0c0c..5a8201d 100644
--- a/tests/Composer/Test/Advisory/AuditorTest.php
+++ b/tests/Composer/Test/Advisory/AuditorTest.php
@@ -23,6 +23,7 @@ use Composer\Repository\RepositorySet;
 use Composer\Test\TestCase;
 use Composer\Advisory\Auditor;
 use InvalidArgumentException;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class AuditorTest extends TestCase
 {
@@ -186,9 +187,9 @@ Found 2 abandoned packages:
     }
 
     /**
-     * @dataProvider auditProvider
      * @phpstan-param array<string, mixed> $data
      */
+    #[DataProvider('auditProvider')]
     public function testAudit(array $data, int $expected, string $output): void
     {
         if (count($data['packages']) === 0) {
@@ -339,12 +340,12 @@ Found 2 abandoned packages:
     }
 
     /**
-     * @dataProvider ignoredIdsProvider
      * @phpstan-param array<\Composer\Package\Package> $packages
      * @phpstan-param array<string>|array<string,string> $ignoredIds
      * @phpstan-param 0|positive-int $exitCode
      * @phpstan-param list<array{text: string, verbosity?: \Composer\IO\IOInterface::*, regex?: true}|array{ask: string, reply: string}|array{auth: array{string, string, string|null}}> $expectedOutput
      */
+    #[DataProvider('ignoredIdsProvider')]
     public function testAuditWithIgnore($packages, $ignoredIds, $exitCode, $expectedOutput): void
     {
         $auditor = new Auditor();
@@ -388,13 +389,13 @@ Found 2 abandoned packages:
     }
 
     /**
-     * @dataProvider ignoreSeverityProvider
      * @phpstan-param array<\Composer\Package\Package> $packages
      * @phpstan-param array<string> $ignoredSeverities
      * @phpstan-param 0|positive-int $exitCode
      * @phpstan-param list<array{text: string, verbosity?: \Composer\IO\IOInterface::*, regex?: true}|array{ask: string, reply: string}|array{auth: array{string, string, string|null}}> $expectedOutput
      */
-    public function testAuditWithIgnoreSeverity($packages, $ignoredSeverities, $exitCode, $expectedOutput): void
+    #[DataProvider('ignoreSeverityProvider')]
+public function testAuditWithIgnoreSeverity($packages, $ignoredSeverities, $exitCode, $expectedOutput): void
     {
         $auditor = new Auditor();
         $result = $auditor->audit($io = $this->getIOMock(), $this->getRepoSet(), $packages, Auditor::FORMAT_PLAIN, false, [], Auditor::ABANDONED_IGNORE, $ignoredSeverities);
diff --git a/tests/Composer/Test/AllFunctionalTest.php b/tests/Composer/Test/AllFunctionalTest.php
index a721a6e..a45b97d 100644
--- a/tests/Composer/Test/AllFunctionalTest.php
+++ b/tests/Composer/Test/AllFunctionalTest.php
@@ -15,6 +15,8 @@ namespace Composer\Test;
 use Composer\Pcre\Preg;
 use Composer\Util\Filesystem;
 use Composer\Util\Platform;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Depends;
 use PHPUnit\Framework\Attributes\Group;
 use Symfony\Component\Finder\Finder;
 use Symfony\Component\Process\Process;
@@ -101,10 +103,8 @@ class AllFunctionalTest extends TestCase
         chmod(__DIR__.'/../../composer-test.phar', 0777);
     }
 
-    /**
-     * @dataProvider getTestFiles
-     * @depends testBuildPhar
-     */
+    #[DataProvider('getTestFiles')]
+    #[Depends('testBuildPhar')]
     public function testIntegration(string $testFile): void
     {
         $testData = $this->parseTestFile($testFile);
diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
index 67930ea..298cfb2 100644
--- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
+++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
@@ -31,6 +31,7 @@ use Composer\Installer\InstallationManager;
 use Composer\Config;
 use Composer\EventDispatcher\EventDispatcher;
 use Composer\Util\Platform;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\MockObject\MockObject;
 
 class AutoloadGeneratorTest extends TestCase
@@ -119,7 +120,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->config->expects($this->atLeastOnce())
             ->method('get')
-            ->will($this->returnCallback(function ($arg) {
+            ->willReturnCallback(function ($arg) {
                 $ret = null;
                 if (isset($this->configValueMap[$arg])) {
                     $ret = $this->configValueMap[$arg];
@@ -129,7 +130,7 @@ class AutoloadGeneratorTest extends TestCase
                 }
 
                 return $ret;
-            }));
+            });
 
         $this->origDir = Platform::getCwd();
         chdir($this->workingDir);
@@ -139,7 +140,7 @@ class AutoloadGeneratorTest extends TestCase
             ->getMock();
         $this->im->expects($this->any())
             ->method('getInstallPath')
-            ->will($this->returnCallback(function ($package): ?string {
+            ->willReturnCallback(function ($package): ?string {
                 if ($package->getType() === 'metapackage') {
                     return null;
                 }
@@ -147,7 +148,7 @@ class AutoloadGeneratorTest extends TestCase
                 $targetDir = $package->getTargetDir();
 
                 return $this->vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
-            }));
+            });
         $this->repository = $this->getMockBuilder('Composer\Repository\InstalledRepositoryInterface')->getMock();
         $this->repository->expects($this->any())
             ->method('getDevPackageNames')
@@ -191,7 +192,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->fs->ensureDirectoryExists($this->workingDir.'/composer');
         $this->fs->ensureDirectoryExists($this->workingDir.'/src/Lala/Test');
@@ -236,7 +237,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->fs->ensureDirectoryExists($this->workingDir.'/composer');
         $this->fs->ensureDirectoryExists($this->workingDir.'/src/Main');
@@ -271,7 +272,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->fs->ensureDirectoryExists($this->workingDir.'/composer');
         $this->fs->ensureDirectoryExists($this->workingDir.'/src/Main');
@@ -306,7 +307,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/composer');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/src/Main');
@@ -335,7 +336,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->vendorDir .= '/subdir';
 
@@ -362,7 +363,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a');
         $this->fs->ensureDirectoryExists($this->workingDir.'/src');
@@ -390,7 +391,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a');
         $this->fs->ensureDirectoryExists($this->workingDir.'/src');
@@ -423,7 +424,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/composer');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/src');
@@ -455,7 +456,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/composer');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src');
@@ -490,7 +491,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/composer');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/src');
@@ -520,7 +521,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src/C');
         file_put_contents($this->vendorDir.'/b/b/src/C/C.php', '<?php namespace B\\C; class C {}');
@@ -557,7 +558,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/composer');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/src');
@@ -602,7 +603,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/src');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src');
@@ -653,7 +654,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([$vendorPackage]));
+            ->willReturn([$vendorPackage]);
 
         $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, 'Phar');
 
@@ -673,7 +674,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_8');
         self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
@@ -696,7 +697,7 @@ class AutoloadGeneratorTest extends TestCase
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->fs->ensureDirectoryExists($this->workingDir.'/psr0/psr0');
         $this->fs->ensureDirectoryExists($this->workingDir.'/psr4');
@@ -742,7 +743,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/composer');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/src');
@@ -783,7 +784,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/composer');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/target/src');
@@ -825,7 +826,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/composer');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/src');
@@ -870,7 +871,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/composer');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/src');
@@ -919,7 +920,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/composer');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/src');
@@ -970,7 +971,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a');
         $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b');
@@ -1109,7 +1110,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir . '/z/foo');
         $this->fs->ensureDirectoryExists($this->vendorDir . '/b/bar');
@@ -1170,7 +1171,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->workingDir.'/lib/A/B');
         $this->fs->ensureDirectoryExists($this->workingDir.'/src/');
@@ -1260,7 +1261,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method("getCanonicalPackages")
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/composer');
 
@@ -1289,7 +1290,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method("getCanonicalPackages")
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         mkdir($this->vendorDir."/composer", 0777, true);
 
@@ -1318,7 +1319,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method("getCanonicalPackages")
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         mkdir($this->vendorDir."/composer", 0777, true);
 
@@ -1347,7 +1348,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method("getCanonicalPackages")
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         mkdir($this->vendorDir."/composer", 0777, true);
 
@@ -1377,7 +1378,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->generator->setRunScripts(true);
         $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_8');
@@ -1393,7 +1394,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->configValueMap['use-include-path'] = true;
 
@@ -1433,18 +1434,18 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([$vendorPackage]));
+            ->willReturn([$vendorPackage]);
 
         $im = $this->getMockBuilder('Composer\Installer\InstallationManager')
             ->disableOriginalConstructor()
             ->getMock();
         $im->expects($this->any())
             ->method('getInstallPath')
-            ->will($this->returnCallback(static function ($package) use ($vendorDir): string {
+            ->willReturnCallback(static function ($package) use ($vendorDir): string {
                 $targetDir = $package->getTargetDir();
 
                 return $vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
-            }));
+            });
 
         $this->fs->ensureDirectoryExists($workingDir.'/src/Foo');
         $this->fs->ensureDirectoryExists($workingDir.'/classmap');
@@ -1535,7 +1536,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->fs->ensureDirectoryExists($this->workingDir.'/src/Foo');
         $this->fs->ensureDirectoryExists($this->workingDir.'/classmap/excluded');
@@ -1612,7 +1613,7 @@ EOF;
 
         $this->repository->expects($this->any())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([$dep]));
+            ->willReturn([$dep]);
 
         $dep->setAutoload([
             'psr-0' => ['Foo' => './src'],
@@ -1694,7 +1695,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->fs->ensureDirectoryExists($this->workingDir.'/Foo');
         file_put_contents($this->workingDir.'/Foo/Bar.php', '<?php namespace Foo; class Bar {}');
@@ -1761,7 +1762,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->fs->ensureDirectoryExists($this->vendorDir.'/a');
 
@@ -1824,7 +1825,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->fs->ensureDirectoryExists($this->workingDir.'/composer');
         $this->fs->ensureDirectoryExists($this->workingDir.'/src/Lala/Test');
@@ -1872,9 +1873,8 @@ EOF;
      * @param array<string, Link>  $provides
      * @param array<string, Link>  $replaces
      * @param bool|array<string>   $ignorePlatformReqs
-     *
-     * @dataProvider platformCheckProvider
      */
+    #[DataProvider('platformCheckProvider')]
     public function testGeneratesPlatformCheck(array $requires, ?string $expectedFixture, array $provides = [], array $replaces = [], $ignorePlatformReqs = false): void
     {
         $package = new RootPackage('root/a', '1.0', '1.0');
@@ -1890,7 +1890,7 @@ EOF;
 
         $this->repository->expects($this->once())
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $this->generator->setPlatformRequirementFilter(PlatformRequirementFilterFactory::fromBoolOrList($ignorePlatformReqs));
         $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
diff --git a/tests/Composer/Test/Autoload/ClassLoaderTest.php b/tests/Composer/Test/Autoload/ClassLoaderTest.php
index 5d385c4..3065834 100644
--- a/tests/Composer/Test/Autoload/ClassLoaderTest.php
+++ b/tests/Composer/Test/Autoload/ClassLoaderTest.php
@@ -14,6 +14,7 @@ namespace Composer\Test\Autoload;
 
 use Composer\Autoload\ClassLoader;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 /**
  * Tests the Composer\Autoload\ClassLoader class.
@@ -23,10 +24,9 @@ class ClassLoaderTest extends TestCase
     /**
      * Tests regular PSR-0 and PSR-4 class loading.
      *
-     * @dataProvider getLoadClassTests
-     *
      * @param string $class The fully-qualified class name to test, without preceding namespace separator.
      */
+    #[DataProvider('getLoadClassTests')]
     public function testLoadClass(string $class): void
     {
         $loader = new ClassLoader();
diff --git a/tests/Composer/Test/CacheTest.php b/tests/Composer/Test/CacheTest.php
index e5eb0e2..dc13bfa 100644
--- a/tests/Composer/Test/CacheTest.php
+++ b/tests/Composer/Test/CacheTest.php
@@ -50,7 +50,7 @@ class CacheTest extends TestCase
         $this->cache
             ->expects($this->any())
             ->method('getFinder')
-            ->will($this->returnValue($this->finder));
+            ->willReturn($this->finder);
     }
 
     protected function tearDown(): void
@@ -68,11 +68,11 @@ class CacheTest extends TestCase
         $this->finder
             ->expects($this->once())
             ->method('getIterator')
-            ->will($this->returnValue(new \ArrayIterator($outdated)));
+            ->willReturn(new \ArrayIterator($outdated));
         $this->finder
             ->expects($this->once())
             ->method('date')
-            ->will($this->returnValue($this->finder));
+            ->willReturn($this->finder);
 
         $this->cache->gc(600, 1024 * 1024 * 1024);
 
@@ -88,20 +88,20 @@ class CacheTest extends TestCase
         $emptyFinder
             ->expects($this->once())
             ->method('getIterator')
-            ->will($this->returnValue(new \EmptyIterator()));
+            ->willReturn(new \EmptyIterator());
 
         $this->finder
             ->expects($this->once())
             ->method('date')
-            ->will($this->returnValue($emptyFinder));
+            ->willReturn($emptyFinder);
         $this->finder
             ->expects($this->once())
             ->method('getIterator')
-            ->will($this->returnValue(new \ArrayIterator($this->files)));
+            ->willReturn(new \ArrayIterator($this->files));
         $this->finder
             ->expects($this->once())
             ->method('sortByAccessedTime')
-            ->will($this->returnValue($this->finder));
+            ->willReturn($this->finder);
 
         $this->cache->gc(600, 1500);
 
diff --git a/tests/Composer/Test/Command/BaseDependencyCommandTest.php b/tests/Composer/Test/Command/BaseDependencyCommandTest.php
index 120e244..6936f18 100644
--- a/tests/Composer/Test/Command/BaseDependencyCommandTest.php
+++ b/tests/Composer/Test/Command/BaseDependencyCommandTest.php
@@ -23,6 +23,7 @@ use Composer\Test\TestCase;
 use Composer\Package\Link;
 use RuntimeException;
 use Generator;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class BaseDependencyCommandTest extends TestCase
 {
@@ -33,10 +34,9 @@ class BaseDependencyCommandTest extends TestCase
      * @covers       \Composer\Command\DependsCommand
      * @covers       \Composer\Command\ProhibitsCommand
      *
-     * @dataProvider noParametersCaseProvider
-     *
      * @param array<string, string> $parameters
      */
+    #[DataProvider('noParametersCaseProvider')]
     public function testExceptionWhenNoRequiredParameters(
         string $command,
         array $parameters,
@@ -86,10 +86,9 @@ class BaseDependencyCommandTest extends TestCase
      * @covers       \Composer\Command\DependsCommand
      * @covers       \Composer\Command\ProhibitsCommand
      *
-     * @dataProvider caseProvider
-     *
      * @param array<string, string> $parameters
      */
+    #[DataProvider('caseProvider')]
     public function testExceptionWhenRunningLockedWithoutLockFile(string $command, array $parameters): void
     {
         $this->initTempComposer();
@@ -112,10 +111,9 @@ class BaseDependencyCommandTest extends TestCase
      * @covers       \Composer\Command\DependsCommand
      * @covers       \Composer\Command\ProhibitsCommand
      *
-     * @dataProvider caseProvider
-     *
      * @param array<string, string> $parameters
      */
+    #[DataProvider('caseProvider')]
     public function testExceptionWhenItCouldNotFoundThePackage(string $command, array $parameters): void
     {
         $packageToBeInspected = $parameters['package'];
@@ -139,10 +137,9 @@ class BaseDependencyCommandTest extends TestCase
      * @covers       \Composer\Command\DependsCommand
      * @covers       \Composer\Command\ProhibitsCommand
      *
-     * @dataProvider caseProvider
-     *
      * @param array<string, string> $parameters
      */
+    #[DataProvider('caseProvider')]
     public function testExceptionWhenPackageWasNotFoundInProject(string $command, array $parameters): void
     {
         $packageToBeInspected = $parameters['package'];
@@ -175,10 +172,9 @@ class BaseDependencyCommandTest extends TestCase
      * @covers       \Composer\Command\DependsCommand
      * @covers       \Composer\Command\ProhibitsCommand
      *
-     * @dataProvider caseProvider
-     *
      * @param array<string, string> $parameters
      */
+    #[DataProvider('caseProvider')]
     public function testWarningWhenDependenciesAreNotInstalled(string $command, array $parameters): void
     {
         $expectedWarningMessage = '<warning>No dependencies installed. Try running composer install or update, or use --locked.</warning>';
@@ -225,10 +221,9 @@ class BaseDependencyCommandTest extends TestCase
      * @covers       \Composer\Command\BaseDependencyCommand
      * @covers       \Composer\Command\DependsCommand
      *
-     * @dataProvider caseWhyProvider
-     *
      * @param array<string, string|bool> $parameters
      */
+    #[DataProvider('caseWhyProvider')]
     public function testWhyCommandOutputs(array $parameters, string $expectedOutput, int $expectedStatusCode): void
     {
         $packageToBeInspected = $parameters['package'];
@@ -359,10 +354,9 @@ OUTPUT
      * @covers       \Composer\Command\BaseDependencyCommand
      * @covers       \Composer\Command\ProhibitsCommand
      *
-     * @dataProvider caseWhyNotProvider
-     *
      * @param array<string, string> $parameters
      */
+    #[DataProvider('caseWhyNotProvider')]
     public function testWhyNotCommandOutputs(array $parameters, string $expectedOutput, int $expectedStatusCode): void
     {
         $packageToBeInspected = $parameters['package'];
diff --git a/tests/Composer/Test/Command/BumpCommandTest.php b/tests/Composer/Test/Command/BumpCommandTest.php
index 7b8bd27..f312034 100644
--- a/tests/Composer/Test/Command/BumpCommandTest.php
+++ b/tests/Composer/Test/Command/BumpCommandTest.php
@@ -14,15 +14,16 @@ namespace Composer\Test\Command;
 
 use Composer\Json\JsonFile;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class BumpCommandTest extends TestCase
 {
     /**
-     * @dataProvider provideTests
      * @param array<mixed> $composerJson
      * @param array<mixed> $command
      * @param array<mixed> $expected
      */
+    #[DataProvider('provideTests')]
     public function testBump(array $composerJson, array $command, array $expected, bool $lock = true, int $exitCode = 0): void
     {
         $this->initTempComposer($composerJson);
diff --git a/tests/Composer/Test/Command/CheckPlatformReqsCommandTest.php b/tests/Composer/Test/Command/CheckPlatformReqsCommandTest.php
index 27d8526..bb70cf5 100644
--- a/tests/Composer/Test/Command/CheckPlatformReqsCommandTest.php
+++ b/tests/Composer/Test/Command/CheckPlatformReqsCommandTest.php
@@ -14,14 +14,15 @@ namespace Composer\Test\Command;
 
 use Composer\Test\TestCase;
 use LogicException;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class CheckPlatformReqsCommandTest extends TestCase
 {
     /**
-     * @dataProvider caseProvider
      * @param array<mixed> $composerJson
      * @param array<mixed> $command
      */
+    #[DataProvider('caseProvider')]
     public function testPlatformReqsAreSatisfied(
         array $composerJson,
         array $command,
diff --git a/tests/Composer/Test/Command/ConfigCommandTest.php b/tests/Composer/Test/Command/ConfigCommandTest.php
index 5542eb8..eda604d 100644
--- a/tests/Composer/Test/Command/ConfigCommandTest.php
+++ b/tests/Composer/Test/Command/ConfigCommandTest.php
@@ -14,15 +14,16 @@ namespace Composer\Test\Command;
 
 use Composer\Test\TestCase;
 use RuntimeException;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class ConfigCommandTest extends TestCase
 {
     /**
-     * @dataProvider provideConfigUpdates
      * @param array<mixed> $before
      * @param array<mixed> $command
      * @param array<mixed> $expected
      */
+    #[DataProvider('provideConfigUpdates')]
     public function testConfigUpdates(array $before, array $command, array $expected): void
     {
         $this->initTempComposer($before);
@@ -120,10 +121,10 @@ class ConfigCommandTest extends TestCase
     }
 
     /**
-     * @dataProvider provideConfigReads
      * @param array<mixed> $composerJson
      * @param array<mixed> $command
      */
+    #[DataProvider('provideConfigReads')]
     public function testConfigReads(array $composerJson, array $command, string $expected): void
     {
         $this->initTempComposer($composerJson);
diff --git a/tests/Composer/Test/Command/FundCommandTest.php b/tests/Composer/Test/Command/FundCommandTest.php
index 45e31fb..c63c6e9 100644
--- a/tests/Composer/Test/Command/FundCommandTest.php
+++ b/tests/Composer/Test/Command/FundCommandTest.php
@@ -14,15 +14,16 @@ namespace Composer\Test\Command;
 
 use Composer\Test\TestCase;
 use Generator;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class FundCommandTest extends TestCase
 {
     /**
-     * @dataProvider useCaseProvider
      * @param  array<mixed>  $composerJson
      * @param  array<mixed>  $command
      * @param  array<mixed>  $funding
      */
+    #[DataProvider('useCaseProvider')]
     public function testFundCommand(
         array $composerJson,
         array $command,
diff --git a/tests/Composer/Test/Command/HomeCommandTest.php b/tests/Composer/Test/Command/HomeCommandTest.php
index d0b722e..0d320d0 100644
--- a/tests/Composer/Test/Command/HomeCommandTest.php
+++ b/tests/Composer/Test/Command/HomeCommandTest.php
@@ -14,15 +14,16 @@ namespace Composer\Test\Command;
 
 use Composer\Test\TestCase;
 use Generator;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class HomeCommandTest extends TestCase
 {
     /**
-     * @dataProvider useCaseProvider
      * @param array<mixed> $composerJson
      * @param array<mixed> $command
      * @param array<mixed> $urls
      */
+    #[DataProvider('useCaseProvider')]
     public function testHomeCommandWithShowFlag(
         array $composerJson,
         array $command,
diff --git a/tests/Composer/Test/Command/InstallCommandTest.php b/tests/Composer/Test/Command/InstallCommandTest.php
index 33c1a36..51d9ad0 100644
--- a/tests/Composer/Test/Command/InstallCommandTest.php
+++ b/tests/Composer/Test/Command/InstallCommandTest.php
@@ -14,14 +14,15 @@ namespace Composer\Test\Command;
 
 use Composer\Test\TestCase;
 use Generator;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class InstallCommandTest extends TestCase
 {
     /**
-     * @dataProvider errorCaseProvider
      * @param array<mixed> $composerJson
      * @param array<mixed> $command
      */
+    #[DataProvider('errorCaseProvider')]
     public function testInstallCommandErrors(
         array $composerJson,
         array $command,
diff --git a/tests/Composer/Test/Command/ReinstallCommandTest.php b/tests/Composer/Test/Command/ReinstallCommandTest.php
index 4eacb68..2def7d5 100644
--- a/tests/Composer/Test/Command/ReinstallCommandTest.php
+++ b/tests/Composer/Test/Command/ReinstallCommandTest.php
@@ -14,14 +14,15 @@ namespace Composer\Test\Command;
 
 use Composer\Test\TestCase;
 use Generator;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class ReinstallCommandTest extends TestCase
 {
     /**
-     * @dataProvider caseProvider
      * @param array<mixed> $options
      * @param string $expected
      */
+    #[DataProvider('caseProvider')]
     public function testReinstallCommand(array $options, string $expected): void
     {
         $this->initTempComposer([
diff --git a/tests/Composer/Test/Command/RemoveCommandTest.php b/tests/Composer/Test/Command/RemoveCommandTest.php
index f871993..0b6f8df 100644
--- a/tests/Composer/Test/Command/RemoveCommandTest.php
+++ b/tests/Composer/Test/Command/RemoveCommandTest.php
@@ -19,6 +19,7 @@ use Composer\Test\TestCase;
 use InvalidArgumentException;
 use Symfony\Component\Console\Command\Command;
 use UnexpectedValueException;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class RemoveCommandTest extends TestCase
 {
@@ -415,9 +416,7 @@ Lock file operations: 0 installs, 0 updates, 2 removals
         self::assertEquals([['name' => 'root/req', 'version' => '1.0.0', 'version_normalized' => '1.0.0.0', 'type' => 'library', 'install-path' => '../root/req']], (new JsonFile('./vendor/composer/installed.json'))->read()['packages']);
     }
 
-    /**
-     * @dataProvider provideInheritedDependenciesUpdateFlag
-     */
+    #[DataProvider('provideInheritedDependenciesUpdateFlag')]
     public function testUpdateInheritedDependenciesFlagIsPassedToPostRemoveInstaller(string $installFlagName, string $expectedComposerUpdateCommand): void
     {
         $this->initTempComposer([
diff --git a/tests/Composer/Test/Command/RequireCommandTest.php b/tests/Composer/Test/Command/RequireCommandTest.php
index bb5870f..a68d0d5 100644
--- a/tests/Composer/Test/Command/RequireCommandTest.php
+++ b/tests/Composer/Test/Command/RequireCommandTest.php
@@ -15,6 +15,7 @@ namespace Composer\Test\Command;
 use Composer\Json\JsonFile;
 use Composer\Test\TestCase;
 use InvalidArgumentException;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\Attributes\Group;
 
 class RequireCommandTest extends TestCase
@@ -86,10 +87,10 @@ Installation failed, reverting ./composer.json to its original content.
     }
 
     /**
-     * @dataProvider provideRequire
      * @param array<mixed> $composerJson
      * @param array<mixed> $command
      */
+    #[DataProvider('provideRequire')]
     public function testRequire(array $composerJson, array $command, string $expected): void
     {
         $this->initTempComposer($composerJson);
@@ -268,11 +269,11 @@ OUTPUT
     }
 
     /**
-     * @dataProvider provideInconsistentRequireKeys
      * @param bool $isDev
      * @param bool $isInteractive
      * @param string $expectedWarning
      */
+    #[DataProvider('provideInconsistentRequireKeys')]
     public function testInconsistentRequireKeys(bool $isDev, bool $isInteractive, string $expectedWarning): void
     {
         $currentKey = $isDev ? "require" : "require-dev";
diff --git a/tests/Composer/Test/Command/RunScriptCommandTest.php b/tests/Composer/Test/Command/RunScriptCommandTest.php
index f697910..030d01f 100644
--- a/tests/Composer/Test/Command/RunScriptCommandTest.php
+++ b/tests/Composer/Test/Command/RunScriptCommandTest.php
@@ -16,12 +16,11 @@ use Composer\Composer;
 use Composer\Config;
 use Composer\Script\Event as ScriptEvent;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class RunScriptCommandTest extends TestCase
 {
-    /**
-     * @dataProvider getDevOptions
-     */
+    #[DataProvider('getDevOptions')]
     public function testDetectAndPassDevModeToEventAndToDispatching(bool $dev, bool $noDev): void
     {
         $scriptName = 'testScript';
@@ -29,18 +28,18 @@ class RunScriptCommandTest extends TestCase
         $input = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock();
         $input
             ->method('getOption')
-            ->will($this->returnValueMap([
+            ->willReturnMap([
                 ['list', false],
                 ['dev', $dev],
                 ['no-dev', $noDev],
-            ]));
+            ]);
 
         $input
             ->method('getArgument')
-            ->will($this->returnValueMap([
+            ->willReturnMap([
                 ['script', $scriptName],
                 ['args', []],
-            ]));
+            ]);
         $input
             ->method('hasArgument')
             ->with('command')
diff --git a/tests/Composer/Test/Command/SearchCommandTest.php b/tests/Composer/Test/Command/SearchCommandTest.php
index 17d326d..4bed887 100644
--- a/tests/Composer/Test/Command/SearchCommandTest.php
+++ b/tests/Composer/Test/Command/SearchCommandTest.php
@@ -14,13 +14,14 @@ namespace Composer\Test\Command;
 
 use Composer\Test\TestCase;
 use InvalidArgumentException;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class SearchCommandTest extends TestCase
 {
     /**
-     * @dataProvider provideSearch
      * @param array<mixed> $command
      */
+    #[DataProvider('provideSearch')]
     public function testSearch(array $command, string $expected = ''): void
     {
         $this->initTempComposer([
diff --git a/tests/Composer/Test/Command/SelfUpdateCommandTest.php b/tests/Composer/Test/Command/SelfUpdateCommandTest.php
index 9a6dac8..975fc7a 100644
--- a/tests/Composer/Test/Command/SelfUpdateCommandTest.php
+++ b/tests/Composer/Test/Command/SelfUpdateCommandTest.php
@@ -14,6 +14,7 @@ namespace Composer\Test\Command;
 
 use Composer\Composer;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\Attributes\RequiresPhpunit;
 use Symfony\Component\Process\Process;
 
@@ -69,9 +70,7 @@ class SelfUpdateCommandTest extends TestCase
         $appTester->run(['command' => 'self-update', 'invalid-option' => true]);
     }
 
-    /**
-     * @dataProvider channelOptions
-     */
+    #[DataProvider('channelOptions')]
     #[RequiresPhpunit('< 11')]
     public function testUpdateToDifferentChannel(string $option, string $expectedOutput): void
     {
diff --git a/tests/Composer/Test/Command/ShowCommandTest.php b/tests/Composer/Test/Command/ShowCommandTest.php
index 700e730..746e987 100644
--- a/tests/Composer/Test/Command/ShowCommandTest.php
+++ b/tests/Composer/Test/Command/ShowCommandTest.php
@@ -19,15 +19,16 @@ use Composer\Repository\PlatformRepository;
 use Composer\Test\TestCase;
 use DateTimeImmutable;
 use InvalidArgumentException;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\Attributes\Group;
 
 class ShowCommandTest extends TestCase
 {
     /**
-     * @dataProvider provideShow
      * @param array<mixed> $command
      * @param array<string, string> $requires
      */
+    #[DataProvider('provideShow')]
     public function testShow(array $command, string $expected, array $requires = []): void
     {
         $this->initTempComposer([
@@ -734,9 +735,9 @@ OUTPUT;
     }
 
     /**
-     * @dataProvider provideNotExistingPackage
      * @param array<string, mixed> $options
      */
+    #[DataProvider('provideNotExistingPackage')]
     #[Group('remote')]
     public function testNotExistingPackage(string $package, array $options, string $expected): void
     {
@@ -801,9 +802,9 @@ OUTPUT;
     }
 
     /**
-     * @dataProvider providePackageAndTree
      * @param array<string, mixed> $options
      */
+    #[DataProvider('providePackageAndTree')]
     public function testSpecificPackageAndTree(callable $callable, array $options, string $expected): void
     {
         $this->initTempComposer([
diff --git a/tests/Composer/Test/Command/StatusCommandTest.php b/tests/Composer/Test/Command/StatusCommandTest.php
index 20ccf5e..23ea6e9 100644
--- a/tests/Composer/Test/Command/StatusCommandTest.php
+++ b/tests/Composer/Test/Command/StatusCommandTest.php
@@ -14,6 +14,7 @@ namespace Composer\Test\Command;
 
 use Composer\Test\TestCase;
 use Generator;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\Attributes\Group;
 
 class StatusCommandTest extends TestCase
@@ -35,11 +36,11 @@ class StatusCommandTest extends TestCase
     }
 
     /**
-     * @dataProvider locallyModifiedPackagesUseCaseProvider
      * @param array<mixed> $composerJson
      * @param array<mixed> $commandFlags
      * @param array<mixed> $packageData
      */
+    #[DataProvider('locallyModifiedPackagesUseCaseProvider')]
     #[Group('remote')]
     public function testLocallyModifiedPackages(
         array $composerJson,
diff --git a/tests/Composer/Test/Command/SuggestsCommandTest.php b/tests/Composer/Test/Command/SuggestsCommandTest.php
index 4d64d4b..b3ed2c3 100644
--- a/tests/Composer/Test/Command/SuggestsCommandTest.php
+++ b/tests/Composer/Test/Command/SuggestsCommandTest.php
@@ -16,6 +16,7 @@ use Composer\Package\CompletePackage;
 use Composer\Package\Link;
 use Composer\Test\TestCase;
 use Symfony\Component\Console\Command\Command;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class SuggestsCommandTest extends TestCase
 {
@@ -51,9 +52,9 @@ class SuggestsCommandTest extends TestCase
     }
 
     /**
-     * @dataProvider provideSuggest
      * @param array<string, bool|string|array<int, string>> $command
      */
+    #[DataProvider('provideSuggest')]
     public function testSuggest(bool $hasLockFile, array $command, string $expected): void
     {
         $this->initTempComposer([
diff --git a/tests/Composer/Test/Command/UpdateCommandTest.php b/tests/Composer/Test/Command/UpdateCommandTest.php
index facbba9..fa8bcaf 100644
--- a/tests/Composer/Test/Command/UpdateCommandTest.php
+++ b/tests/Composer/Test/Command/UpdateCommandTest.php
@@ -16,14 +16,15 @@ use Composer\Package\Link;
 use Composer\Semver\Constraint\MatchAllConstraint;
 use Composer\Test\TestCase;
 use InvalidArgumentException;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class UpdateCommandTest extends TestCase
 {
     /**
-     * @dataProvider provideUpdates
      * @param array<mixed> $composerJson
      * @param array<mixed> $command
      */
+    #[DataProvider('provideUpdates')]
     public function testUpdate(array $composerJson, array $command, string $expected, bool $createLock = false): void
     {
         $this->initTempComposer($composerJson);
@@ -323,9 +324,9 @@ OUTPUT;
     }
 
     /**
-     * @dataProvider provideInteractiveUpdates
      * @param array<mixed> $packageNames
      */
+    #[DataProvider('provideInteractiveUpdates')]
     public function testInteractiveTmp(array $packageNames, string $expected): void
     {
         $this->initTempComposer([
diff --git a/tests/Composer/Test/Command/ValidateCommandTest.php b/tests/Composer/Test/Command/ValidateCommandTest.php
index 5a329cc..e31d842 100644
--- a/tests/Composer/Test/Command/ValidateCommandTest.php
+++ b/tests/Composer/Test/Command/ValidateCommandTest.php
@@ -15,14 +15,15 @@ namespace Composer\Test\Command;
 
 use Composer\Test\TestCase;
 use Composer\Util\Platform;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class ValidateCommandTest extends TestCase
 {
     /**
-     * @dataProvider provideValidateTests
      * @param array<mixed> $composerJson
      * @param array<mixed> $command
      */
+    #[DataProvider('provideValidateTests')]
     public function testValidate(array $composerJson, array $command, string $expected): void
     {
         $this->initTempComposer($composerJson);
diff --git a/tests/Composer/Test/CompletionFunctionalTest.php b/tests/Composer/Test/CompletionFunctionalTest.php
index a6dd619..40fa11a 100644
--- a/tests/Composer/Test/CompletionFunctionalTest.php
+++ b/tests/Composer/Test/CompletionFunctionalTest.php
@@ -15,6 +15,7 @@ namespace Composer\Test;
 use Composer\Console\Application;
 use PHPUnit\Framework\Attributes\Group;
 use Symfony\Component\Console\Tester\CommandCompletionTester;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 /**
  * Validate autocompletion for all commands.
@@ -122,11 +123,10 @@ class CompletionFunctionalTest extends TestCase
     }
 
     /**
-     * @dataProvider getCommandSuggestions
-     *
      * @param string $input The command that is typed
      * @param string[]|null $expectedSuggestions Sample expected suggestions. Null if nothing is expected.
      */
+    #[DataProvider('getCommandSuggestions')]
     #[Group('remote')]
     public function testComplete(string $input, ?array $expectedSuggestions): void
     {
diff --git a/tests/Composer/Test/Config/JsonConfigSourceTest.php b/tests/Composer/Test/Config/JsonConfigSourceTest.php
index 9ec1c68..17537ef 100644
--- a/tests/Composer/Test/Config/JsonConfigSourceTest.php
+++ b/tests/Composer/Test/Config/JsonConfigSourceTest.php
@@ -16,6 +16,7 @@ use Composer\Config\JsonConfigSource;
 use Composer\Json\JsonFile;
 use Composer\Test\TestCase;
 use Composer\Util\Filesystem;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class JsonConfigSourceTest extends TestCase
 {
@@ -109,9 +110,8 @@ class JsonConfigSourceTest extends TestCase
      * @param string $name           Name
      * @param string $value          Value
      * @param string $compareAgainst File to compare against after making changes
-     *
-     * @dataProvider provideAddLinkData
      */
+    #[DataProvider('provideAddLinkData')]
     public function testAddLink(string $sourceFile, string $type, string $name, string $value, string $compareAgainst): void
     {
         $composerJson = $this->workingDir.'/composer.json';
@@ -130,9 +130,8 @@ class JsonConfigSourceTest extends TestCase
      * @param string $type           Type (require, require-dev, provide, suggest, replace, conflict)
      * @param string $name           Name
      * @param string $compareAgainst File to compare against after making changes
-     *
-     * @dataProvider provideRemoveLinkData
      */
+    #[DataProvider('provideRemoveLinkData')]
     public function testRemoveLink(string $sourceFile, string $type, string $name, string $compareAgainst): void
     {
         $composerJson = $this->workingDir.'/composer.json';
diff --git a/tests/Composer/Test/ConfigTest.php b/tests/Composer/Test/ConfigTest.php
index 1f35fbd..6a43427 100644
--- a/tests/Composer/Test/ConfigTest.php
+++ b/tests/Composer/Test/ConfigTest.php
@@ -16,15 +16,17 @@ use Composer\Advisory\Auditor;
 use Composer\Config;
 use Composer\IO\IOInterface;
 use Composer\Util\Platform;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
 
 class ConfigTest extends TestCase
 {
     /**
-     * @dataProvider dataAddPackagistRepository
      * @param mixed[] $expected
      * @param mixed[] $localConfig
      * @param ?array<mixed> $systemConfig
      */
+    #[DataProvider('dataAddPackagistRepository')]
     public function testAddPackagistRepository(array $expected, array $localConfig, ?array $systemConfig = null): void
     {
         $config = new Config(false);
@@ -243,19 +245,15 @@ class ConfigTest extends TestCase
         self::assertEquals(['https', 'git'], $config->get('github-protocols'));
     }
 
-    /**
-     * @dataProvider allowedUrlProvider
-     * @doesNotPerformAssertions
-     */
+    #[DataProvider('allowedUrlProvider')]
+    #[DoesNotPerformAssertions]
     public function testAllowedUrlsPass(string $url): void
     {
         $config = new Config(false);
         $config->prohibitUrlByConfig($url);
     }
 
-    /**
-     * @dataProvider prohibitedUrlProvider
-     */
+    #[DataProvider('prohibitedUrlProvider')]
     public function testProhibitedUrlsThrowException(string $url): void
     {
         self::expectException('Composer\Downloader\TransportException');
diff --git a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php
index fc22625..8039e93 100644
--- a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php
+++ b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php
@@ -31,11 +31,11 @@ use Composer\Repository\RepositoryFactory;
 use Composer\Repository\RepositorySet;
 use Composer\Test\TestCase;
 use Composer\Util\Platform;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class PoolBuilderTest extends TestCase
 {
     /**
-     * @dataProvider getIntegrationTests
      * @param string[] $expect
      * @param string[] $expectOptimized
      * @param mixed[] $root
@@ -43,6 +43,7 @@ class PoolBuilderTest extends TestCase
      * @param mixed[] $packageRepos
      * @param mixed[] $fixed
      */
+    #[DataProvider('getIntegrationTests')]
     public function testPoolBuilder(string $file, string $message, array $expect, array $expectOptimized, array $root, array $requestData, array $packageRepos, array $fixed): void
     {
         $rootAliases = !empty($root['aliases']) ? $root['aliases'] : [];
diff --git a/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php b/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php
index d897451..0b8ecb7 100644
--- a/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php
+++ b/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php
@@ -24,15 +24,16 @@ use Composer\Package\Version\VersionParser;
 use Composer\Pcre\Preg;
 use Composer\Repository\LockArrayRepository;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class PoolOptimizerTest extends TestCase
 {
     /**
-     * @dataProvider provideIntegrationTests
      * @param mixed[] $requestData
      * @param BasePackage[] $packagesBefore
      * @param BasePackage[] $expectedPackages
      */
+    #[DataProvider('provideIntegrationTests')]
     public function testPoolOptimizer(array $requestData, array $packagesBefore, array $expectedPackages, string $message): void
     {
         $lockedRepo = new LockArrayRepository();
diff --git a/tests/Composer/Test/DocumentationTest.php b/tests/Composer/Test/DocumentationTest.php
index d7e7ef8..4f4b910 100644
--- a/tests/Composer/Test/DocumentationTest.php
+++ b/tests/Composer/Test/DocumentationTest.php
@@ -15,12 +15,11 @@ namespace Composer\Test;
 use Composer\Console\Application;
 use Symfony\Component\Console\Command\Command;
 use Symfony\Component\Console\Descriptor\ApplicationDescription;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class DocumentationTest extends TestCase
 {
-    /**
-     * @dataProvider provideCommandCases
-     */
+    #[DataProvider('provideCommandCases')]
     public function testCommand(Command $command): void
     {
         static $docContent = null;
diff --git a/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php b/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php
index 8a56de0..5554274 100644
--- a/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php
+++ b/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php
@@ -13,7 +13,10 @@
 namespace Composer\Test\Downloader;
 
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\RequiresPhpunit;
 
+#[RequiresPhpunit('< 12')]
 class ArchiveDownloaderTest extends TestCase
 {
     /** @var \Composer\Config&\PHPUnit\Framework\MockObject\MockObject */
@@ -24,7 +27,7 @@ class ArchiveDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getDistUrl')
-            ->will($this->returnValue('http://example.com/script.js'))
+            ->willReturn('http://example.com/script.js')
         ;
 
         $downloader = $this->getArchiveDownloaderMock();
@@ -34,7 +37,7 @@ class ArchiveDownloaderTest extends TestCase
         $this->config->expects($this->any())
             ->method('get')
             ->with('vendor-dir')
-            ->will($this->returnValue('/vendor'));
+            ->willReturn('/vendor');
 
         $first = $method->invoke($downloader, $packageMock, '/path');
         self::assertMatchesRegularExpression('#/vendor/composer/tmp-[a-z0-9]+\.js#', $first);
@@ -89,9 +92,7 @@ class ArchiveDownloaderTest extends TestCase
         self::assertEquals($expected, $url);
     }
 
-    /**
-     * @dataProvider provideUrls
-     */
+    #[DataProvider('provideUrls')]
     public function testProcessUrlRewriteDist(string $url): void
     {
         if (!extension_loaded('openssl')) {
@@ -108,7 +109,7 @@ class ArchiveDownloaderTest extends TestCase
         $package = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $package->expects($this->any())
             ->method('getDistReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $url = $method->invoke($downloader, $package, $url);
 
         self::assertEquals($expected, $url);
@@ -126,9 +127,7 @@ class ArchiveDownloaderTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider provideBitbucketUrls
-     */
+    #[DataProvider('provideBitbucketUrls')]
     public function testProcessUrlRewriteBitbucketDist(string $url, string $extension): void
     {
         if (!extension_loaded('openssl')) {
@@ -145,7 +144,7 @@ class ArchiveDownloaderTest extends TestCase
         $package = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $package->expects($this->any())
             ->method('getDistReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $url = $method->invoke($downloader, $package, $url);
 
         self::assertEquals($expected, $url);
diff --git a/tests/Composer/Test/Downloader/DownloadManagerTest.php b/tests/Composer/Test/Downloader/DownloadManagerTest.php
index 885a174..a4403f0 100644
--- a/tests/Composer/Test/Downloader/DownloadManagerTest.php
+++ b/tests/Composer/Test/Downloader/DownloadManagerTest.php
@@ -15,6 +15,7 @@ namespace Composer\Test\Downloader;
 use Composer\Downloader\DownloadManager;
 use Composer\Package\PackageInterface;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class DownloadManagerTest extends TestCase
 {
@@ -48,7 +49,7 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getInstallationSource')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         $manager = new DownloadManager($this->io, false, $this->filesystem);
 
@@ -63,17 +64,17 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getInstallationSource')
-            ->will($this->returnValue('dist'));
+            ->willReturn('dist');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
 
         $downloader = $this->createDownloaderMock();
         $downloader
             ->expects($this->once())
             ->method('getInstallationSource')
-            ->will($this->returnValue('dist'));
+            ->willReturn('dist');
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -84,7 +85,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloader')
             ->with('pear')
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         self::assertSame($downloader, $manager->getDownloaderForPackage($package));
     }
@@ -95,17 +96,17 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getInstallationSource')
-            ->will($this->returnValue('dist'));
+            ->willReturn('dist');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
 
         $downloader = $this->createDownloaderMock();
         $downloader
             ->expects($this->exactly(2))
             ->method('getInstallationSource')
-            ->will($this->returnValue('source'));
+            ->willReturn('source');
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -116,7 +117,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloader')
             ->with('git')
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         self::expectException('LogicException');
 
@@ -129,17 +130,17 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getInstallationSource')
-            ->will($this->returnValue('source'));
+            ->willReturn('source');
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
 
         $downloader = $this->createDownloaderMock();
         $downloader
             ->expects($this->once())
             ->method('getInstallationSource')
-            ->will($this->returnValue('source'));
+            ->willReturn('source');
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -150,7 +151,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloader')
             ->with('git')
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         self::assertSame($downloader, $manager->getDownloaderForPackage($package));
     }
@@ -161,17 +162,17 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getInstallationSource')
-            ->will($this->returnValue('source'));
+            ->willReturn('source');
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
 
         $downloader = $this->createDownloaderMock();
         $downloader
             ->expects($this->exactly(2))
             ->method('getInstallationSource')
-            ->will($this->returnValue('dist'));
+            ->willReturn('dist');
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -182,7 +183,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloader')
             ->with('pear')
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         self::expectException('LogicException');
 
@@ -195,7 +196,7 @@ class DownloadManagerTest extends TestCase
         $package
           ->expects($this->once())
           ->method('getType')
-          ->will($this->returnValue('metapackage'));
+          ->willReturn('metapackage');
 
         $manager = new DownloadManager($this->io, false, $this->filesystem);
 
@@ -208,11 +209,11 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
 
         $package
             ->expects($this->once())
@@ -224,7 +225,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -234,7 +235,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         $manager->download($package, 'target_dir');
     }
@@ -245,15 +246,15 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
         $package
             ->expects($this->any())
             ->method('getPrettyString')
-            ->will($this->returnValue('prettyPackage'));
+            ->willReturn('prettyPackage');
 
         $package
             ->expects($this->exactly(2))
@@ -279,7 +280,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -303,11 +304,11 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         $manager = new DownloadManager($this->io, false, $this->filesystem);
 
@@ -321,11 +322,11 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
 
         $package
             ->expects($this->once())
@@ -337,7 +338,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -347,7 +348,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         $manager->download($package, 'target_dir');
     }
@@ -358,11 +359,11 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         $package
             ->expects($this->once())
@@ -374,7 +375,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -384,7 +385,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         $manager->download($package, 'target_dir');
     }
@@ -395,11 +396,11 @@ class DownloadManagerTest extends TestCase
         $package
           ->expects($this->once())
           ->method('getSourceType')
-          ->will($this->returnValue('git'));
+          ->willReturn('git');
         $package
           ->expects($this->once())
           ->method('getDistType')
-          ->will($this->returnValue(null));
+          ->willReturn(null);
 
         $package
           ->expects($this->once())
@@ -414,7 +415,7 @@ class DownloadManagerTest extends TestCase
           ->expects($this->once())
           ->method('getDownloaderForPackage')
           ->with($package)
-          ->will($this->returnValue(null)); // There is no downloader for Metapackages.
+          ->willReturn(null); // There is no downloader for Metapackages.
 
         $manager->download($package, 'target_dir');
     }
@@ -425,11 +426,11 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
 
         $package
             ->expects($this->once())
@@ -441,7 +442,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -451,7 +452,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         $manager->setPreferSource(true);
         $manager->download($package, 'target_dir');
@@ -463,11 +464,11 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
 
         $package
             ->expects($this->once())
@@ -479,7 +480,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -489,7 +490,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         $manager->setPreferSource(true);
         $manager->download($package, 'target_dir');
@@ -501,11 +502,11 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         $package
             ->expects($this->once())
@@ -517,7 +518,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -527,7 +528,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         $manager->setPreferSource(true);
         $manager->download($package, 'target_dir');
@@ -539,11 +540,11 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         $manager = new DownloadManager($this->io, false, $this->filesystem);
         $manager->setPreferSource(true);
@@ -558,32 +559,32 @@ class DownloadManagerTest extends TestCase
         $initial
             ->expects($this->once())
             ->method('getInstallationSource')
-            ->will($this->returnValue('dist'));
+            ->willReturn('dist');
         $initial
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('zip'));
+            ->willReturn('zip');
 
         $target = $this->createPackageMock();
         $target
             ->expects($this->once())
             ->method('getInstallationSource')
-            ->will($this->returnValue('dist'));
+            ->willReturn('dist');
         $target
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('zip'));
+            ->willReturn('zip');
 
         $zipDownloader = $this->createDownloaderMock();
         $zipDownloader
             ->expects($this->once())
             ->method('update')
             ->with($initial, $target, 'vendor/bundles/FOS/UserBundle')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
         $zipDownloader
             ->expects($this->any())
             ->method('getInstallationSource')
-            ->will($this->returnValue('dist'));
+            ->willReturn('dist');
 
         $manager = new DownloadManager($this->io, false, $this->filesystem);
         $manager->setDownloader('zip', $zipDownloader);
@@ -597,43 +598,43 @@ class DownloadManagerTest extends TestCase
         $initial
             ->expects($this->once())
             ->method('getInstallationSource')
-            ->will($this->returnValue('dist'));
+            ->willReturn('dist');
         $initial
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('xz'));
+            ->willReturn('xz');
 
         $target = $this->createPackageMock();
         $target
             ->expects($this->any())
             ->method('getInstallationSource')
-            ->will($this->returnValue('dist'));
+            ->willReturn('dist');
         $target
             ->expects($this->any())
             ->method('getDistType')
-            ->will($this->returnValue('zip'));
+            ->willReturn('zip');
 
         $xzDownloader = $this->createDownloaderMock();
         $xzDownloader
             ->expects($this->once())
             ->method('remove')
             ->with($initial, 'vendor/bundles/FOS/UserBundle')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
         $xzDownloader
             ->expects($this->any())
             ->method('getInstallationSource')
-            ->will($this->returnValue('dist'));
+            ->willReturn('dist');
 
         $zipDownloader = $this->createDownloaderMock();
         $zipDownloader
             ->expects($this->once())
             ->method('install')
             ->with($target, 'vendor/bundles/FOS/UserBundle')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
         $zipDownloader
             ->expects($this->any())
             ->method('getInstallationSource')
-            ->will($this->returnValue('dist'));
+            ->willReturn('dist');
 
         $manager = new DownloadManager($this->io, false, $this->filesystem);
         $manager->setDownloader('xz', $xzDownloader);
@@ -643,10 +644,10 @@ class DownloadManagerTest extends TestCase
     }
 
     /**
-     * @dataProvider updatesProvider
      * @param string[] $targetAvailable
      * @param string[] $expected
      */
+    #[DataProvider('updatesProvider')]
     public function testGetAvailableSourcesUpdateSticksToSameSource(?string $prevPkgSource, ?bool $prevPkgIsDev, array $targetAvailable, bool $targetIsDev, array $expected): void
     {
         $initial = null;
@@ -713,7 +714,7 @@ class DownloadManagerTest extends TestCase
           ->expects($this->exactly(2))
           ->method('getDownloaderForPackage')
           ->with($initial)
-          ->will($this->returnValue(null)); // There is no downloader for metapackages.
+          ->willReturn(null); // There is no downloader for metapackages.
 
         $manager->update($initial, $target, 'vendor/pkg');
     }
@@ -736,7 +737,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($pearDownloader));
+            ->willReturn($pearDownloader);
 
         $manager->remove($package, 'vendor/bundles/FOS/UserBundle');
     }
@@ -753,7 +754,7 @@ class DownloadManagerTest extends TestCase
           ->expects($this->once())
           ->method('getDownloaderForPackage')
           ->with($package)
-          ->will($this->returnValue(null)); // There is no downloader for metapackages.
+          ->willReturn(null); // There is no downloader for metapackages.
 
         $manager->remove($package, 'vendor/bundles/FOS/UserBundle');
     }
@@ -767,15 +768,15 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
         $package
             ->expects($this->once())
             ->method('isDev')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $package
             ->expects($this->once())
@@ -787,7 +788,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -797,7 +798,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         $manager->download($package, 'target_dir');
     }
@@ -811,15 +812,15 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
         $package
             ->expects($this->once())
             ->method('isDev')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $package
             ->expects($this->once())
@@ -831,7 +832,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -841,7 +842,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
 
         $manager->download($package, 'target_dir');
     }
@@ -855,19 +856,19 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
         $package
             ->expects($this->once())
             ->method('isDev')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $package
             ->expects($this->once())
             ->method('getName')
-            ->will($this->returnValue('bar/package'));
+            ->willReturn('bar/package');
         $package
             ->expects($this->once())
             ->method('setInstallationSource')
@@ -878,7 +879,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -888,7 +889,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
         $manager->setPreferences(['foo/*' => 'source']);
 
         $manager->download($package, 'target_dir');
@@ -903,19 +904,19 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
         $package
             ->expects($this->once())
             ->method('isDev')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
         $package
             ->expects($this->once())
             ->method('getName')
-            ->will($this->returnValue('bar/package'));
+            ->willReturn('bar/package');
         $package
             ->expects($this->once())
             ->method('setInstallationSource')
@@ -926,7 +927,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -936,7 +937,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
         $manager->setPreferences(['foo/*' => 'source']);
 
         $manager->download($package, 'target_dir');
@@ -951,19 +952,19 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
         $package
             ->expects($this->once())
             ->method('isDev')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $package
             ->expects($this->once())
             ->method('getName')
-            ->will($this->returnValue('foo/package'));
+            ->willReturn('foo/package');
         $package
             ->expects($this->once())
             ->method('setInstallationSource')
@@ -974,7 +975,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -984,7 +985,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
         $manager->setPreferences(['foo/*' => 'auto']);
 
         $manager->download($package, 'target_dir');
@@ -999,19 +1000,19 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
         $package
             ->expects($this->once())
             ->method('isDev')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
         $package
             ->expects($this->once())
             ->method('getName')
-            ->will($this->returnValue('foo/package'));
+            ->willReturn('foo/package');
         $package
             ->expects($this->once())
             ->method('setInstallationSource')
@@ -1022,7 +1023,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -1032,7 +1033,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
         $manager->setPreferences(['foo/*' => 'auto']);
 
         $manager->download($package, 'target_dir');
@@ -1047,15 +1048,15 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
         $package
             ->expects($this->once())
             ->method('getName')
-            ->will($this->returnValue('foo/package'));
+            ->willReturn('foo/package');
         $package
             ->expects($this->once())
             ->method('setInstallationSource')
@@ -1066,7 +1067,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -1076,7 +1077,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
         $manager->setPreferences(['foo/*' => 'source']);
 
         $manager->download($package, 'target_dir');
@@ -1091,15 +1092,15 @@ class DownloadManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getSourceType')
-            ->will($this->returnValue('git'));
+            ->willReturn('git');
         $package
             ->expects($this->once())
             ->method('getDistType')
-            ->will($this->returnValue('pear'));
+            ->willReturn('pear');
         $package
             ->expects($this->once())
             ->method('getName')
-            ->will($this->returnValue('foo/package'));
+            ->willReturn('foo/package');
         $package
             ->expects($this->once())
             ->method('setInstallationSource')
@@ -1110,7 +1111,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('download')
             ->with($package, 'target_dir')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')
             ->setConstructorArgs([$this->io, false, $this->filesystem])
@@ -1120,7 +1121,7 @@ class DownloadManagerTest extends TestCase
             ->expects($this->once())
             ->method('getDownloaderForPackage')
             ->with($package)
-            ->will($this->returnValue($downloader));
+            ->willReturn($downloader);
         $manager->setPreferences(['foo/*' => 'dist']);
 
         $manager->download($package, 'target_dir');
diff --git a/tests/Composer/Test/Downloader/FileDownloaderTest.php b/tests/Composer/Test/Downloader/FileDownloaderTest.php
index a03dd9f..560406d 100644
--- a/tests/Composer/Test/Downloader/FileDownloaderTest.php
+++ b/tests/Composer/Test/Downloader/FileDownloaderTest.php
@@ -47,7 +47,7 @@ class FileDownloaderTest extends TestCase
         $httpDownloader
             ->expects($this->any())
             ->method('addCopy')
-            ->will($this->returnValue(\React\Promise\resolve(new Response(['url' => 'http://example.org/'], 200, [], 'file~'))));
+            ->willReturn(\React\Promise\resolve(new Response(['url' => 'http://example.org/'], 200, [], 'file~')));
         $this->httpDownloader = $httpDownloader;
 
         return new FileDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $filesystem);
@@ -108,13 +108,13 @@ class FileDownloaderTest extends TestCase
         $ioMock = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
         $ioMock->expects($this->any())
             ->method('write')
-            ->will($this->returnCallback(static function ($messages, $newline = true) use ($path) {
+            ->willReturnCallback(static function ($messages, $newline = true) use ($path) {
                 if (is_file($path.'/script.js')) {
                     unlink($path.'/script.js');
                 }
 
                 return $messages;
-            }))
+            })
         ;
 
         $config = $this->getConfig(['vendor-dir' => $path.'/vendor']);
@@ -175,31 +175,31 @@ class FileDownloaderTest extends TestCase
         $cacheMock
             ->expects($this->any())
             ->method('copyTo')
-            ->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
+            ->willReturnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
                 self::assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyTo method:');
 
                 return false;
-            }));
+            });
         $cacheMock
             ->expects($this->any())
             ->method('copyFrom')
-            ->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
+            ->willReturnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
                 self::assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyFrom method:');
 
                 return false;
-            }));
+            });
 
         $httpDownloaderMock = $this->getMockBuilder('Composer\Util\HttpDownloader')->disableOriginalConstructor()->getMock();
         $httpDownloaderMock
             ->expects($this->any())
             ->method('addCopy')
-            ->will($this->returnCallback(function ($url) use ($expectedUrl) {
+            ->willReturnCallback(function ($url) use ($expectedUrl) {
                 self::assertEquals($expectedUrl, $url, 'Failed assertion on $url argument of HttpDownloader::addCopy method:');
 
                 return \React\Promise\resolve(
                     new Response(['url' => 'http://example.org/'], 200, [], 'file~')
                 );
-            }));
+            });
 
         $downloader = $this->getDownloader(null, $config, $dispatcher, $cacheMock, $httpDownloaderMock);
 
@@ -259,31 +259,31 @@ class FileDownloaderTest extends TestCase
         $cacheMock
             ->expects($this->any())
             ->method('copyTo')
-            ->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
+            ->willReturnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
                 self::assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyTo method:');
 
                 return false;
-            }));
+            });
         $cacheMock
             ->expects($this->any())
             ->method('copyFrom')
-            ->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
+            ->willReturnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
                 self::assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyFrom method:');
 
                 return false;
-            }));
+            });
 
         $httpDownloaderMock = $this->getMockBuilder('Composer\Util\HttpDownloader')->disableOriginalConstructor()->getMock();
         $httpDownloaderMock
             ->expects($this->any())
             ->method('addCopy')
-            ->will($this->returnCallback(function ($url) use ($expectedUrl) {
+            ->willReturnCallback(function ($url) use ($expectedUrl) {
                 self::assertEquals($expectedUrl, $url, 'Failed assertion on $url argument of HttpDownloader::addCopy method:');
 
                 return \React\Promise\resolve(
                     new Response(['url' => 'http://example.org/'], 200, [], 'file~')
                 );
-            }));
+            });
 
         $downloader = $this->getDownloader(null, $config, $dispatcher, $cacheMock, $httpDownloaderMock);
 
@@ -321,7 +321,7 @@ class FileDownloaderTest extends TestCase
         $cacheMock
             ->expects($this->any())
             ->method('gcIsNecessary')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $cacheMock
             ->expects($this->once())
             ->method('gc')
@@ -387,10 +387,10 @@ class FileDownloaderTest extends TestCase
         $filesystem = $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
         $filesystem->expects($this->once())
             ->method('removeDirectoryAsync')
-            ->will($this->returnValue(\React\Promise\resolve(true)));
+            ->willReturn(\React\Promise\resolve(true));
         $filesystem->expects($this->any())
             ->method('normalizePath')
-            ->will(self::returnArgument(0));
+            ->willReturnArgument(0);
 
         $downloader = $this->getDownloader($ioMock, $config, null, null, null, $filesystem);
 
diff --git a/tests/Composer/Test/Downloader/FossilDownloaderTest.php b/tests/Composer/Test/Downloader/FossilDownloaderTest.php
index 0f8103e..b2b0d96 100644
--- a/tests/Composer/Test/Downloader/FossilDownloaderTest.php
+++ b/tests/Composer/Test/Downloader/FossilDownloaderTest.php
@@ -56,7 +56,7 @@ class FossilDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->once())
             ->method('getSourceReference')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         self::expectException('InvalidArgumentException');
 
@@ -69,10 +69,10 @@ class FossilDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('trunk'));
+            ->willReturn('trunk');
         $packageMock->expects($this->once())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['http://fossil.kd2.org/kd2fw/']));
+            ->willReturn(['http://fossil.kd2.org/kd2fw/']);
 
         $process = $this->getProcessExecutorMock();
         $process->expects([
@@ -91,7 +91,7 @@ class FossilDownloaderTest extends TestCase
         $sourcePackageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $sourcePackageMock->expects($this->once())
             ->method('getSourceReference')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         self::expectException('InvalidArgumentException');
 
@@ -113,13 +113,13 @@ class FossilDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('trunk'));
+            ->willReturn('trunk');
         $packageMock->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['http://fossil.kd2.org/kd2fw/']));
+            ->willReturn(['http://fossil.kd2.org/kd2fw/']);
         $packageMock->expects($this->any())
             ->method('getVersion')
-            ->will($this->returnValue('1.0.0.0'));
+            ->willReturn('1.0.0.0');
 
         $process = $this->getProcessExecutorMock();
         $process->expects([
@@ -151,7 +151,7 @@ class FossilDownloaderTest extends TestCase
         $filesystem->expects($this->once())
             ->method('removeDirectoryAsync')
             ->with($this->equalTo($this->workingDir))
-            ->will($this->returnValue(\React\Promise\resolve(true)));
+            ->willReturn(\React\Promise\resolve(true));
 
         $downloader = $this->getDownloaderMock(null, null, $process, $filesystem);
         $downloader->prepare('uninstall', $packageMock, $this->workingDir);
diff --git a/tests/Composer/Test/Downloader/GitDownloaderTest.php b/tests/Composer/Test/Downloader/GitDownloaderTest.php
index a46054b..181433e 100644
--- a/tests/Composer/Test/Downloader/GitDownloaderTest.php
+++ b/tests/Composer/Test/Downloader/GitDownloaderTest.php
@@ -18,6 +18,7 @@ use Composer\Pcre\Preg;
 use Composer\Test\TestCase;
 use Composer\Util\Filesystem;
 use Composer\Util\Platform;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class GitDownloaderTest extends TestCase
 {
@@ -94,7 +95,7 @@ class GitDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->once())
             ->method('getSourceReference')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         self::expectException('InvalidArgumentException');
 
@@ -110,16 +111,16 @@ class GitDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('1234567890123456789012345678901234567890'));
+            ->willReturn('1234567890123456789012345678901234567890');
         $packageMock->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://example.com/composer/composer']));
+            ->willReturn(['https://example.com/composer/composer']);
         $packageMock->expects($this->any())
             ->method('getSourceUrl')
-            ->will($this->returnValue('https://example.com/composer/composer'));
+            ->willReturn('https://example.com/composer/composer');
         $packageMock->expects($this->any())
             ->method('getPrettyVersion')
-            ->will($this->returnValue('dev-master'));
+            ->willReturn('dev-master');
 
         $process = $this->getProcessExecutorMock();
         $expectedPath = Platform::isWindows() ? Platform::getCwd().'/composerPath' : 'composerPath';
@@ -146,16 +147,16 @@ class GitDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('1234567890123456789012345678901234567890'));
+            ->willReturn('1234567890123456789012345678901234567890');
         $packageMock->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://example.com/composer/composer']));
+            ->willReturn(['https://example.com/composer/composer']);
         $packageMock->expects($this->any())
             ->method('getSourceUrl')
-            ->will($this->returnValue('https://example.com/composer/composer'));
+            ->willReturn('https://example.com/composer/composer');
         $packageMock->expects($this->any())
             ->method('getPrettyVersion')
-            ->will($this->returnValue('dev-master'));
+            ->willReturn('dev-master');
 
         $this->initGitVersion('2.17.0');
 
@@ -199,16 +200,16 @@ class GitDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $packageMock->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://github.com/mirrors/composer', 'https://github.com/composer/composer']));
+            ->willReturn(['https://github.com/mirrors/composer', 'https://github.com/composer/composer']);
         $packageMock->expects($this->any())
             ->method('getSourceUrl')
-            ->will($this->returnValue('https://github.com/composer/composer'));
+            ->willReturn('https://github.com/composer/composer');
         $packageMock->expects($this->any())
             ->method('getPrettyVersion')
-            ->will($this->returnValue('1.0.0'));
+            ->willReturn('1.0.0');
 
         $process = $this->getProcessExecutorMock();
         $expectedPath = Platform::isWindows() ? Platform::getCwd().'/composerPath' : 'composerPath';
@@ -248,24 +249,24 @@ class GitDownloaderTest extends TestCase
     }
 
     /**
-     * @dataProvider pushUrlProvider
      * @param string[] $protocols
      */
+    #[DataProvider('pushUrlProvider')]
     public function testDownloadAndSetPushUrlUseCustomVariousProtocolsForGithub(array $protocols, string $url, string $pushUrl): void
     {
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $packageMock->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://github.com/composer/composer']));
+            ->willReturn(['https://github.com/composer/composer']);
         $packageMock->expects($this->any())
             ->method('getSourceUrl')
-            ->will($this->returnValue('https://github.com/composer/composer'));
+            ->willReturn('https://github.com/composer/composer');
         $packageMock->expects($this->any())
             ->method('getPrettyVersion')
-            ->will($this->returnValue('1.0.0'));
+            ->willReturn('1.0.0');
 
         $process = $this->getProcessExecutorMock();
         $expectedPath = Platform::isWindows() ? Platform::getCwd().'/composerPath' : 'composerPath';
@@ -297,16 +298,16 @@ class GitDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $packageMock->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://example.com/composer/composer']));
+            ->willReturn(['https://example.com/composer/composer']);
         $packageMock->expects($this->any())
             ->method('getSourceUrl')
-            ->will($this->returnValue('https://example.com/composer/composer'));
+            ->willReturn('https://example.com/composer/composer');
         $packageMock->expects($this->any())
             ->method('getPrettyVersion')
-            ->will($this->returnValue('1.0.0'));
+            ->willReturn('1.0.0');
 
         $process = $this->getProcessExecutorMock();
         $expectedPath = Platform::isWindows() ? Platform::getCwd().'/composerPath' : 'composerPath';
@@ -332,7 +333,7 @@ class GitDownloaderTest extends TestCase
         $sourcePackageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $sourcePackageMock->expects($this->once())
             ->method('getSourceReference')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         self::expectException('InvalidArgumentException');
 
@@ -348,16 +349,16 @@ class GitDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $packageMock->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://github.com/composer/composer']));
+            ->willReturn(['https://github.com/composer/composer']);
         $packageMock->expects($this->any())
             ->method('getVersion')
-            ->will($this->returnValue('1.0.0.0'));
+            ->willReturn('1.0.0.0');
         $packageMock->expects($this->any())
             ->method('getPrettyVersion')
-            ->will($this->returnValue('1.0.0'));
+            ->willReturn('1.0.0');
 
         $process = $this->getProcessExecutorMock();
         $process->expects([
@@ -393,19 +394,19 @@ class GitDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $packageMock->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://github.com/composer/composer']));
+            ->willReturn(['https://github.com/composer/composer']);
         $packageMock->expects($this->any())
             ->method('getSourceUrl')
-            ->will($this->returnValue('https://github.com/composer/composer'));
+            ->willReturn('https://github.com/composer/composer');
         $packageMock->expects($this->any())
             ->method('getVersion')
-            ->will($this->returnValue('1.0.0.0'));
+            ->willReturn('1.0.0.0');
         $packageMock->expects($this->any())
             ->method('getPrettyVersion')
-            ->will($this->returnValue('1.0.0'));
+            ->willReturn('1.0.0');
 
         $process = $this->getProcessExecutorMock();
         $process->expects([
@@ -447,13 +448,13 @@ composer https://github.com/old/url (push)
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $packageMock->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://github.com/composer/composer']));
+            ->willReturn(['https://github.com/composer/composer']);
         $packageMock->expects($this->any())
             ->method('getVersion')
-            ->will($this->returnValue('1.0.0.0'));
+            ->willReturn('1.0.0.0');
 
         $process = $this->getProcessExecutorMock();
         $process->expects([
@@ -492,16 +493,16 @@ composer https://github.com/old/url (push)
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $packageMock->expects($this->any())
             ->method('getVersion')
-            ->will($this->returnValue('1.0.0.0'));
+            ->willReturn('1.0.0.0');
         $packageMock->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue([Platform::isWindows() ? 'C:\\' : '/', 'https://github.com/composer/composer']));
+            ->willReturn([Platform::isWindows() ? 'C:\\' : '/', 'https://github.com/composer/composer']);
         $packageMock->expects($this->any())
             ->method('getPrettyVersion')
-            ->will($this->returnValue('1.0.0'));
+            ->willReturn('1.0.0');
 
         $process = $this->getProcessExecutorMock();
         $process->expects([
@@ -547,33 +548,33 @@ composer https://github.com/old/url (push)
         $oldPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $oldPackage->expects($this->any())
             ->method('getVersion')
-            ->will($this->returnValue('1.2.0.0'));
+            ->willReturn('1.2.0.0');
         $oldPackage->expects($this->any())
             ->method('getFullPrettyVersion')
-            ->will($this->returnValue('1.2.0'));
+            ->willReturn('1.2.0');
         $oldPackage->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $oldPackage->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['/foo/bar', 'https://github.com/composer/composer']));
+            ->willReturn(['/foo/bar', 'https://github.com/composer/composer']);
 
         $newPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $newPackage->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $newPackage->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://github.com/composer/composer']));
+            ->willReturn(['https://github.com/composer/composer']);
         $newPackage->expects($this->any())
             ->method('getVersion')
-            ->will($this->returnValue('1.0.0.0'));
+            ->willReturn('1.0.0.0');
         $newPackage->expects($this->any())
             ->method('getPrettyVersion')
-            ->will($this->returnValue('1.0.0'));
+            ->willReturn('1.0.0');
         $newPackage->expects($this->any())
             ->method('getFullPrettyVersion')
-            ->will($this->returnValue('1.0.0'));
+            ->willReturn('1.0.0');
 
         $process = $this->getProcessExecutorMock();
 
@@ -595,27 +596,27 @@ composer https://github.com/old/url (push)
         $oldPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $oldPackage->expects($this->any())
             ->method('getVersion')
-            ->will($this->returnValue('dev-ref'));
+            ->willReturn('dev-ref');
         $oldPackage->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $oldPackage->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['/foo/bar', 'https://github.com/composer/composer']));
+            ->willReturn(['/foo/bar', 'https://github.com/composer/composer']);
 
         $newPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $newPackage->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $newPackage->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://github.com/composer/composer']));
+            ->willReturn(['https://github.com/composer/composer']);
         $newPackage->expects($this->any())
             ->method('getVersion')
-            ->will($this->returnValue('dev-ref2'));
+            ->willReturn('dev-ref2');
         $newPackage->expects($this->any())
             ->method('getPrettyVersion')
-            ->will($this->returnValue('dev-ref2'));
+            ->willReturn('dev-ref2');
 
         $process = $this->getProcessExecutorMock();
 
@@ -647,7 +648,7 @@ composer https://github.com/old/url (push)
         $filesystem->expects($this->once())
             ->method('removeDirectoryAsync')
             ->with($this->equalTo($this->workingDir))
-            ->will($this->returnValue(\React\Promise\resolve(true)));
+            ->willReturn(\React\Promise\resolve(true));
 
         $downloader = $this->getDownloaderMock(null, null, $process, $filesystem);
         $downloader->prepare('uninstall', $packageMock, $this->workingDir);
diff --git a/tests/Composer/Test/Downloader/HgDownloaderTest.php b/tests/Composer/Test/Downloader/HgDownloaderTest.php
index 3788864..667aa3d 100644
--- a/tests/Composer/Test/Downloader/HgDownloaderTest.php
+++ b/tests/Composer/Test/Downloader/HgDownloaderTest.php
@@ -56,7 +56,7 @@ class HgDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->once())
             ->method('getSourceReference')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         self::expectException('InvalidArgumentException');
 
@@ -69,10 +69,10 @@ class HgDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $packageMock->expects($this->once())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://mercurial.dev/l3l0/composer']));
+            ->willReturn(['https://mercurial.dev/l3l0/composer']);
 
         $process = $this->getProcessExecutorMock();
         $process->expects([
@@ -90,7 +90,7 @@ class HgDownloaderTest extends TestCase
         $sourcePackageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $sourcePackageMock->expects($this->once())
             ->method('getSourceReference')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         self::expectException('InvalidArgumentException');
 
@@ -107,13 +107,13 @@ class HgDownloaderTest extends TestCase
         $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
         $packageMock->expects($this->any())
             ->method('getSourceReference')
-            ->will($this->returnValue('ref'));
+            ->willReturn('ref');
         $packageMock->expects($this->any())
             ->method('getVersion')
-            ->will($this->returnValue('1.0.0.0'));
+            ->willReturn('1.0.0.0');
         $packageMock->expects($this->any())
             ->method('getSourceUrls')
-            ->will($this->returnValue(['https://github.com/l3l0/composer']));
+            ->willReturn(['https://github.com/l3l0/composer']);
 
         $process = $this->getProcessExecutorMock();
         $process->expects([
@@ -143,7 +143,7 @@ class HgDownloaderTest extends TestCase
         $filesystem->expects($this->once())
             ->method('removeDirectoryAsync')
             ->with($this->equalTo($this->workingDir))
-            ->will($this->returnValue(\React\Promise\resolve(true)));
+            ->willReturn(\React\Promise\resolve(true));
 
         $downloader = $this->getDownloaderMock(null, null, $process, $filesystem);
         $downloader->prepare('uninstall', $packageMock, $this->workingDir);
diff --git a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php
index d0f7890..79d0307 100644
--- a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php
+++ b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php
@@ -18,6 +18,8 @@ use Composer\Repository\VcsRepository;
 use Composer\IO\IOInterface;
 use Composer\Test\TestCase;
 use Composer\Factory;
+use PHPUnit\Framework\Attributes\Depends;
+use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
 
 /**
  * @author Matt Whittom <Matt.Whittom@veteransunited.com>
@@ -72,7 +74,7 @@ class PerforceDownloaderTest extends TestCase
     protected function getMockPackageInterface(VcsRepository $repository)
     {
         $package = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
-        $package->expects($this->any())->method('getRepository')->will($this->returnValue($repository));
+        $package->expects($this->any())->method('getRepository')->willReturn($repository);
 
         return $package;
     }
@@ -95,14 +97,12 @@ class PerforceDownloaderTest extends TestCase
             ->onlyMethods(['getRepoConfig'])
             ->setConstructorArgs([$repoConfig, $io, $config, Factory::createHttpDownloader($io, $config)])
             ->getMock();
-        $repository->expects($this->any())->method('getRepoConfig')->will($this->returnValue($repoConfig));
+        $repository->expects($this->any())->method('getRepoConfig')->willReturn($repoConfig);
 
         return $repository;
     }
 
-    /**
-     * @doesNotPerformAssertions
-     */
+    #[DoesNotPerformAssertions]
     public function testInitPerforceInstantiatesANewPerforceObject(): void
     {
         $this->downloader->initPerforce($this->package, $this->testPath, 'SOURCE_REF');
@@ -116,16 +116,14 @@ class PerforceDownloaderTest extends TestCase
         $this->downloader->initPerforce($this->package, $this->testPath, 'SOURCE_REF');
     }
 
-    /**
-     * @depends testInitPerforceInstantiatesANewPerforceObject
-     * @depends testInitPerforceDoesNothingIfPerforceAlreadySet
-     */
+    #[Depends('testInitPerforceInstantiatesANewPerforceObject')]
+    #[Depends('testInitPerforceDoesNothingIfPerforceAlreadySet')]
     public function testDoInstallWithTag(): void
     {
         //I really don't like this test but the logic of each Perforce method is tested in the Perforce class.  Really I am just enforcing workflow.
         $ref = 'SOURCE_REF@123';
         $label = 123;
-        $this->package->expects($this->once())->method('getSourceReference')->will($this->returnValue($ref));
+        $this->package->expects($this->once())->method('getSourceReference')->willReturn($ref);
         $this->io->expects($this->once())->method('writeError')->with($this->stringContains('Cloning '.$ref));
         $perforceMethods = ['setStream', 'p4Login', 'writeP4ClientSpec', 'connectClient', 'syncCodeBase', 'cleanupClientSpec'];
         $perforce = $this->getMockBuilder('Composer\Util\Perforce')->disableOriginalConstructor()->getMock();
@@ -140,15 +138,13 @@ class PerforceDownloaderTest extends TestCase
         $this->downloader->doInstall($this->package, $this->testPath, 'url');
     }
 
-    /**
-     * @depends testInitPerforceInstantiatesANewPerforceObject
-     * @depends testInitPerforceDoesNothingIfPerforceAlreadySet
-     */
+    #[Depends('testInitPerforceInstantiatesANewPerforceObject')]
+    #[Depends('testInitPerforceDoesNothingIfPerforceAlreadySet')]
     public function testDoInstallWithNoTag(): void
     {
         $ref = 'SOURCE_REF';
         $label = null;
-        $this->package->expects($this->once())->method('getSourceReference')->will($this->returnValue($ref));
+        $this->package->expects($this->once())->method('getSourceReference')->willReturn($ref);
         $this->io->expects($this->once())->method('writeError')->with($this->stringContains('Cloning '.$ref));
         $perforceMethods = ['setStream', 'p4Login', 'writeP4ClientSpec', 'connectClient', 'syncCodeBase', 'cleanupClientSpec'];
         $perforce = $this->getMockBuilder('Composer\Util\Perforce')->disableOriginalConstructor()->getMock();
diff --git a/tests/Composer/Test/Downloader/ZipDownloaderTest.php b/tests/Composer/Test/Downloader/ZipDownloaderTest.php
index a8ca0ec..ba77d1d 100644
--- a/tests/Composer/Test/Downloader/ZipDownloaderTest.php
+++ b/tests/Composer/Test/Downloader/ZipDownloaderTest.php
@@ -80,19 +80,19 @@ class ZipDownloaderTest extends TestCase
         $this->config->expects($this->any())
             ->method('get')
             ->with('vendor-dir')
-            ->will($this->returnValue($this->testDir));
+            ->willReturn($this->testDir);
 
         $this->package->expects($this->any())
             ->method('getDistUrl')
-            ->will($this->returnValue($distUrl = 'file://'.__FILE__))
+            ->willReturn($distUrl = 'file://'.__FILE__)
         ;
         $this->package->expects($this->any())
             ->method('getDistUrls')
-            ->will($this->returnValue([$distUrl]))
+            ->willReturn([$distUrl])
         ;
         $this->package->expects($this->atLeastOnce())
             ->method('getTransportOptions')
-            ->will($this->returnValue([]))
+            ->willReturn([])
         ;
 
         $downloader = new ZipDownloader($this->io, $this->config, $this->httpDownloader);
@@ -122,10 +122,10 @@ class ZipDownloaderTest extends TestCase
         $zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
         $zipArchive->expects($this->once())
             ->method('open')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $zipArchive->expects($this->once())
             ->method('extractTo')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
         $promise = $downloader->extract($this->package, $this->filename, 'vendor/dir');
@@ -145,7 +145,7 @@ class ZipDownloaderTest extends TestCase
         $zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
         $zipArchive->expects($this->once())
             ->method('open')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $zipArchive->expects($this->once())
             ->method('extractTo')
             ->will($this->throwException(new \ErrorException('Not a directory')));
@@ -166,13 +166,13 @@ class ZipDownloaderTest extends TestCase
         $zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
         $zipArchive->expects($this->once())
             ->method('open')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $zipArchive->expects($this->once())
             ->method('extractTo')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $zipArchive->expects($this->once())
             ->method('count')
-            ->will($this->returnValue(0));
+            ->willReturn(0);
 
         $this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
         $promise = $downloader->extract($this->package, $this->filename, 'vendor/dir');
@@ -190,18 +190,18 @@ class ZipDownloaderTest extends TestCase
         $procMock = $this->getMockBuilder('Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock();
         $procMock->expects($this->any())
             ->method('getExitCode')
-            ->will($this->returnValue(1));
+            ->willReturn(1);
         $procMock->expects($this->any())
             ->method('isSuccessful')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
         $procMock->expects($this->any())
             ->method('getErrorOutput')
-            ->will($this->returnValue('output'));
+            ->willReturn('output');
 
         $processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
         $processExecutor->expects($this->once())
             ->method('executeAsync')
-            ->will($this->returnValue(\React\Promise\resolve($procMock)));
+            ->willReturn(\React\Promise\resolve($procMock));
 
         $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
         $promise = $downloader->extract($this->package, $this->filename, 'vendor/dir');
@@ -217,18 +217,18 @@ class ZipDownloaderTest extends TestCase
         $procMock = $this->getMockBuilder('Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock();
         $procMock->expects($this->any())
             ->method('getExitCode')
-            ->will($this->returnValue(0));
+            ->willReturn(0);
         $procMock->expects($this->any())
             ->method('isSuccessful')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $procMock->expects($this->any())
             ->method('getErrorOutput')
-            ->will($this->returnValue('output'));
+            ->willReturn('output');
 
         $processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
         $processExecutor->expects($this->once())
             ->method('executeAsync')
-            ->will($this->returnValue(\React\Promise\resolve($procMock)));
+            ->willReturn(\React\Promise\resolve($procMock));
 
         $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
         $promise = $downloader->extract($this->package, $this->filename, 'vendor/dir');
@@ -247,29 +247,29 @@ class ZipDownloaderTest extends TestCase
         $procMock = $this->getMockBuilder('Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock();
         $procMock->expects($this->any())
             ->method('getExitCode')
-            ->will($this->returnValue(1));
+            ->willReturn(1);
         $procMock->expects($this->any())
             ->method('isSuccessful')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
         $procMock->expects($this->any())
             ->method('getErrorOutput')
-            ->will($this->returnValue('output'));
+            ->willReturn('output');
 
         $processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
         $processExecutor->expects($this->once())
             ->method('executeAsync')
-            ->will($this->returnValue(\React\Promise\resolve($procMock)));
+            ->willReturn(\React\Promise\resolve($procMock));
 
         $zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
         $zipArchive->expects($this->once())
             ->method('open')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $zipArchive->expects($this->once())
             ->method('extractTo')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $zipArchive->expects($this->once())
             ->method('count')
-            ->will($this->returnValue(0));
+            ->willReturn(0);
 
         $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
         $this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
@@ -291,26 +291,26 @@ class ZipDownloaderTest extends TestCase
         $procMock = $this->getMockBuilder('Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock();
         $procMock->expects($this->any())
             ->method('getExitCode')
-            ->will($this->returnValue(1));
+            ->willReturn(1);
         $procMock->expects($this->any())
             ->method('isSuccessful')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
         $procMock->expects($this->any())
             ->method('getErrorOutput')
-            ->will($this->returnValue('output'));
+            ->willReturn('output');
 
         $processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
         $processExecutor->expects($this->once())
           ->method('executeAsync')
-          ->will($this->returnValue(\React\Promise\resolve($procMock)));
+          ->willReturn(\React\Promise\resolve($procMock));
 
         $zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
         $zipArchive->expects($this->once())
           ->method('open')
-          ->will($this->returnValue(true));
+          ->willReturn(true);
         $zipArchive->expects($this->once())
           ->method('extractTo')
-          ->will($this->returnValue(false));
+          ->willReturn(false);
 
         $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
         $this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
diff --git a/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php b/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php
index b8f4fb8..7b6cae0 100644
--- a/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php
+++ b/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php
@@ -25,6 +25,7 @@ use Composer\Script\ScriptEvents;
 use Composer\Script\Event as ScriptEvent;
 use Composer\Util\ProcessExecutor;
 use Composer\Util\Platform;
+use PHPUnit\Framework\Attributes\DataProvider;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class EventDispatcherTest extends TestCase
@@ -52,9 +53,7 @@ class EventDispatcherTest extends TestCase
         $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false);
     }
 
-    /**
-     * @dataProvider provideValidCommands
-     */
+    #[DataProvider('provideValidCommands')]
     public function testDispatcherCanExecuteSingleCommandLineScript(string $command): void
     {
         $process = $this->getProcessExecutorMock();
@@ -74,14 +73,12 @@ class EventDispatcherTest extends TestCase
         $listener = [$command];
         $dispatcher->expects($this->atLeastOnce())
             ->method('getListeners')
-            ->will($this->returnValue($listener));
+            ->willReturn($listener);
 
         $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false);
     }
 
-    /**
-     * @dataProvider provideDevModes
-     */
+    #[DataProvider('provideDevModes')]
     public function testDispatcherPassDevModeToAutoloadGeneratorForScriptEvents(bool $devMode): void
     {
         $composer = $this->createComposerInstance();
@@ -94,7 +91,7 @@ class EventDispatcherTest extends TestCase
         $composer->setAutoloadGenerator($generator);
 
         $package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock();
-        $package->method('getScripts')->will($this->returnValue(['scriptName' => ['scriptName']]));
+        $package->method('getScripts')->willReturn(['scriptName' => ['scriptName']]);
         $composer->setPackage($package);
 
         $composer->setRepositoryManager($this->getRepositoryManagerMockForDevModePassingTest());
@@ -109,10 +106,10 @@ class EventDispatcherTest extends TestCase
         $event = $this->getMockBuilder('Composer\Script\Event')
             ->disableOriginalConstructor()
             ->getMock();
-        $event->method('getName')->will($this->returnValue('scriptName'));
+        $event->method('getName')->willReturn('scriptName');
         $event->expects($this->atLeastOnce())
             ->method('isDevMode')
-            ->will($this->returnValue($devMode));
+            ->willReturn($devMode);
 
         $dispatcher->hasEventListeners($event);
     }
@@ -141,13 +138,13 @@ class EventDispatcherTest extends TestCase
             ->getMock();
         $generator
             ->method('buildPackageMap')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
         $generator
             ->method('parseAutoloads')
-            ->will($this->returnValue(['psr-0' => [], 'psr-4' => [], 'classmap' => [], 'files' => [], 'exclude-from-classmap' => []]));
+            ->willReturn(['psr-0' => [], 'psr-4' => [], 'classmap' => [], 'files' => [], 'exclude-from-classmap' => []]);
         $generator
             ->method('createLoader')
-            ->will($this->returnValue($this->getMockBuilder('Composer\Autoload\ClassLoader')->getMock()));
+            ->willReturn($this->getMockBuilder('Composer\Autoload\ClassLoader')->getMock());
 
         return $generator;
     }
@@ -165,11 +162,11 @@ class EventDispatcherTest extends TestCase
         $repo = $this->getMockBuilder('Composer\Repository\InstalledRepositoryInterface')->getMock();
         $repo
             ->method('getCanonicalPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $rm
             ->method('getLocalRepository')
-            ->will($this->returnValue($repo));
+            ->willReturn($repo);
 
         return $rm;
     }
@@ -244,7 +241,7 @@ class EventDispatcherTest extends TestCase
 
         $dispatcher->expects($this->atLeastOnce())
             ->method('getListeners')
-            ->will($this->returnValue($listeners));
+            ->willReturn($listeners);
 
         $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false);
 
@@ -274,7 +271,7 @@ class EventDispatcherTest extends TestCase
 
         $dispatcher->expects($this->atLeastOnce())
             ->method('getListeners')
-            ->will($this->returnValue($listeners));
+            ->willReturn($listeners);
 
         $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false);
 
@@ -303,7 +300,7 @@ class EventDispatcherTest extends TestCase
             'Composer\\Test\\EventDispatcher\\EventDispatcherTest::createsVendorBinFolderChecksEnvContainsBin',
         ];
 
-        $dispatcher->expects($this->atLeastOnce())->method('getListeners')->will($this->returnValue($listeners));
+        $dispatcher->expects($this->atLeastOnce())->method('getListeners')->willReturn($listeners);
 
         $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false);
         rmdir(__DIR__ . '/vendor/bin');
@@ -352,7 +349,7 @@ class EventDispatcherTest extends TestCase
 
         $dispatcher->expects($this->atLeastOnce())
             ->method('getListeners')
-            ->will($this->returnValue($listeners));
+            ->willReturn($listeners);
 
         $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false, ['ARG', 'ARG2', '--arg']);
 
@@ -415,7 +412,7 @@ class EventDispatcherTest extends TestCase
 
         $dispatcher->expects($this->atLeastOnce())
             ->method('getListeners')
-            ->will($this->returnCallback(static function (Event $event): array {
+            ->willReturnCallback(static function (Event $event): array {
                 if ($event->getName() === 'root') {
                     return ['@group'];
                 }
@@ -429,7 +426,7 @@ class EventDispatcherTest extends TestCase
                 }
 
                 return [];
-            }));
+            });
 
         $dispatcher->dispatch('root', new ScriptEvent('root', $composer, $io));
         $expected = '> root: @group'.PHP_EOL.
@@ -460,7 +457,7 @@ class EventDispatcherTest extends TestCase
 
         $dispatcher->expects($this->atLeastOnce())
             ->method('getListeners')
-            ->will($this->returnCallback(static function (Event $event): array {
+            ->willReturnCallback(static function (Event $event): array {
                 if ($event->getName() === 'hello') {
                     return ['echo Hello'];
                 }
@@ -470,7 +467,7 @@ class EventDispatcherTest extends TestCase
                 }
 
                 return [];
-            }));
+            });
 
         $dispatcher->dispatch('helloWorld', new ScriptEvent('helloWorld', $composer, $io));
         $expected = "> helloWorld: @hello World".PHP_EOL.
@@ -496,7 +493,7 @@ class EventDispatcherTest extends TestCase
 
         $dispatcher->expects($this->atLeastOnce())
             ->method('getListeners')
-            ->will($this->returnCallback(static function (Event $event): array {
+            ->willReturnCallback(static function (Event $event): array {
                 if ($event->getName() === 'root') {
                     return ['@recurse'];
                 }
@@ -506,7 +503,7 @@ class EventDispatcherTest extends TestCase
                 }
 
                 return [];
-            }));
+            });
 
         $dispatcher->dispatch('root', new ScriptEvent('root', $composer, $io));
     }
@@ -528,7 +525,7 @@ class EventDispatcherTest extends TestCase
 
         $dispatcher->expects($this->atLeastOnce())
             ->method('getListeners')
-            ->will($this->returnValue($listeners));
+            ->willReturn($listeners);
 
         return $dispatcher;
     }
@@ -556,7 +553,7 @@ class EventDispatcherTest extends TestCase
         $listener = ['echo foo'];
         $dispatcher->expects($this->atLeastOnce())
             ->method('getListeners')
-            ->will($this->returnValue($listener));
+            ->willReturn($listener);
 
         $io->expects($this->once())
             ->method('writeError')
@@ -584,7 +581,7 @@ class EventDispatcherTest extends TestCase
         $listener = [$code];
         $dispatcher->expects($this->atLeastOnce())
             ->method('getListeners')
-            ->will($this->returnValue($listener));
+            ->willReturn($listener);
 
         $io->expects([
             ['text' => '> exit 1'],
@@ -609,7 +606,7 @@ class EventDispatcherTest extends TestCase
 
         $dispatcher->expects($this->atLeastOnce())
             ->method('getListeners')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $transaction = $this->getMockBuilder('Composer\DependencyResolver\LockTransaction')->disableOriginalConstructor()->getMock();
 
@@ -622,7 +619,7 @@ class EventDispatcherTest extends TestCase
         $composer = $this->createComposerInstance();
 
         $package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock();
-        $package->method('getScripts')->will($this->returnValue(['scriptName' => ['scriptName']]));
+        $package->method('getScripts')->willReturn(['scriptName' => ['scriptName']]);
         $composer->setPackage($package);
 
         $dispatcher = new EventDispatcher(
@@ -634,7 +631,7 @@ class EventDispatcherTest extends TestCase
         $event = $this->getMockBuilder('Composer\Script\Event')
             ->disableOriginalConstructor()
             ->getMock();
-        $event->method('getName')->will($this->returnValue('scriptName'));
+        $event->method('getName')->willReturn('scriptName');
 
         $this->assertFalse($dispatcher->hasEventListeners($event));
     }
diff --git a/tests/Composer/Test/FactoryTest.php b/tests/Composer/Test/FactoryTest.php
index a4b5e6d..95dc6f3 100644
--- a/tests/Composer/Test/FactoryTest.php
+++ b/tests/Composer/Test/FactoryTest.php
@@ -40,7 +40,7 @@ class FactoryTest extends TestCase
 
         $config->method('get')
             ->with($this->equalTo('disable-tls'))
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         Factory::createHttpDownloader($ioMock, $config);
     }
diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php
index 67d2127..57ba940 100644
--- a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php
+++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php
@@ -14,12 +14,11 @@ namespace Composer\Test\Filter\PlatformRequirementFilter;
 
 use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 final class IgnoreAllPlatformRequirementFilterTest extends TestCase
 {
-    /**
-     * @dataProvider dataIsIgnored
-     */
+    #[DataProvider('dataIsIgnored')]
     public function testIsIgnored(string $req, bool $expectIgnored): void
     {
         $platformRequirementFilter = new IgnoreAllPlatformRequirementFilter();
diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php
index 30ff79b..3bcfd51 100644
--- a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php
+++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php
@@ -14,14 +14,14 @@ namespace Composer\Test\Filter\PlatformRequirementFilter;
 
 use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 final class IgnoreListPlatformRequirementFilterTest extends TestCase
 {
     /**
-     * @dataProvider dataIsIgnored
-     *
      * @param string[] $reqList
      */
+    #[DataProvider('dataIsIgnored')]
     public function testIsIgnored(array $reqList, string $req, bool $expectIgnored): void
     {
         $platformRequirementFilter = new IgnoreListPlatformRequirementFilter($reqList);
@@ -50,10 +50,9 @@ final class IgnoreListPlatformRequirementFilterTest extends TestCase
     }
 
     /**
-     * @dataProvider dataIsUpperBoundIgnored
-     *
      * @param string[] $reqList
      */
+    #[DataProvider('dataIsUpperBoundIgnored')]
     public function testIsUpperBoundIgnored(array $reqList, string $req, bool $expectIgnored): void
     {
         $platformRequirementFilter = new IgnoreListPlatformRequirementFilter($reqList);
diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php
index 512e747..c07941f 100644
--- a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php
+++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php
@@ -14,12 +14,11 @@ namespace Composer\Test\Filter\PlatformRequirementFilter;
 
 use Composer\Filter\PlatformRequirementFilter\IgnoreNothingPlatformRequirementFilter;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 final class IgnoreNothingPlatformRequirementFilterTest extends TestCase
 {
-    /**
-     * @dataProvider dataIsIgnored
-     */
+    #[DataProvider('dataIsIgnored')]
     public function testIsIgnored(string $req): void
     {
         $platformRequirementFilter = new IgnoreNothingPlatformRequirementFilter();
diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php
index b8c1c79..07cbcf2 100644
--- a/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php
+++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php
@@ -14,15 +14,15 @@ namespace Composer\Test\Filter\PlatformRequirementFilter;
 
 use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 final class PlatformRequirementFilterFactoryTest extends TestCase
 {
     /**
-     * @dataProvider dataFromBoolOrList
-     *
      * @param mixed $boolOrList
      * @param class-string $expectedInstance
      */
+    #[DataProvider('dataFromBoolOrList')]
     public function testFromBoolOrList($boolOrList, $expectedInstance): void
     {
         self::assertInstanceOf($expectedInstance, PlatformRequirementFilterFactory::fromBoolOrList($boolOrList));
diff --git a/tests/Composer/Test/IO/ConsoleIOTest.php b/tests/Composer/Test/IO/ConsoleIOTest.php
index 26f04e3..8e0a829 100644
--- a/tests/Composer/Test/IO/ConsoleIOTest.php
+++ b/tests/Composer/Test/IO/ConsoleIOTest.php
@@ -160,7 +160,7 @@ class ConsoleIOTest extends TestCase
             ->expects($this->once())
             ->method('get')
             ->with($this->equalTo('question'))
-            ->will($this->returnValue($helperMock))
+            ->willReturn($helperMock)
         ;
 
         $consoleIO = new ConsoleIO($inputMock, $outputMock, $setMock);
@@ -188,7 +188,7 @@ class ConsoleIOTest extends TestCase
             ->expects($this->once())
             ->method('get')
             ->with($this->equalTo('question'))
-            ->will($this->returnValue($helperMock))
+            ->willReturn($helperMock)
         ;
 
         $consoleIO = new ConsoleIO($inputMock, $outputMock, $setMock);
@@ -216,7 +216,7 @@ class ConsoleIOTest extends TestCase
             ->expects($this->once())
             ->method('get')
             ->with($this->equalTo('question'))
-            ->will($this->returnValue($helperMock))
+            ->willReturn($helperMock)
         ;
 
         $validator = static function ($value): bool {
@@ -241,13 +241,13 @@ class ConsoleIOTest extends TestCase
                 $this->isInstanceOf('Symfony\Component\Console\Output\OutputInterface'),
                 $this->isInstanceOf('Symfony\Component\Console\Question\Question')
             )
-            ->will($this->returnValue(['item2']));
+            ->willReturn(['item2']);
 
         $setMock
             ->expects($this->once())
             ->method('get')
             ->with($this->equalTo('question'))
-            ->will($this->returnValue($helperMock))
+            ->willReturn($helperMock)
         ;
 
         $consoleIO = new ConsoleIO($inputMock, $outputMock, $setMock);
diff --git a/tests/Composer/Test/InstalledVersionsTest.php b/tests/Composer/Test/InstalledVersionsTest.php
index fdcf28f..b56aff9 100644
--- a/tests/Composer/Test/InstalledVersionsTest.php
+++ b/tests/Composer/Test/InstalledVersionsTest.php
@@ -15,6 +15,7 @@ namespace Composer\Test;
 use Composer\Autoload\ClassLoader;
 use Composer\InstalledVersions;
 use Composer\Semver\VersionParser;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class InstalledVersionsTest extends TestCase
 {
@@ -68,9 +69,7 @@ class InstalledVersionsTest extends TestCase
         self::assertSame($names, InstalledVersions::getInstalledPackages());
     }
 
-    /**
-     * @dataProvider isInstalledProvider
-     */
+    #[DataProvider('isInstalledProvider')]
     public function testIsInstalled(bool $expected, string $name, bool $includeDevRequirements = true): void
     {
         self::assertSame($expected, InstalledVersions::isInstalled($name, $includeDevRequirements));
@@ -90,9 +89,7 @@ class InstalledVersionsTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider satisfiesProvider
-     */
+    #[DataProvider('satisfiesProvider')]
     public function testSatisfies(bool $expected, string $name, string $constraint): void
     {
         self::assertSame($expected, InstalledVersions::satisfies(new VersionParser, $name, $constraint));
@@ -128,9 +125,7 @@ class InstalledVersionsTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider getVersionRangesProvider
-     */
+    #[DataProvider('getVersionRangesProvider')]
     public function testGetVersionRanges(string $expected, string $name): void
     {
         self::assertSame($expected, InstalledVersions::getVersionRanges($name));
@@ -150,9 +145,7 @@ class InstalledVersionsTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider getVersionProvider
-     */
+    #[DataProvider('getVersionProvider')]
     public function testGetVersion(?string $expected, string $name): void
     {
         self::assertSame($expected, InstalledVersions::getVersion($name));
@@ -172,9 +165,7 @@ class InstalledVersionsTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider getPrettyVersionProvider
-     */
+    #[DataProvider('getPrettyVersionProvider')]
     public function testGetPrettyVersion(?string $expected, string $name): void
     {
         self::assertSame($expected, InstalledVersions::getPrettyVersion($name));
@@ -225,9 +216,7 @@ class InstalledVersionsTest extends TestCase
         self::assertSame(require __DIR__.'/Repository/Fixtures/installed_relative.php', InstalledVersions::getRawData());
     }
 
-    /**
-     * @dataProvider getReferenceProvider
-     */
+    #[DataProvider('getReferenceProvider')]
     public function testGetReference(?string $expected, string $name): void
     {
         self::assertSame($expected, InstalledVersions::getReference($name));
diff --git a/tests/Composer/Test/Installer/BinaryInstallerTest.php b/tests/Composer/Test/Installer/BinaryInstallerTest.php
index e613ca7..981eb5f 100644
--- a/tests/Composer/Test/Installer/BinaryInstallerTest.php
+++ b/tests/Composer/Test/Installer/BinaryInstallerTest.php
@@ -16,6 +16,7 @@ use Composer\Installer\BinaryInstaller;
 use Composer\Util\Filesystem;
 use Composer\Test\TestCase;
 use Composer\Util\ProcessExecutor;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class BinaryInstallerTest extends TestCase
 {
@@ -64,9 +65,7 @@ class BinaryInstallerTest extends TestCase
         $this->fs->removeDirectory($this->rootDir);
     }
 
-    /**
-     * @dataProvider executableBinaryProvider
-     */
+    #[DataProvider('executableBinaryProvider')]
     public function testInstallAndExecBinaryWithFullCompat(string $contents): void
     {
         $package = $this->createPackageMock();
diff --git a/tests/Composer/Test/Installer/InstallationManagerTest.php b/tests/Composer/Test/Installer/InstallationManagerTest.php
index f253176..6106bef 100644
--- a/tests/Composer/Test/Installer/InstallationManagerTest.php
+++ b/tests/Composer/Test/Installer/InstallationManagerTest.php
@@ -50,9 +50,9 @@ class InstallationManagerTest extends TestCase
         $installer
             ->expects($this->exactly(2))
             ->method('supports')
-            ->will($this->returnCallback(static function ($arg): bool {
+            ->willReturnCallback(static function ($arg): bool {
                 return $arg === 'vendor';
-            }));
+            });
 
         $manager = new InstallationManager($this->loop, $this->io);
 
@@ -70,18 +70,18 @@ class InstallationManagerTest extends TestCase
         $installer
             ->expects($this->exactly(2))
             ->method('supports')
-            ->will($this->returnCallback(static function ($arg): bool {
+            ->willReturnCallback(static function ($arg): bool {
                 return $arg === 'vendor';
-            }));
+            });
 
         $installer2 = $this->createInstallerMock();
 
         $installer2
             ->expects($this->exactly(1))
             ->method('supports')
-            ->will($this->returnCallback(static function ($arg): bool {
+            ->willReturnCallback(static function ($arg): bool {
                 return $arg === 'vendor';
-            }));
+            });
 
         $manager = new InstallationManager($this->loop, $this->io);
 
@@ -109,7 +109,7 @@ class InstallationManagerTest extends TestCase
 
         $package->expects($this->any())
             ->method('getType')
-            ->will($this->returnValue('library'));
+            ->willReturn('library');
 
         $manager
             ->expects($this->once())
@@ -140,13 +140,13 @@ class InstallationManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getType')
-            ->will($this->returnValue('library'));
+            ->willReturn('library');
 
         $installer
             ->expects($this->once())
             ->method('supports')
             ->with('library')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $installer
             ->expects($this->once())
@@ -169,17 +169,17 @@ class InstallationManagerTest extends TestCase
         $initial
             ->expects($this->once())
             ->method('getType')
-            ->will($this->returnValue('library'));
+            ->willReturn('library');
         $target
             ->expects($this->once())
             ->method('getType')
-            ->will($this->returnValue('library'));
+            ->willReturn('library');
 
         $installer
             ->expects($this->once())
             ->method('supports')
             ->with('library')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $installer
             ->expects($this->once())
@@ -201,26 +201,26 @@ class InstallationManagerTest extends TestCase
         $initial
             ->expects($this->once())
             ->method('getType')
-            ->will($this->returnValue('library'));
+            ->willReturn('library');
 
         $target = $this->createPackageMock();
         $target
             ->expects($this->once())
             ->method('getType')
-            ->will($this->returnValue('bundles'));
+            ->willReturn('bundles');
 
         $bundleInstaller
             ->expects($this->exactly(2))
             ->method('supports')
-            ->will($this->returnCallback(static function ($arg): bool {
+            ->willReturnCallback(static function ($arg): bool {
                 return $arg === 'bundles';
-            }));
+            });
 
         $libInstaller
             ->expects($this->once())
             ->method('supports')
             ->with('library')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $libInstaller
             ->expects($this->once())
@@ -248,7 +248,7 @@ class InstallationManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getType')
-            ->will($this->returnValue('library'));
+            ->willReturn('library');
 
         $installer
             ->expects($this->once())
@@ -259,7 +259,7 @@ class InstallationManagerTest extends TestCase
             ->expects($this->once())
             ->method('supports')
             ->with('library')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $manager->uninstall($this->repository, $operation);
     }
@@ -277,13 +277,13 @@ class InstallationManagerTest extends TestCase
         $package
             ->expects($this->once())
             ->method('getType')
-            ->will($this->returnValue('library'));
+            ->willReturn('library');
 
         $installer
             ->expects($this->once())
             ->method('supports')
             ->with('library')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $installer
             ->expects($this->once())
diff --git a/tests/Composer/Test/Installer/LibraryInstallerTest.php b/tests/Composer/Test/Installer/LibraryInstallerTest.php
index aa63eb2..2f4d6e4 100644
--- a/tests/Composer/Test/Installer/LibraryInstallerTest.php
+++ b/tests/Composer/Test/Installer/LibraryInstallerTest.php
@@ -18,6 +18,7 @@ use Composer\Util\Filesystem;
 use Composer\Test\TestCase;
 use Composer\Composer;
 use Composer\Config;
+use PHPUnit\Framework\Attributes\Depends;
 
 class LibraryInstallerTest extends TestCase
 {
@@ -139,10 +140,8 @@ class LibraryInstallerTest extends TestCase
         self::assertFalse($library->isInstalled($repository, $package));
     }
 
-    /**
-     * @depends testInstallerCreationShouldNotCreateVendorDirectory
-     * @depends testInstallerCreationShouldNotCreateBinDirectory
-     */
+    #[Depends('testInstallerCreationShouldNotCreateVendorDirectory')]
+    #[Depends('testInstallerCreationShouldNotCreateBinDirectory')]
     public function testInstall(): void
     {
         $library = new LibraryInstaller($this->io, $this->composer);
@@ -152,7 +151,7 @@ class LibraryInstallerTest extends TestCase
             ->expects($this->once())
             ->method('install')
             ->with($package, $this->vendorDir.'/some/package')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $this->repository
             ->expects($this->once())
@@ -164,10 +163,8 @@ class LibraryInstallerTest extends TestCase
         self::assertFileExists($this->binDir, 'Bin dir should be created');
     }
 
-    /**
-     * @depends testInstallerCreationShouldNotCreateVendorDirectory
-     * @depends testInstallerCreationShouldNotCreateBinDirectory
-     */
+    #[Depends('testInstallerCreationShouldNotCreateVendorDirectory')]
+    #[Depends('testInstallerCreationShouldNotCreateBinDirectory')]
     public function testUpdate(): void
     {
         $filesystem = $this->getMockBuilder('Composer\Util\Filesystem')
@@ -186,13 +183,13 @@ class LibraryInstallerTest extends TestCase
         $this->repository
             ->expects($this->exactly(3))
             ->method('hasPackage')
-            ->will($this->onConsecutiveCalls(true, false, false));
+            ->willReturn(true, false, false);
 
         $this->dm
             ->expects($this->once())
             ->method('update')
             ->with($initial, $target, $this->vendorDir.'/vendor/package1/newtarget')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $this->repository
             ->expects($this->once())
@@ -223,13 +220,13 @@ class LibraryInstallerTest extends TestCase
             ->expects($this->exactly(2))
             ->method('hasPackage')
             ->with($package)
-            ->will($this->onConsecutiveCalls(true, false));
+            ->willReturn(true, false);
 
         $this->dm
             ->expects($this->once())
             ->method('remove')
             ->with($package, $this->vendorDir.'/vendor/pkg')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $this->repository
             ->expects($this->once())
@@ -260,10 +257,8 @@ class LibraryInstallerTest extends TestCase
         self::assertEquals($this->vendorDir.'/'.$package->getPrettyName().'/Some/Namespace', $library->getInstallPath($package));
     }
 
-    /**
-     * @depends testInstallerCreationShouldNotCreateVendorDirectory
-     * @depends testInstallerCreationShouldNotCreateBinDirectory
-     */
+    #[Depends('testInstallerCreationShouldNotCreateVendorDirectory')]
+    #[Depends('testInstallerCreationShouldNotCreateBinDirectory')]
     public function testEnsureBinariesInstalled(): void
     {
         $binaryInstallerMock = $this->getMockBuilder('Composer\Installer\BinaryInstaller')
diff --git a/tests/Composer/Test/Installer/MetapackageInstallerTest.php b/tests/Composer/Test/Installer/MetapackageInstallerTest.php
index 6f083dd..eab75e1 100644
--- a/tests/Composer/Test/Installer/MetapackageInstallerTest.php
+++ b/tests/Composer/Test/Installer/MetapackageInstallerTest.php
@@ -56,17 +56,17 @@ class MetapackageInstallerTest extends TestCase
         $initial = $this->createPackageMock();
         $initial->expects($this->once())
             ->method('getVersion')
-            ->will($this->returnValue('1.0.0'));
+            ->willReturn('1.0.0');
         $target = $this->createPackageMock();
         $target->expects($this->once())
             ->method('getVersion')
-            ->will($this->returnValue('1.0.1'));
+            ->willReturn('1.0.1');
 
         $this->repository
             ->expects($this->exactly(2))
             ->method('hasPackage')
             ->with($initial)
-            ->will($this->onConsecutiveCalls(true, false));
+            ->willReturn(true, false);
 
         $this->repository
             ->expects($this->once())
@@ -93,7 +93,7 @@ class MetapackageInstallerTest extends TestCase
             ->expects($this->exactly(2))
             ->method('hasPackage')
             ->with($package)
-            ->will($this->onConsecutiveCalls(true, false));
+            ->willReturn(true, false);
 
         $this->repository
             ->expects($this->once())
diff --git a/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php b/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php
index d2d5df9..018b146 100644
--- a/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php
+++ b/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php
@@ -113,13 +113,13 @@ class SuggestedPackagesReporterTest extends TestCase
         $package = $this->createPackageMock();
         $package->expects($this->once())
             ->method('getSuggests')
-            ->will($this->returnValue([
+            ->willReturn([
                 'target-a' => 'reason-a',
                 'target-b' => 'reason-b',
-            ]));
+            ]);
         $package->expects($this->once())
             ->method('getPrettyName')
-            ->will($this->returnValue('package-pretty-name'));
+            ->willReturn('package-pretty-name');
 
         $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
         self::assertSame([
@@ -217,18 +217,18 @@ class SuggestedPackagesReporterTest extends TestCase
 
         $package1->expects($this->once())
             ->method('getNames')
-            ->will($this->returnValue(['x', 'y']));
+            ->willReturn(['x', 'y']);
 
         $package2->expects($this->once())
             ->method('getNames')
-            ->will($this->returnValue(['b']));
+            ->willReturn(['b']);
 
         $repository->expects($this->once())
             ->method('getPackages')
-            ->will($this->returnValue([
+            ->willReturn([
                 $package1,
                 $package2,
-            ]));
+            ]);
 
         $this->suggestedPackagesReporter->addPackage('a', 'b', 'c');
         $this->suggestedPackagesReporter->addPackage('source package', 'target', 'because reasons');
diff --git a/tests/Composer/Test/InstallerTest.php b/tests/Composer/Test/InstallerTest.php
index 6995ecb..a8403e1 100644
--- a/tests/Composer/Test/InstallerTest.php
+++ b/tests/Composer/Test/InstallerTest.php
@@ -42,6 +42,7 @@ use Symfony\Component\Console\Input\StringInput;
 use Symfony\Component\Console\Output\StreamOutput;
 use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Formatter\OutputFormatter;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class InstallerTest extends TestCase
 {
@@ -70,11 +71,11 @@ class InstallerTest extends TestCase
     }
 
     /**
-     * @dataProvider provideInstaller
      * @param RootPackageInterface&BasePackage $rootPackage
      * @param RepositoryInterface[] $repositories
      * @param mixed[] $options
      */
+    #[DataProvider('provideInstaller')]
     public function testInstaller(RootPackageInterface $rootPackage, array $repositories, array $options): void
     {
         $io = new BufferIO('', OutputInterface::VERBOSITY_NORMAL, new OutputFormatter(false));
@@ -85,7 +86,7 @@ class InstallerTest extends TestCase
         $config = $this->getMockBuilder('Composer\Config')->getMock();
         $config->expects($this->any())
             ->method('get')
-            ->will($this->returnCallback(static function ($key) {
+            ->willReturnCallback(static function ($key) {
                 switch ($key) {
                     case 'vendor-dir':
                         return 'foo';
@@ -97,7 +98,7 @@ class InstallerTest extends TestCase
                 }
 
                 throw new \UnexpectedValueException('Unknown key '.$key);
-            }));
+            });
 
         $eventDispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher')->disableOriginalConstructor()->getMock();
         $httpDownloader = $this->getMockBuilder('Composer\Util\HttpDownloader')->disableOriginalConstructor()->getMock();
@@ -115,19 +116,19 @@ class InstallerTest extends TestCase
         $lockJsonMock = $this->getMockBuilder('Composer\Json\JsonFile')->disableOriginalConstructor()->getMock();
         $lockJsonMock->expects($this->any())
             ->method('read')
-            ->will($this->returnCallback(static function () use (&$lockData) {
+            ->willReturnCallback(static function () use (&$lockData) {
                 return json_decode($lockData, true);
-            }));
+            });
         $lockJsonMock->expects($this->any())
             ->method('exists')
-            ->will($this->returnCallback(static function () use (&$lockData): bool {
+            ->willReturnCallback(static function () use (&$lockData): bool {
                 return $lockData !== null;
-            }));
+            });
         $lockJsonMock->expects($this->any())
             ->method('write')
-            ->will($this->returnCallback(static function ($value, $options = 0) use (&$lockData): void {
+            ->willReturnCallback(static function ($value, $options = 0) use (&$lockData): void {
                 $lockData = json_encode($value, JSON_PRETTY_PRINT);
-            }));
+            });
 
         $tempLockData = null;
         $locker = new Locker($io, $lockJsonMock, $installationManager, '{}');
@@ -221,7 +222,6 @@ class InstallerTest extends TestCase
 
     /**
      * @group slow
-     * @dataProvider provideSlowIntegrationTests
      * @param mixed[] $composerConfig
      * @param ?array<mixed> $lock
      * @param ?array<mixed> $installed
@@ -229,6 +229,7 @@ class InstallerTest extends TestCase
      * @param ?array<mixed> $expectInstalled
      * @param int|class-string<\Throwable> $expectResult
      */
+    #[DataProvider('provideSlowIntegrationTests')]
     public function testSlowIntegration(string $file, string $message, ?string $condition, array $composerConfig, ?array $lock, ?array $installed, string $run, $expectLock, ?array $expectInstalled, ?string $expectOutput, ?string $expectOutputOptimized, string $expect, $expectResult): void
     {
         Platform::putEnv('COMPOSER_POOL_OPTIMIZER', '0');
@@ -237,7 +238,6 @@ class InstallerTest extends TestCase
     }
 
     /**
-     * @dataProvider provideIntegrationTests
      * @param mixed[] $composerConfig
      * @param ?array<mixed> $lock
      * @param ?array<mixed> $installed
@@ -245,6 +245,7 @@ class InstallerTest extends TestCase
      * @param ?array<mixed> $expectInstalled
      * @param int|class-string<\Throwable> $expectResult
      */
+    #[DataProvider('provideIntegrationTests')]
     public function testIntegrationWithPoolOptimizer(string $file, string $message, ?string $condition, array $composerConfig, ?array $lock, ?array $installed, string $run, $expectLock, ?array $expectInstalled, ?string $expectOutput, ?string $expectOutputOptimized, string $expect, $expectResult): void
     {
         Platform::putEnv('COMPOSER_POOL_OPTIMIZER', '1');
@@ -253,7 +254,6 @@ class InstallerTest extends TestCase
     }
 
     /**
-     * @dataProvider provideIntegrationTests
      * @param mixed[] $composerConfig
      * @param ?array<mixed> $lock
      * @param ?array<mixed> $installed
@@ -261,6 +261,7 @@ class InstallerTest extends TestCase
      * @param ?array<mixed> $expectInstalled
      * @param int|class-string<\Throwable> $expectResult
      */
+    #[DataProvider('provideIntegrationTests')]
     public function testIntegrationWithRawPool(string $file, string $message, ?string $condition, array $composerConfig, ?array $lock, ?array $installed, string $run, $expectLock, ?array $expectInstalled, ?string $expectOutput, ?string $expectOutputOptimized, string $expect, $expectResult): void
     {
         if (PHP_INT_SIZE == 4) {
@@ -309,10 +310,10 @@ class InstallerTest extends TestCase
         $jsonMock = $this->getMockBuilder('Composer\Json\JsonFile')->disableOriginalConstructor()->getMock();
         $jsonMock->expects($this->any())
             ->method('read')
-            ->will($this->returnValue($installed));
+            ->willReturn($installed);
         $jsonMock->expects($this->any())
             ->method('exists')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $repositoryManager = $composer->getRepositoryManager();
         $repositoryManager->setLocalRepository(new InstalledFilesystemRepositoryMock($jsonMock));
@@ -322,29 +323,29 @@ class InstallerTest extends TestCase
         $lockJsonMock = $this->getMockBuilder('Composer\Json\JsonFile')->disableOriginalConstructor()->getMock();
         $lockJsonMock->expects($this->any())
             ->method('read')
-            ->will($this->returnCallback(static function () use (&$lockData) {
+            ->willReturnCallback(static function () use (&$lockData) {
                 return json_decode($lockData, true);
-            }));
+            });
         $lockJsonMock->expects($this->any())
             ->method('exists')
-            ->will($this->returnCallback(static function () use (&$lockData): bool {
+            ->willReturnCallback(static function () use (&$lockData): bool {
                 return $lockData !== null;
-            }));
+            });
         $lockJsonMock->expects($this->any())
             ->method('write')
-            ->will($this->returnCallback(static function ($value, $options = 0) use (&$lockData): void {
+            ->willReturnCallback(static function ($value, $options = 0) use (&$lockData): void {
                 $lockData = json_encode($value, JSON_PRETTY_PRINT);
-            }));
+            });
 
         if ($expectLock) {
             $actualLock = [];
             $lockJsonMock->expects($this->atLeastOnce())
                 ->method('write')
-                ->will($this->returnCallback(static function ($hash, $options) use (&$actualLock): void {
+                ->willReturnCallback(static function ($hash, $options) use (&$actualLock): void {
                     // need to do assertion outside of mock for nice phpunit output
                     // so store value temporarily in reference for later assertion
                     $actualLock = $hash;
-                }));
+                });
         } elseif ($expectLock === false) {
             $lockJsonMock->expects($this->never())
                 ->method('write');
diff --git a/tests/Composer/Test/Json/ComposerSchemaTest.php b/tests/Composer/Test/Json/ComposerSchemaTest.php
index b67d4d2..4401927 100644
--- a/tests/Composer/Test/Json/ComposerSchemaTest.php
+++ b/tests/Composer/Test/Json/ComposerSchemaTest.php
@@ -15,6 +15,7 @@ namespace Composer\Test\Json;
 use Composer\Json\JsonFile;
 use JsonSchema\Validator;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 /**
  * @author Rob Bast <rob.bast@gmail.com>
@@ -85,9 +86,7 @@ class ComposerSchemaTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider versionProvider
-     */
+    #[DataProvider('versionProvider')]
     public function testVersionPattern(string $version, bool $isValid): void
     {
         $json = '{"name": "vendor/package", "description": "description", "version": "' . $version . '"}';
diff --git a/tests/Composer/Test/Json/JsonManipulatorTest.php b/tests/Composer/Test/Json/JsonManipulatorTest.php
index 9cce784..5458a2d 100644
--- a/tests/Composer/Test/Json/JsonManipulatorTest.php
+++ b/tests/Composer/Test/Json/JsonManipulatorTest.php
@@ -15,12 +15,11 @@ namespace Composer\Test\Json;
 use Composer\Json\JsonFile;
 use Composer\Json\JsonManipulator;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class JsonManipulatorTest extends TestCase
 {
-    /**
-     * @dataProvider linkProvider
-     */
+    #[DataProvider('linkProvider')]
     public function testAddLink(string $json, string $type, string $package, string $constraint, string $expected): void
     {
         $manipulator = new JsonManipulator($json);
@@ -1288,9 +1287,7 @@ class JsonManipulatorTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider providerAddLinkAndSortPackages
-     */
+    #[DataProvider('providerAddLinkAndSortPackages')]
     public function testAddLinkAndSortPackages(string $json, string $type, string $package, string $constraint, bool $sortPackages, string $expected): void
     {
         $manipulator = new JsonManipulator($json);
@@ -1368,9 +1365,7 @@ class JsonManipulatorTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider removeSubNodeProvider
-     */
+    #[DataProvider('removeSubNodeProvider')]
     public function testRemoveSubNode(string $json, string $name, bool $expected, ?string $expectedContent = null): void
     {
         $manipulator = new JsonManipulator($json);
diff --git a/tests/Composer/Test/Json/JsonValidationExceptionTest.php b/tests/Composer/Test/Json/JsonValidationExceptionTest.php
index 672f993..28e91c6 100644
--- a/tests/Composer/Test/Json/JsonValidationExceptionTest.php
+++ b/tests/Composer/Test/Json/JsonValidationExceptionTest.php
@@ -14,14 +14,15 @@ namespace Composer\Test\Json;
 
 use Composer\Json\JsonValidationException;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class JsonValidationExceptionTest extends TestCase
 {
     /**
-     * @dataProvider errorProvider
      * @param string[] $errors
      * @param string[] $expectedErrors
      */
+    #[DataProvider('errorProvider')]
     public function testGetErrors(string $message, array $errors, string $expectedMessage, array $expectedErrors): void
     {
         $object = new JsonValidationException($message, $errors);
diff --git a/tests/Composer/Test/Package/Archiver/GitExcludeFilterTest.php b/tests/Composer/Test/Package/Archiver/GitExcludeFilterTest.php
index 56134e2..56bd655 100644
--- a/tests/Composer/Test/Package/Archiver/GitExcludeFilterTest.php
+++ b/tests/Composer/Test/Package/Archiver/GitExcludeFilterTest.php
@@ -14,14 +14,14 @@ namespace Composer\Test\Package\Archiver;
 
 use Composer\Package\Archiver\GitExcludeFilter;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class GitExcludeFilterTest extends TestCase
 {
     /**
-     * @dataProvider providePatterns
-     *
      * @param mixed[] $expected
      */
+    #[DataProvider('providePatterns')]
     public function testPatternEscape(string $ignore, array $expected): void
     {
         $filter = new GitExcludeFilter('/');
diff --git a/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php b/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php
index d7af0c6..5b7e8dc 100644
--- a/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php
+++ b/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php
@@ -15,6 +15,7 @@ namespace Composer\Test\Package\Archiver;
 use Composer\Util\Platform;
 use ZipArchive;
 use Composer\Package\Archiver\ZipArchiver;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class ZipArchiverTest extends ArchiverTestCase
 {
@@ -37,9 +38,7 @@ class ZipArchiverTest extends ArchiverTestCase
         $this->assertZipArchive($files);
     }
 
-    /**
-     * @dataProvider provideGitignoreExcludeNegationTestCases
-     */
+    #[DataProvider('provideGitignoreExcludeNegationTestCases')]
     public function testGitignoreExcludeNegation(string $include): void
     {
         $this->assertZipArchive([
diff --git a/tests/Composer/Test/Package/BasePackageTest.php b/tests/Composer/Test/Package/BasePackageTest.php
index ae40844..c594f19 100644
--- a/tests/Composer/Test/Package/BasePackageTest.php
+++ b/tests/Composer/Test/Package/BasePackageTest.php
@@ -14,12 +14,14 @@ namespace Composer\Test\Package;
 
 use Composer\Package\BasePackage;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
+use PHPUnit\Framework\Attributes\RequiresPhpunit;
 
 class BasePackageTest extends TestCase
 {
-    /**
-     * @doesNotPerformAssertions
-     */
+    #[DoesNotPerformAssertions]
+    #[RequiresPhpunit('< 12')]
     public function testSetSameRepository(): void
     {
         $package = $this->getMockForAbstractClass('Composer\Package\BasePackage', ['foo']);
@@ -33,6 +35,7 @@ class BasePackageTest extends TestCase
         }
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testSetAnotherRepository(): void
     {
         self::expectException('LogicException');
@@ -43,16 +46,15 @@ class BasePackageTest extends TestCase
         $package->setRepository($this->getMockBuilder('Composer\Repository\RepositoryInterface')->getMock());
     }
 
-    /**
-     * @dataProvider provideFormattedVersions
-     */
+    #[DataProvider('provideFormattedVersions')]
+    #[RequiresPhpunit('< 12')]
     public function testFormatVersionForDevPackage(string $sourceReference, bool $truncate, string $expected): void
     {
         $package = $this->getMockForAbstractClass('\Composer\Package\BasePackage', [], '', false);
-        $package->expects($this->once())->method('isDev')->will($this->returnValue(true));
-        $package->expects($this->any())->method('getSourceType')->will($this->returnValue('git'));
-        $package->expects($this->once())->method('getPrettyVersion')->will($this->returnValue('PrettyVersion'));
-        $package->expects($this->any())->method('getSourceReference')->will($this->returnValue($sourceReference));
+        $package->expects($this->once())->method('isDev')->willReturn(true);
+        $package->expects($this->any())->method('getSourceType')->willReturn('git');
+        $package->expects($this->once())->method('getPrettyVersion')->willReturn('PrettyVersion');
+        $package->expects($this->any())->method('getSourceReference')->willReturn($sourceReference);
 
         self::assertSame($expected, $package->getFullPrettyVersion($truncate));
     }
@@ -86,9 +88,8 @@ class BasePackageTest extends TestCase
     /**
      * @param string[] $packageNames
      * @param non-empty-string $wrap
-     *
-     * @dataProvider dataPackageNamesToRegexp
      */
+    #[DataProvider('dataPackageNamesToRegexp')]
     public function testPackageNamesToRegexp(array $packageNames, $wrap, string $expectedRegexp): void
     {
         $regexp = BasePackage::packageNamesToRegexp($packageNames, $wrap);
diff --git a/tests/Composer/Test/Package/CompletePackageTest.php b/tests/Composer/Test/Package/CompletePackageTest.php
index 6f7fe5f..a80b4e4 100644
--- a/tests/Composer/Test/Package/CompletePackageTest.php
+++ b/tests/Composer/Test/Package/CompletePackageTest.php
@@ -15,6 +15,7 @@ namespace Composer\Test\Package;
 use Composer\Package\Package;
 use Composer\Semver\VersionParser;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class CompletePackageTest extends TestCase
 {
@@ -34,9 +35,7 @@ class CompletePackageTest extends TestCase
         return $provider;
     }
 
-    /**
-     * @dataProvider providerVersioningSchemes
-     */
+    #[DataProvider('providerVersioningSchemes')]
     public function testPackageHasExpectedNamingSemantics(string $name, string $version): void
     {
         $versionParser = new VersionParser();
@@ -45,9 +44,7 @@ class CompletePackageTest extends TestCase
         self::assertEquals(strtolower($name), $package->getName());
     }
 
-    /**
-     * @dataProvider providerVersioningSchemes
-     */
+    #[DataProvider('providerVersioningSchemes')]
     public function testPackageHasExpectedVersioningSemantics(string $name, string $version): void
     {
         $versionParser = new VersionParser();
@@ -57,9 +54,7 @@ class CompletePackageTest extends TestCase
         self::assertEquals($normVersion, $package->getVersion());
     }
 
-    /**
-     * @dataProvider providerVersioningSchemes
-     */
+    #[DataProvider('providerVersioningSchemes')]
     public function testPackageHasExpectedMarshallingSemantics(string $name, string $version): void
     {
         $versionParser = new VersionParser();
diff --git a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php
index 253b325..d3248db 100644
--- a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php
+++ b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php
@@ -16,6 +16,7 @@ use Composer\Package\Dumper\ArrayDumper;
 use Composer\Package\Link;
 use Composer\Semver\Constraint\Constraint;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class ArrayDumperTest extends TestCase
 {
@@ -71,12 +72,11 @@ class ArrayDumperTest extends TestCase
     }
 
     /**
-     * @dataProvider provideKeys
-     *
      * @param mixed  $value
      * @param string $method
      * @param mixed  $expectedValue
      */
+    #[DataProvider('provideKeys')]
     public function testKeys(string $key, $value, ?string $method = null, $expectedValue = null): void
     {
         $package = self::getRootPackage();
diff --git a/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php b/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php
index 09602fc..926dd72 100644
--- a/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php
+++ b/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php
@@ -17,6 +17,7 @@ use Composer\Package\Dumper\ArrayDumper;
 use Composer\Package\Link;
 use Composer\Package\Version\VersionParser;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class ArrayLoaderTest extends TestCase
 {
@@ -152,10 +153,9 @@ class ArrayLoaderTest extends TestCase
      * The default parser should default to loading the config as this
      * allows require-dev libraries to have transport options included.
      *
-     * @dataProvider parseDumpProvider
-     *
      * @param array<string, mixed> $config
      */
+    #[DataProvider('parseDumpProvider')]
     public function testParseDumpDefaultLoadConfig(array $config): void
     {
         $package = $this->loader->load($config);
@@ -165,10 +165,9 @@ class ArrayLoaderTest extends TestCase
     }
 
     /**
-     * @dataProvider parseDumpProvider
-     *
      * @param array<string, mixed> $config
      */
+    #[DataProvider('parseDumpProvider')]
     public function testParseDumpTrueLoadConfig(array $config): void
     {
         $loader = new ArrayLoader(null, true);
@@ -179,10 +178,9 @@ class ArrayLoaderTest extends TestCase
     }
 
     /**
-     * @dataProvider parseDumpProvider
-     *
      * @param array<string, mixed> $config
      */
+    #[DataProvider('parseDumpProvider')]
     public function testParseDumpFalseLoadConfig(array $config): void
     {
         $loader = new ArrayLoader(null, false);
@@ -346,9 +344,7 @@ class ArrayLoaderTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider providePluginApiVersions
-     */
+    #[DataProvider('providePluginApiVersions')]
     public function testPluginApiVersionAreKeptAsDeclared(string $apiVersion): void
     {
         $links = $this->loader->parseLinks('Plugin', '9.9.9', Link::TYPE_REQUIRE, ['composer-plugin-api' => $apiVersion]);
diff --git a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php
index 7f39a87..2477fa1 100644
--- a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php
+++ b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php
@@ -15,14 +15,14 @@ namespace Composer\Test\Package\Loader;
 use Composer\Package\Loader\ValidatingArrayLoader;
 use Composer\Package\Loader\InvalidPackageException;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class ValidatingArrayLoaderTest extends TestCase
 {
     /**
-     * @dataProvider successProvider
-     *
      * @param array<string, mixed> $config
      */
+    #[DataProvider('successProvider')]
     public function testLoadSuccess(array $config): void
     {
         $internalLoader = $this->getMockBuilder('Composer\Package\Loader\LoaderInterface')->getMock();
@@ -202,11 +202,10 @@ class ValidatingArrayLoaderTest extends TestCase
     }
 
     /**
-     * @dataProvider errorProvider
-     *
      * @param array<string, mixed> $config
      * @param string[]             $expectedErrors
      */
+    #[DataProvider('errorProvider')]
     public function testLoadFailureThrowsException(array $config, array $expectedErrors): void
     {
         $internalLoader = $this->getMockBuilder('Composer\Package\Loader\LoaderInterface')->getMock();
@@ -223,11 +222,10 @@ class ValidatingArrayLoaderTest extends TestCase
     }
 
     /**
-     * @dataProvider warningProvider
-     *
      * @param array<string, mixed> $config
      * @param string[]             $expectedWarnings
      */
+    #[DataProvider('warningProvider')]
     public function testLoadWarnings(array $config, array $expectedWarnings): void
     {
         $internalLoader = $this->getMockBuilder('Composer\Package\Loader\LoaderInterface')->getMock();
@@ -241,12 +239,11 @@ class ValidatingArrayLoaderTest extends TestCase
     }
 
     /**
-     * @dataProvider warningProvider
-     *
      * @param array<string, mixed> $config
      * @param string[]             $expectedWarnings
      * @param array<string, mixed>|null $expectedArray
      */
+    #[DataProvider('warningProvider')]
     public function testLoadSkipsWarningDataWhenIgnoringErrors(array $config, array $expectedWarnings, bool $mustCheck = true, ?array $expectedArray = null): void
     {
         if (!$mustCheck) {
diff --git a/tests/Composer/Test/Package/LockerTest.php b/tests/Composer/Test/Package/LockerTest.php
index 8bc4c59..63e0e5b 100644
--- a/tests/Composer/Test/Package/LockerTest.php
+++ b/tests/Composer/Test/Package/LockerTest.php
@@ -33,11 +33,11 @@ class LockerTest extends TestCase
         $json
             ->expects($this->any())
             ->method('exists')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $json
             ->expects($this->any())
             ->method('read')
-            ->will($this->returnValue(['packages' => []]));
+            ->willReturn(['packages' => []]);
 
         self::assertTrue($locker->isLocked());
     }
@@ -52,7 +52,7 @@ class LockerTest extends TestCase
         $json
             ->expects($this->once())
             ->method('exists')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         self::expectException('LogicException');
 
@@ -69,16 +69,16 @@ class LockerTest extends TestCase
         $json
             ->expects($this->once())
             ->method('exists')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $json
             ->expects($this->once())
             ->method('read')
-            ->will($this->returnValue([
+            ->willReturn([
                 'packages' => [
                     ['name' => 'pkg1', 'version' => '1.0.0-beta'],
                     ['name' => 'pkg2', 'version' => '0.1.10'],
                 ],
-            ]));
+            ]);
 
         $repo = $locker->getLockedRepository();
         self::assertNotNull($repo->findPackage('pkg1', '1.0.0-beta'));
@@ -136,7 +136,7 @@ class LockerTest extends TestCase
         $package1
             ->expects($this->once())
             ->method('getPrettyName')
-            ->will($this->returnValue('pkg1'));
+            ->willReturn('pkg1');
 
         self::expectException('LogicException');
 
@@ -154,7 +154,7 @@ class LockerTest extends TestCase
         $json
             ->expects($this->once())
             ->method('read')
-            ->will($this->returnValue(['hash' => hash('md5', $jsonContent)]));
+            ->willReturn(['hash' => hash('md5', $jsonContent)]);
 
         self::assertTrue($locker->isFresh());
     }
@@ -169,7 +169,7 @@ class LockerTest extends TestCase
         $json
             ->expects($this->once())
             ->method('read')
-            ->will($this->returnValue(['hash' => $this->getJsonContent(['name' => 'test2'])]));
+            ->willReturn(['hash' => $this->getJsonContent(['name' => 'test2'])]);
 
         self::assertFalse($locker->isFresh());
     }
@@ -185,7 +185,7 @@ class LockerTest extends TestCase
         $json
             ->expects($this->once())
             ->method('read')
-            ->will($this->returnValue(['hash' => hash('md5', $jsonContent . '  '), 'content-hash' => hash('md5', $jsonContent)]));
+            ->willReturn(['hash' => hash('md5', $jsonContent . '  '), 'content-hash' => hash('md5', $jsonContent)]);
 
         self::assertTrue($locker->isFresh());
     }
@@ -201,7 +201,7 @@ class LockerTest extends TestCase
         $json
             ->expects($this->once())
             ->method('read')
-            ->will($this->returnValue(['content-hash' => hash('md5', $jsonContent)]));
+            ->willReturn(['content-hash' => hash('md5', $jsonContent)]);
 
         self::assertTrue($locker->isFresh());
     }
@@ -218,7 +218,7 @@ class LockerTest extends TestCase
         $json
             ->expects($this->once())
             ->method('read')
-            ->will($this->returnValue(['hash' => $differentHash, 'content-hash' => $differentHash]));
+            ->willReturn(['hash' => $differentHash, 'content-hash' => $differentHash]);
 
         self::assertFalse($locker->isFresh());
     }
diff --git a/tests/Composer/Test/Package/Version/VersionBumperTest.php b/tests/Composer/Test/Package/Version/VersionBumperTest.php
index 15b554a..cb44976 100644
--- a/tests/Composer/Test/Package/Version/VersionBumperTest.php
+++ b/tests/Composer/Test/Package/Version/VersionBumperTest.php
@@ -17,12 +17,11 @@ use Composer\Package\Package;
 use Composer\Package\Version\VersionParser;
 use Composer\Test\TestCase;
 use Generator;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class VersionBumperTest extends TestCase
 {
-    /**
-     * @dataProvider provideBumpRequirementTests
-     */
+    #[DataProvider('provideBumpRequirementTests')]
     public function testBumpRequirement(string $requirement, string $prettyVersion, string $expectedRequirement, ?string $branchAlias = null): void
     {
         $versionBumper = new VersionBumper();
diff --git a/tests/Composer/Test/Package/Version/VersionGuesserTest.php b/tests/Composer/Test/Package/Version/VersionGuesserTest.php
index 6b465cd4..4d6876d 100644
--- a/tests/Composer/Test/Package/Version/VersionGuesserTest.php
+++ b/tests/Composer/Test/Package/Version/VersionGuesserTest.php
@@ -19,6 +19,7 @@ use Composer\Test\TestCase;
 use Composer\Util\Git as GitUtil;
 use Composer\Util\Platform;
 use Composer\Util\ProcessExecutor;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class VersionGuesserTest extends TestCase
 {
@@ -367,9 +368,7 @@ class VersionGuesserTest extends TestCase
         self::assertEquals("1.5.9999999.9999999-dev", $versionData['version']);
     }
 
-    /**
-     * @dataProvider rootEnvVersionsProvider
-     */
+    #[DataProvider('rootEnvVersionsProvider')]
     public function testGetRootVersionFromEnv(string $env, string $expectedVersion): void
     {
         Platform::putEnv('COMPOSER_ROOT_VERSION', $env);
diff --git a/tests/Composer/Test/Package/Version/VersionParserTest.php b/tests/Composer/Test/Package/Version/VersionParserTest.php
index 845b52d..690b432 100644
--- a/tests/Composer/Test/Package/Version/VersionParserTest.php
+++ b/tests/Composer/Test/Package/Version/VersionParserTest.php
@@ -14,15 +14,15 @@ namespace Composer\Test\Package\Version;
 
 use Composer\Package\Version\VersionParser;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class VersionParserTest extends TestCase
 {
     /**
-     * @dataProvider provideParseNameVersionPairsData
-     *
      * @param string[]                     $pairs
      * @param array<array<string, string>> $result
      */
+    #[DataProvider('provideParseNameVersionPairsData')]
     public function testParseNameVersionPairs(array $pairs, array $result): void
     {
         $versionParser = new VersionParser();
@@ -41,9 +41,7 @@ class VersionParserTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider provideIsUpgradeTests
-     */
+    #[DataProvider('provideIsUpgradeTests')]
     public function testIsUpgrade(string $from, string $to, bool $expected): void
     {
         self::assertSame($expected, VersionParser::isUpgrade($from, $to));
diff --git a/tests/Composer/Test/Package/Version/VersionSelectorTest.php b/tests/Composer/Test/Package/Version/VersionSelectorTest.php
index e4d508c..bb229a6 100644
--- a/tests/Composer/Test/Package/Version/VersionSelectorTest.php
+++ b/tests/Composer/Test/Package/Version/VersionSelectorTest.php
@@ -21,6 +21,7 @@ use Composer\Package\AliasPackage;
 use Composer\Repository\PlatformRepository;
 use Composer\Package\Version\VersionParser;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 use Symfony\Component\Console\Output\StreamOutput;
 
 class VersionSelectorTest extends TestCase
@@ -42,7 +43,7 @@ class VersionSelectorTest extends TestCase
         $repositorySet->expects($this->once())
             ->method('findPackages')
             ->with($packageName, null)
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $versionSelector = new VersionSelector($repositorySet);
         $best = $versionSelector->findBestCandidate($packageName);
@@ -73,7 +74,7 @@ class VersionSelectorTest extends TestCase
         $repositorySet->expects($this->any())
             ->method('findPackages')
             ->with($packageName, null)
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $io = new BufferIO();
         $best = $versionSelector->findBestCandidate($packageName, null, 'stable', null, 0, $io);
@@ -111,7 +112,7 @@ class VersionSelectorTest extends TestCase
         $repositorySet->expects($this->any())
             ->method('findPackages')
             ->with($packageName, null)
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $best = $versionSelector->findBestCandidate($packageName);
         self::assertSame($package1, $best, 'Latest version supporting ext-zip 5.3.0 should be returned (1.0.0)');
@@ -136,7 +137,7 @@ class VersionSelectorTest extends TestCase
         $repositorySet->expects($this->any())
             ->method('findPackages')
             ->with($packageName, null)
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $best = $versionSelector->findBestCandidate($packageName);
         self::assertSame($package1, $best, 'Latest version not requiring ext-barfoo should be returned (1.0.0)');
@@ -162,7 +163,7 @@ class VersionSelectorTest extends TestCase
         $repositorySet->expects($this->any())
             ->method('findPackages')
             ->with($packageName, null)
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $best = $versionSelector->findBestCandidate($packageName);
         self::assertSame($package1, $best, 'Latest version supporting composer 1 should be returned (1.0.0)');
@@ -182,7 +183,7 @@ class VersionSelectorTest extends TestCase
         $repositorySet->expects($this->once())
             ->method('findPackages')
             ->with($packageName, null)
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $versionSelector = new VersionSelector($repositorySet);
         $best = $versionSelector->findBestCandidate($packageName);
@@ -227,7 +228,7 @@ class VersionSelectorTest extends TestCase
         $repositorySet->expects($this->once())
             ->method('findPackages')
             ->with($packageName, null)
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $versionSelector = new VersionSelector($repositorySet);
         $best = $versionSelector->findBestCandidate($packageName, null, 'dev');
@@ -248,7 +249,7 @@ class VersionSelectorTest extends TestCase
         $repositorySet->expects($this->once())
             ->method('findPackages')
             ->with($packageName, null)
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $versionSelector = new VersionSelector($repositorySet);
         $best = $versionSelector->findBestCandidate($packageName, null, 'beta');
@@ -268,7 +269,7 @@ class VersionSelectorTest extends TestCase
         $repositorySet->expects($this->once())
             ->method('findPackages')
             ->with($packageName, null)
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $versionSelector = new VersionSelector($repositorySet);
         $best = $versionSelector->findBestCandidate($packageName, null, 'stable');
@@ -289,7 +290,7 @@ class VersionSelectorTest extends TestCase
         $repositorySet->expects($this->once())
             ->method('findPackages')
             ->with($packageName, null)
-            ->will($this->returnValue($packages));
+            ->willReturn($packages);
 
         $versionSelector = new VersionSelector($repositorySet);
         $best = $versionSelector->findBestCandidate($packageName, null, 'dev');
@@ -302,16 +303,14 @@ class VersionSelectorTest extends TestCase
         $repositorySet = $this->createMockRepositorySet();
         $repositorySet->expects($this->once())
             ->method('findPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
 
         $versionSelector = new VersionSelector($repositorySet);
         $best = $versionSelector->findBestCandidate('foobaz');
         self::assertFalse($best, 'No versions are available returns false');
     }
 
-    /**
-     * @dataProvider provideRecommendedRequireVersionPackages
-     */
+    #[DataProvider('provideRecommendedRequireVersionPackages')]
     public function testFindRecommendedRequireVersion(string $prettyVersion, string $expectedVersion, ?string $branchAlias = null, string $packageName = 'foo/bar'): void
     {
         $repositorySet = $this->createMockRepositorySet();
diff --git a/tests/Composer/Test/Platform/VersionTest.php b/tests/Composer/Test/Platform/VersionTest.php
index b564734..b10eb80 100644
--- a/tests/Composer/Test/Platform/VersionTest.php
+++ b/tests/Composer/Test/Platform/VersionTest.php
@@ -14,6 +14,7 @@ namespace Composer\Test\Platform;
 
 use Composer\Platform\Version;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 /**
  * @author Lars Strojny <lars@strojny.net>
@@ -76,9 +77,7 @@ class VersionTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider provideOpenSslVersions
-     */
+    #[DataProvider('provideOpenSslVersions')]
     public function testParseOpensslVersions(string $input, string $parsedVersion, bool $fipsExpected = false, ?string $normalizedVersion = null): void
     {
         self::assertSame($parsedVersion, Version::parseOpenssl($input, $isFips));
@@ -99,9 +98,7 @@ class VersionTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider provideLibJpegVersions
-     */
+    #[DataProvider('provideLibJpegVersions')]
     public function testParseLibjpegVersion(string $input, string $parsedVersion): void
     {
         self::assertSame($parsedVersion, Version::parseLibjpeg($input));
@@ -117,9 +114,7 @@ class VersionTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider provideZoneinfoVersions
-     */
+    #[DataProvider('provideZoneinfoVersions')]
     public function testParseZoneinfoVersion(string $input, string $parsedVersion): void
     {
         self::assertSame($parsedVersion, Version::parseZoneinfoVersion($input));
diff --git a/tests/Composer/Test/Plugin/PluginInstallerTest.php b/tests/Composer/Test/Plugin/PluginInstallerTest.php
index ba2402a..ed9ccde 100644
--- a/tests/Composer/Test/Plugin/PluginInstallerTest.php
+++ b/tests/Composer/Test/Plugin/PluginInstallerTest.php
@@ -29,6 +29,7 @@ use Composer\Autoload\AutoloadGenerator;
 use Composer\Test\TestCase;
 use Composer\Util\Filesystem;
 use Composer\Util\Platform;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class PluginInstallerTest extends TestCase
 {
@@ -88,13 +89,13 @@ class PluginInstallerTest extends TestCase
             ->getMock();
         $dm->expects($this->any())
             ->method('install')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
         $dm->expects($this->any())
             ->method('update')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
         $dm->expects($this->any())
             ->method('remove')
-            ->will($this->returnValue(\React\Promise\resolve(null)));
+            ->willReturn(\React\Promise\resolve(null));
 
         $this->repository = $this->getMockBuilder('Composer\Repository\InstalledRepositoryInterface')->getMock();
 
@@ -103,14 +104,14 @@ class PluginInstallerTest extends TestCase
             ->getMock();
         $rm->expects($this->any())
             ->method('getLocalRepository')
-            ->will($this->returnValue($this->repository));
+            ->willReturn($this->repository);
 
         $im = $this->getMockBuilder('Composer\Installer\InstallationManager')->disableOriginalConstructor()->getMock();
         $im->expects($this->any())
             ->method('getInstallPath')
-            ->will($this->returnCallback(static function ($package): string {
+            ->willReturnCallback(static function ($package): string {
                 return __DIR__.'/Fixtures/'.$package->getPrettyName();
-            }));
+            });
 
         $this->io = new BufferIO();
 
@@ -153,7 +154,7 @@ class PluginInstallerTest extends TestCase
         $this->repository
             ->expects($this->any())
             ->method('getPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
         $installer = new PluginInstaller($this->io, $this->composer);
         $this->pm->loadInstalledPlugins();
 
@@ -172,7 +173,7 @@ class PluginInstallerTest extends TestCase
         $this->repository
             ->expects($this->any())
             ->method('getPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
         $installer = new PluginInstaller($this->io, $this->composer);
         $this->pm->loadInstalledPlugins();
 
@@ -194,7 +195,7 @@ class PluginInstallerTest extends TestCase
         $this->repository
             ->expects($this->any())
             ->method('getPackages')
-            ->will($this->returnValue([$this->packages[3]]));
+            ->willReturn([$this->packages[3]]);
         $installer = new PluginInstaller($this->io, $this->composer);
         $this->pm->loadInstalledPlugins();
 
@@ -213,11 +214,11 @@ class PluginInstallerTest extends TestCase
         $this->repository
             ->expects($this->any())
             ->method('getPackages')
-            ->will($this->returnValue([$this->packages[0]]));
+            ->willReturn([$this->packages[0]]);
         $this->repository
             ->expects($this->exactly(2))
             ->method('hasPackage')
-            ->will($this->onConsecutiveCalls(true, false));
+            ->willReturn(true, false);
         $installer = new PluginInstaller($this->io, $this->composer);
         $this->pm->loadInstalledPlugins();
 
@@ -234,11 +235,11 @@ class PluginInstallerTest extends TestCase
         $this->repository
             ->expects($this->any())
             ->method('getPackages')
-            ->will($this->returnValue([$this->packages[0]]));
+            ->willReturn([$this->packages[0]]);
         $this->repository
             ->expects($this->exactly(1))
             ->method('hasPackage')
-            ->will($this->onConsecutiveCalls(true, false));
+            ->willReturn(true, false);
         $installer = new PluginInstaller($this->io, $this->composer);
         $this->pm->loadInstalledPlugins();
 
@@ -254,11 +255,11 @@ class PluginInstallerTest extends TestCase
         $this->repository
             ->expects($this->any())
             ->method('getPackages')
-            ->will($this->returnValue([$this->packages[1]]));
+            ->willReturn([$this->packages[1]]);
         $this->repository
             ->expects($this->exactly(2))
             ->method('hasPackage')
-            ->will($this->onConsecutiveCalls(true, false));
+            ->willReturn(true, false);
         $installer = new PluginInstaller($this->io, $this->composer);
         $this->pm->loadInstalledPlugins();
 
@@ -274,7 +275,7 @@ class PluginInstallerTest extends TestCase
         $this->repository
             ->expects($this->any())
             ->method('getPackages')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
         $installer = new PluginInstaller($this->io, $this->composer);
         $this->pm->loadInstalledPlugins();
 
@@ -301,7 +302,7 @@ class PluginInstallerTest extends TestCase
         // mock the Plugin API version
         $this->pm->expects($this->any())
                  ->method('getPluginApiVersion')
-                 ->will($this->returnValue($newPluginApiVersion));
+                 ->willReturn($newPluginApiVersion);
 
         $plugApiInternalPackage = self::getPackage(
             'composer-plugin-api',
@@ -313,9 +314,9 @@ class PluginInstallerTest extends TestCase
         $this->repository
             ->expects($this->any())
             ->method('getPackages')
-            ->will($this->returnCallback(static function () use ($plugApiInternalPackage, $plugins): array {
+            ->willReturnCallback(static function () use ($plugApiInternalPackage, $plugins): array {
                 return array_merge([$plugApiInternalPackage], $plugins);
-            }));
+            });
 
         $this->pm->loadInstalledPlugins();
     }
@@ -373,7 +374,7 @@ class PluginInstallerTest extends TestCase
         $this->repository
             ->expects($this->any())
             ->method('getPackages')
-            ->will($this->returnValue([$this->packages[7]]));
+            ->willReturn([$this->packages[7]]);
         $installer = new PluginInstaller($this->io, $this->composer);
         $this->pm->loadInstalledPlugins();
 
@@ -404,9 +405,9 @@ class PluginInstallerTest extends TestCase
 
         $plugin->expects($this->once())
                ->method('getCapabilities')
-               ->will($this->returnCallback(static function () use ($capabilityImplementation, $capabilityApi): array {
+               ->willReturnCallback(static function () use ($capabilityImplementation, $capabilityApi): array {
                    return [$capabilityApi => $capabilityImplementation];
-               }));
+               });
 
         /** @var \Composer\Test\Plugin\Mock\Capability $capability */
         $capability = $this->pm->getPluginCapability($plugin, $capabilityApi, ['a' => 1, 'b' => 2]);
@@ -432,10 +433,10 @@ class PluginInstallerTest extends TestCase
     }
 
     /**
-     * @dataProvider invalidImplementationClassNames
      * @param mixed $invalidImplementationClassNames
      * @param class-string<\Throwable> $expect
      */
+    #[DataProvider('invalidImplementationClassNames')]
     public function testQueryingWithInvalidCapabilityClassNameThrows($invalidImplementationClassNames, string $expect = 'UnexpectedValueException'): void
     {
         self::expectException($expect);
@@ -447,9 +448,9 @@ class PluginInstallerTest extends TestCase
 
         $plugin->expects($this->once())
                ->method('getCapabilities')
-               ->will($this->returnCallback(static function () use ($invalidImplementationClassNames, $capabilityApi): array {
+               ->willReturnCallback(static function () use ($invalidImplementationClassNames, $capabilityApi): array {
                    return [$capabilityApi => $invalidImplementationClassNames];
-               }));
+               });
 
         $this->pm->getPluginCapability($plugin, $capabilityApi);
     }
@@ -463,9 +464,9 @@ class PluginInstallerTest extends TestCase
 
         $plugin->expects($this->once())
                ->method('getCapabilities')
-               ->will($this->returnCallback(static function (): array {
+               ->willReturnCallback(static function (): array {
                    return [];
-               }));
+               });
 
         self::assertNull($this->pm->getPluginCapability($plugin, $capabilityApi));
     }
@@ -479,9 +480,7 @@ class PluginInstallerTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider nonExistingOrInvalidImplementationClassTypes
-     */
+    #[DataProvider('nonExistingOrInvalidImplementationClassTypes')]
     public function testQueryingWithNonExistingOrWrongCapabilityClassTypesThrows(string $wrongImplementationClassTypes): void
     {
         $this->testQueryingWithInvalidCapabilityClassNameThrows($wrongImplementationClassTypes, 'RuntimeException');
diff --git a/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php b/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php
index bfad930..c57cc50 100644
--- a/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php
+++ b/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php
@@ -14,6 +14,7 @@ namespace Composer\Test\Question;
 
 use Composer\Question\StrictConfirmationQuestion;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 use Symfony\Component\Console\Helper\QuestionHelper;
 use Symfony\Component\Console\Input\ArrayInput;
 use Symfony\Component\Console\Output\StreamOutput;
@@ -40,9 +41,7 @@ class StrictConfirmationQuestionTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider getAskConfirmationBadData
-     */
+    #[DataProvider('getAskConfirmationBadData')]
     public function testAskConfirmationBadAnswer(string $answer): void
     {
         [$input, $dialog] = $this->createInput($answer."\n");
@@ -55,9 +54,7 @@ class StrictConfirmationQuestionTest extends TestCase
         $dialog->ask($input, $this->createOutputInterface(), $question);
     }
 
-    /**
-     * @dataProvider getAskConfirmationData
-     */
+    #[DataProvider('getAskConfirmationData')]
     public function testAskConfirmation(string $question, bool $expected, bool $default = true): void
     {
         [$input, $dialog] = $this->createInput($question."\n");
diff --git a/tests/Composer/Test/Repository/ComposerRepositoryTest.php b/tests/Composer/Test/Repository/ComposerRepositoryTest.php
index 5355c07..08203f8 100644
--- a/tests/Composer/Test/Repository/ComposerRepositoryTest.php
+++ b/tests/Composer/Test/Repository/ComposerRepositoryTest.php
@@ -20,15 +20,15 @@ use Composer\Semver\Constraint\Constraint;
 use Composer\Test\Mock\FactoryMock;
 use Composer\Test\TestCase;
 use Composer\Package\Loader\ArrayLoader;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class ComposerRepositoryTest extends TestCase
 {
     /**
-     * @dataProvider loadDataProvider
-     *
      * @param mixed[]              $expected
      * @param array<string, mixed> $repoPackages
      */
+    #[DataProvider('loadDataProvider')]
     public function testLoadData(array $expected, array $repoPackages): void
     {
         $repoConfig = [
@@ -49,7 +49,7 @@ class ComposerRepositoryTest extends TestCase
         $repository
             ->expects($this->exactly(2))
             ->method('loadRootServerFile')
-            ->will($this->returnValue($repoPackages));
+            ->willReturn($repoPackages);
 
         // Triggers initialization
         $packages = $repository->getPackages();
@@ -122,7 +122,7 @@ class ComposerRepositoryTest extends TestCase
         $cache = $this->getMockBuilder('Composer\Cache')->disableOriginalConstructor()->getMock();
         $cache->expects($this->any())
             ->method('sha256')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $properties = [
             'cache' => $cache,
@@ -139,7 +139,7 @@ class ComposerRepositoryTest extends TestCase
 
         $repo->expects($this->any())
             ->method('fetchFile')
-            ->will($this->returnValue([
+            ->willReturn([
                 'packages' => [
                     [[
                         'uid' => 1,
@@ -159,7 +159,7 @@ class ComposerRepositoryTest extends TestCase
                         'version' => '0.6',
                     ]],
                 ],
-            ]));
+            ]);
 
         $reflMethod = new \ReflectionMethod(ComposerRepository::class, 'whatProvides');
         $reflMethod->setAccessible(true);
@@ -287,10 +287,10 @@ class ComposerRepositoryTest extends TestCase
     }
 
     /**
-     * @dataProvider provideCanonicalizeUrlTestCases
      * @param non-empty-string $url
      * @param non-empty-string $repositoryUrl
      */
+    #[DataProvider('provideCanonicalizeUrlTestCases')]
     public function testCanonicalizeUrl(string $expected, string $url, string $repositoryUrl): void
     {
         $repository = new ComposerRepository(
diff --git a/tests/Composer/Test/Repository/CompositeRepositoryTest.php b/tests/Composer/Test/Repository/CompositeRepositoryTest.php
index ea2e7ff..20c95bb 100644
--- a/tests/Composer/Test/Repository/CompositeRepositoryTest.php
+++ b/tests/Composer/Test/Repository/CompositeRepositoryTest.php
@@ -15,6 +15,7 @@ namespace Composer\Test\Repository;
 use Composer\Repository\CompositeRepository;
 use Composer\Repository\ArrayRepository;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class CompositeRepositoryTest extends TestCase
 {
@@ -127,10 +128,9 @@ class CompositeRepositoryTest extends TestCase
     }
 
     /**
-     * @dataProvider provideMethodCalls
-     *
      * @param mixed[] $args
      */
+    #[DataProvider('provideMethodCalls')]
     public function testNoRepositories(string $method, array $args): void
     {
         $repo = new CompositeRepository([]);
diff --git a/tests/Composer/Test/Repository/FilesystemRepositoryTest.php b/tests/Composer/Test/Repository/FilesystemRepositoryTest.php
index c4f62a6..5ea0b5e 100644
--- a/tests/Composer/Test/Repository/FilesystemRepositoryTest.php
+++ b/tests/Composer/Test/Repository/FilesystemRepositoryTest.php
@@ -29,13 +29,13 @@ class FilesystemRepositoryTest extends TestCase
         $json
             ->expects($this->once())
             ->method('read')
-            ->will($this->returnValue([
+            ->willReturn([
                 ['name' => 'package1', 'version' => '1.0.0-beta', 'type' => 'vendor'],
-            ]));
+            ]);
         $json
             ->expects($this->once())
             ->method('exists')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $packages = $repository->getPackages();
 
@@ -55,11 +55,11 @@ class FilesystemRepositoryTest extends TestCase
         $json
             ->expects($this->once())
             ->method('read')
-            ->will($this->returnValue('foo'));
+            ->willReturn('foo');
         $json
             ->expects($this->once())
             ->method('exists')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $repository->getPackages();
     }
@@ -73,7 +73,7 @@ class FilesystemRepositoryTest extends TestCase
         $json
             ->expects($this->once())
             ->method('exists')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         self::assertEquals([], $repository->getPackages());
     }
@@ -92,20 +92,20 @@ class FilesystemRepositoryTest extends TestCase
             ->getMock();
         $im->expects($this->exactly(2))
             ->method('getInstallPath')
-            ->will($this->returnValue($repoDir.'/vendor/woop/woop'));
+            ->willReturn($repoDir.'/vendor/woop/woop');
 
         $json
             ->expects($this->once())
             ->method('read')
-            ->will($this->returnValue([]));
+            ->willReturn([]);
         $json
             ->expects($this->once())
             ->method('getPath')
-            ->will($this->returnValue($repoDir.'/vendor/composer/installed.json'));
+            ->willReturn($repoDir.'/vendor/composer/installed.json');
         $json
             ->expects($this->once())
             ->method('exists')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
         $json
             ->expects($this->once())
             ->method('write')
@@ -170,7 +170,7 @@ class FilesystemRepositoryTest extends TestCase
             ->getMock();
         $im->expects($this->any())
             ->method('getInstallPath')
-            ->will($this->returnCallback(static function ($package) use ($dir): string {
+            ->willReturnCallback(static function ($package) use ($dir): string {
                 // check for empty paths handling
                 if ($package->getType() === 'metapackage') {
                     return '';
@@ -192,7 +192,7 @@ class FilesystemRepositoryTest extends TestCase
 
                 // check for relative paths
                 return 'vendor/'.$package->getName();
-            }));
+            });
 
         $repository->write(true, $im);
         self::assertSame(file_get_contents(__DIR__.'/Fixtures/installed.php'), file_get_contents($dir.'/installed.php'));
diff --git a/tests/Composer/Test/Repository/FilterRepositoryTest.php b/tests/Composer/Test/Repository/FilterRepositoryTest.php
index 2acb58f..c881c8d 100644
--- a/tests/Composer/Test/Repository/FilterRepositoryTest.php
+++ b/tests/Composer/Test/Repository/FilterRepositoryTest.php
@@ -17,6 +17,7 @@ use Composer\Repository\FilterRepository;
 use Composer\Repository\ArrayRepository;
 use Composer\Semver\Constraint\MatchAllConstraint;
 use Composer\Package\BasePackage;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class FilterRepositoryTest extends TestCase
 {
@@ -35,11 +36,10 @@ class FilterRepositoryTest extends TestCase
     }
 
     /**
-     * @dataProvider provideRepoMatchingTestCases
-     *
      * @param string[]                                                               $expected
      * @param array{only?: array<string>, exclude?: array<string>, canonical?: bool} $config
      */
+    #[DataProvider('provideRepoMatchingTestCases')]
     public function testRepoMatching(array $expected, $config): void
     {
         $repo = new FilterRepository($this->arrayRepo, $config);
diff --git a/tests/Composer/Test/Repository/PlatformRepositoryTest.php b/tests/Composer/Test/Repository/PlatformRepositoryTest.php
index df52653..2ffed86 100644
--- a/tests/Composer/Test/Repository/PlatformRepositoryTest.php
+++ b/tests/Composer/Test/Repository/PlatformRepositoryTest.php
@@ -18,6 +18,7 @@ use Composer\Package\PackageInterface;
 use Composer\Repository\PlatformRepository;
 use Composer\Test\TestCase;
 use PHPUnit\Framework\Assert;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class PlatformRepositoryTest extends TestCase
 {
@@ -114,12 +115,11 @@ class PlatformRepositoryTest extends TestCase
     }
 
     /**
-     * @dataProvider providePhpFlavorTestCases
-     *
      * @param array<string, mixed>  $constants
      * @param array<string, string> $packages
      * @param list<array{string, list<string>, string|bool}>  $functions
      */
+    #[DataProvider('providePhpFlavorTestCases')]
     public function testPhpVersion(array $constants, array $packages, array $functions = []): void
     {
         $runtime = $this->getMockBuilder('Composer\Platform\Runtime')->getMock();
@@ -1145,14 +1145,13 @@ Linked Version => 1.2.11',
     }
 
     /**
-     * @dataProvider provideLibraryTestCases
-     *
      * @param string|string[]            $extensions
      * @param array<string,string|false|array{string|false, 1?: string[], 2?: string[]}> $expectations array of packageName => expected version (or false if expected to be msising), or packageName => array(expected version, expected replaced names, expected provided names)
      * @param list<mixed>                $functions
      * @param list<mixed>                $constants
      * @param list<mixed>                $classDefinitions
      */
+    #[DataProvider('provideLibraryTestCases')]
     public function testLibraryInformation(
         $extensions,
         ?string $info,
@@ -1325,9 +1324,7 @@ Linked Version => 1.2.11',
         ];
     }
 
-    /**
-     * @dataProvider providePlatformPackages
-     */
+    #[DataProvider('providePlatformPackages')]
     public function testValidPlatformPackages(string $packageName, bool $expectation): void
     {
         self::assertSame($expectation, PlatformRepository::isPlatformPackage($packageName));
diff --git a/tests/Composer/Test/Repository/RepositoryFactoryTest.php b/tests/Composer/Test/Repository/RepositoryFactoryTest.php
index b318e03..43a0d13 100644
--- a/tests/Composer/Test/Repository/RepositoryFactoryTest.php
+++ b/tests/Composer/Test/Repository/RepositoryFactoryTest.php
@@ -14,6 +14,7 @@ namespace Composer\Test\Repository;
 
 use Composer\Repository\RepositoryFactory;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class RepositoryFactoryTest extends TestCase
 {
@@ -50,14 +51,13 @@ class RepositoryFactoryTest extends TestCase
     }
 
     /**
-     * @dataProvider generateRepositoryNameProvider
-     *
      * @param int|string            $index
      * @param array<string, string> $config
      * @param array<string, mixed>  $existingRepos
      *
      * @phpstan-param array{url?: string} $config
      */
+    #[DataProvider('generateRepositoryNameProvider')]
     public function testGenerateRepositoryName($index, array $config, array $existingRepos, string $expected): void
     {
         self::assertSame($expected, RepositoryFactory::generateRepositoryName($index, $config, $existingRepos));
diff --git a/tests/Composer/Test/Repository/RepositoryManagerTest.php b/tests/Composer/Test/Repository/RepositoryManagerTest.php
index 859826e..002aaba 100644
--- a/tests/Composer/Test/Repository/RepositoryManagerTest.php
+++ b/tests/Composer/Test/Repository/RepositoryManagerTest.php
@@ -16,6 +16,8 @@ use Composer\Repository\RepositoryManager;
 use Composer\Test\TestCase;
 use Composer\Util\Filesystem;
 use Composer\Config;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
 
 class RepositoryManagerTest extends TestCase
 {
@@ -54,11 +56,10 @@ class RepositoryManagerTest extends TestCase
     }
 
     /**
-     * @dataProvider provideRepoCreationTestCases
-     *
-     * @doesNotPerformAssertions
      * @param array<string, mixed> $options
      */
+    #[DataProvider('provideRepoCreationTestCases')]
+    #[DoesNotPerformAssertions]
     public function testRepoCreation(string $type, array $options): void
     {
         $rm = new RepositoryManager(
@@ -104,10 +105,9 @@ class RepositoryManagerTest extends TestCase
     }
 
     /**
-     * @dataProvider provideInvalidRepoCreationTestCases
-     *
      * @param array<string, mixed> $options
      */
+    #[DataProvider('provideInvalidRepoCreationTestCases')]
     public function testInvalidRepoCreationThrows(string $type, array $options): void
     {
         self::expectException('InvalidArgumentException');
diff --git a/tests/Composer/Test/Repository/RepositoryUtilsTest.php b/tests/Composer/Test/Repository/RepositoryUtilsTest.php
index e85d2f2..5ab1ed4 100644
--- a/tests/Composer/Test/Repository/RepositoryUtilsTest.php
+++ b/tests/Composer/Test/Repository/RepositoryUtilsTest.php
@@ -16,14 +16,15 @@ use Composer\Package\PackageInterface;
 use Composer\Repository\RepositoryUtils;
 use Composer\Test\TestCase;
 use Generator;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class RepositoryUtilsTest extends TestCase
 {
     /**
-     * @dataProvider provideFilterRequireTests
      * @param PackageInterface[] $pkgs
      * @param string[] $expected
      */
+    #[DataProvider('provideFilterRequireTests')]
     public function testFilterRequiredPackages(array $pkgs, PackageInterface $requirer, array $expected, bool $includeRequireDev = false): void
     {
         $expected = array_map(static function (string $name) use ($pkgs): PackageInterface {
diff --git a/tests/Composer/Test/Repository/Vcs/FossilDriverTest.php b/tests/Composer/Test/Repository/Vcs/FossilDriverTest.php
index 854c55e..62c50e4 100644
--- a/tests/Composer/Test/Repository/Vcs/FossilDriverTest.php
+++ b/tests/Composer/Test/Repository/Vcs/FossilDriverTest.php
@@ -16,6 +16,7 @@ use Composer\Repository\Vcs\FossilDriver;
 use Composer\Config;
 use Composer\Test\TestCase;
 use Composer\Util\Filesystem;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class FossilDriverTest extends TestCase
 {
@@ -55,9 +56,7 @@ class FossilDriverTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider supportProvider
-     */
+    #[DataProvider('supportProvider')]
     public function testSupport(string $url, bool $assertion): void
     {
         $config = new Config();
diff --git a/tests/Composer/Test/Repository/Vcs/GitBitbucketDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitBitbucketDriverTest.php
index d1fa2bb..384f6ba 100644
--- a/tests/Composer/Test/Repository/Vcs/GitBitbucketDriverTest.php
+++ b/tests/Composer/Test/Repository/Vcs/GitBitbucketDriverTest.php
@@ -20,6 +20,7 @@ use Composer\Test\TestCase;
 use Composer\Util\Filesystem;
 use Composer\Util\ProcessExecutor;
 use Composer\Util\Http\Response;
+use PHPUnit\Framework\Attributes\Depends;
 
 /**
  * @group bitbucket
@@ -160,9 +161,7 @@ class GitBitbucketDriverTest extends TestCase
         return $driver;
     }
 
-    /**
-     * @depends testDriver
-     */
+    #[Depends('testDriver')]
     public function testGetParams(\Composer\Repository\Vcs\VcsDriverInterface $driver): void
     {
         $url = 'https://bitbucket.org/user/repo.git';
diff --git a/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php
index 3932900..995e702 100644
--- a/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php
+++ b/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php
@@ -17,6 +17,7 @@ use Composer\Test\TestCase;
 use Composer\Util\Filesystem;
 use Composer\Config;
 use Composer\Util\ProcessExecutor;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class GitHubDriverTest extends TestCase
 {
@@ -54,7 +55,7 @@ class GitHubDriverTest extends TestCase
         $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
         $io->expects($this->any())
             ->method('isInteractive')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $httpDownloader = $this->getHttpDownloaderMock($io, $this->config);
         $httpDownloader->expects(
@@ -72,7 +73,7 @@ class GitHubDriverTest extends TestCase
         $io->expects($this->once())
             ->method('askAndHideAnswer')
             ->with($this->equalTo('Token (hidden): '))
-            ->will($this->returnValue('sometoken'));
+            ->willReturn('sometoken');
 
         $io->expects($this->any())
             ->method('setAuthentication')
@@ -115,7 +116,7 @@ class GitHubDriverTest extends TestCase
         $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
         $io->expects($this->any())
             ->method('isInteractive')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $httpDownloader = $this->getHttpDownloaderMock($io, $this->config);
         $httpDownloader->expects(
@@ -158,7 +159,7 @@ class GitHubDriverTest extends TestCase
         $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
         $io->expects($this->any())
             ->method('isInteractive')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $httpDownloader = $this->getHttpDownloaderMock($io, $this->config);
         $httpDownloader->expects(
@@ -209,7 +210,7 @@ class GitHubDriverTest extends TestCase
         $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
         $io->expects($this->any())
             ->method('isInteractive')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $httpDownloader = $this->getHttpDownloaderMock($io, $this->config);
         $httpDownloader->expects(
@@ -238,9 +239,9 @@ class GitHubDriverTest extends TestCase
     }
 
     /**
-     * @dataProvider fundingUrlProvider
      * @param array<array{type: string, url: string}>|null $expected
      */
+    #[DataProvider('fundingUrlProvider')]
     public function testFundingFormat(string $funding, ?array $expected): void
     {
         $repoUrl = 'http://github.com/composer/packagist';
@@ -251,7 +252,7 @@ class GitHubDriverTest extends TestCase
         $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
         $io->expects($this->any())
             ->method('isInteractive')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $httpDownloader = $this->getHttpDownloaderMock($io, $this->config);
         $httpDownloader->expects(
@@ -434,7 +435,7 @@ FUNDING;
         $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
         $io->expects($this->any())
             ->method('isInteractive')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $httpDownloader = $this->getHttpDownloaderMock($io, $this->config);
         $httpDownloader->expects(
@@ -472,7 +473,7 @@ FUNDING;
         $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
         $io->expects($this->any())
             ->method('isInteractive')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $httpDownloader = $this->getHttpDownloaderMock($io, $this->config);
         $httpDownloader->expects(
@@ -531,9 +532,7 @@ FUNDING;
         self::assertEquals($sha, $source['reference']);
     }
 
-    /**
-     * @dataProvider invalidUrlProvider
-     */
+    #[DataProvider('invalidUrlProvider')]
     public function testInitializeInvalidRepoUrl(string $url): void
     {
         $this->expectException('\InvalidArgumentException');
@@ -563,9 +562,7 @@ FUNDING;
         ];
     }
 
-    /**
-     * @dataProvider supportsProvider
-     */
+    #[DataProvider('supportsProvider')]
     public function testSupports(bool $expected, string $repoUrl): void
     {
         $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
@@ -594,7 +591,7 @@ FUNDING;
         $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
         $io->expects($this->any())
             ->method('isInteractive')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $httpDownloader = $this->getHttpDownloaderMock($io, $this->config);
         $httpDownloader->expects(
diff --git a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php
index acc1df9..8836579 100644
--- a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php
+++ b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php
@@ -21,6 +21,7 @@ use Composer\Test\TestCase;
 use Composer\Util\Filesystem;
 use Composer\Util\ProcessExecutor;
 use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\Attributes\DataProvider;
 use Composer\Util\Http\Response;
 
 /**
@@ -85,10 +86,10 @@ class GitLabDriverTest extends TestCase
     }
 
     /**
-     * @dataProvider provideInitializeUrls
      * @param non-empty-string $url
      * @param non-empty-string $apiUrl
      */
+    #[DataProvider('provideInitializeUrls')]
     public function testInitialize(string $url, string $apiUrl): GitLabDriver
     {
         // @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
@@ -127,10 +128,10 @@ JSON;
     }
 
     /**
-     * @dataProvider provideInitializeUrls
      * @param non-empty-string $url
      * @param non-empty-string $apiUrl
      */
+    #[DataProvider('provideInitializeUrls')]
     public function testInitializePublicProject(string $url, string $apiUrl): GitLabDriver
     {
         // @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
@@ -167,10 +168,10 @@ JSON;
     }
 
     /**
-     * @dataProvider provideInitializeUrls
      * @param non-empty-string $url
      * @param non-empty-string $apiUrl
      */
+    #[DataProvider('provideInitializeUrls')]
     public function testInitializePublicProjectAsAnonymous(string $url, string $apiUrl): GitLabDriver
     {
         // @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
@@ -450,8 +451,8 @@ JSON;
 
     /**
      * @group gitlabHttpPort
-     * @dataProvider dataForTestSupports
      */
+    #[DataProvider('dataForTestSupports')]
     public function testSupports(string $url, bool $expected): void
     {
         self::assertSame($expected, GitLabDriver::supports($this->io, $this->config, $url));
diff --git a/tests/Composer/Test/Repository/Vcs/HgDriverTest.php b/tests/Composer/Test/Repository/Vcs/HgDriverTest.php
index b4e912a..6810adb 100644
--- a/tests/Composer/Test/Repository/Vcs/HgDriverTest.php
+++ b/tests/Composer/Test/Repository/Vcs/HgDriverTest.php
@@ -16,6 +16,7 @@ use Composer\Repository\Vcs\HgDriver;
 use Composer\Test\TestCase;
 use Composer\Util\Filesystem;
 use Composer\Config;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class HgDriverTest extends TestCase
 {
@@ -45,9 +46,7 @@ class HgDriverTest extends TestCase
         $fs->removeDirectory($this->home);
     }
 
-    /**
-     * @dataProvider supportsDataProvider
-     */
+    #[DataProvider('supportsDataProvider')]
     public function testSupports(string $repositoryUrl): void
     {
         self::assertTrue(
diff --git a/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php b/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php
index 357a544..6b7df2f 100644
--- a/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php
+++ b/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php
@@ -18,6 +18,7 @@ use Composer\Util\Filesystem;
 use Composer\Config;
 use Composer\Util\Perforce;
 use Composer\Test\Mock\ProcessExecutorMock;
+use PHPUnit\Framework\Attributes\Depends;
 
 /**
  * @author Matt Whittom <Matt.Whittom@veteransunited.com>
@@ -146,29 +147,25 @@ class PerforceDriverTest extends TestCase
         $this->driver->initialize();
     }
 
-    /**
-     * @depends testInitializeCapturesVariablesFromRepoConfig
-     * @depends testInitializeLogsInAndConnectsClient
-     */
+    #[Depends('testInitializeCapturesVariablesFromRepoConfig')]
+    #[Depends('testInitializeLogsInAndConnectsClient')]
     public function testHasComposerFileReturnsFalseOnNoComposerFile(): void
     {
         $identifier = 'TEST_IDENTIFIER';
         $formatted_depot_path = '//' . self::TEST_DEPOT . '/' . $identifier;
-        $this->perforce->expects($this->any())->method('getComposerInformation')->with($this->equalTo($formatted_depot_path))->will($this->returnValue([]));
+        $this->perforce->expects($this->any())->method('getComposerInformation')->with($this->equalTo($formatted_depot_path))->willReturn([]);
         $this->driver->initialize();
         $result = $this->driver->hasComposerFile($identifier);
         self::assertFalse($result);
     }
 
-    /**
-     * @depends testInitializeCapturesVariablesFromRepoConfig
-     * @depends testInitializeLogsInAndConnectsClient
-     */
+    #[Depends('testInitializeCapturesVariablesFromRepoConfig')]
+    #[Depends('testInitializeLogsInAndConnectsClient')]
     public function testHasComposerFileReturnsTrueWithOneOrMoreComposerFiles(): void
     {
         $identifier = 'TEST_IDENTIFIER';
         $formatted_depot_path = '//' . self::TEST_DEPOT . '/' . $identifier;
-        $this->perforce->expects($this->any())->method('getComposerInformation')->with($this->equalTo($formatted_depot_path))->will($this->returnValue(['']));
+        $this->perforce->expects($this->any())->method('getComposerInformation')->with($this->equalTo($formatted_depot_path))->willReturn(['']);
         $this->driver->initialize();
         $result = $this->driver->hasComposerFile($identifier);
         self::assertTrue($result);
diff --git a/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php b/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php
index 7e0b72b..026a93f 100644
--- a/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php
+++ b/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php
@@ -17,6 +17,7 @@ use Composer\Config;
 use Composer\Test\TestCase;
 use Composer\Util\Filesystem;
 use Composer\Util\ProcessExecutor;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class SvnDriverTest extends TestCase
 {
@@ -89,9 +90,7 @@ class SvnDriverTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider supportProvider
-     */
+    #[DataProvider('supportProvider')]
     public function testSupport(string $url, bool $assertion): void
     {
         $config = new Config();
diff --git a/tests/Composer/Test/Util/AuthHelperTest.php b/tests/Composer/Test/Util/AuthHelperTest.php
index 0be5594..2d5a75c 100644
--- a/tests/Composer/Test/Util/AuthHelperTest.php
+++ b/tests/Composer/Test/Util/AuthHelperTest.php
@@ -16,6 +16,7 @@ use Composer\IO\IOInterface;
 use Composer\Test\TestCase;
 use Composer\Util\AuthHelper;
 use Composer\Util\Bitbucket;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 /**
  * @author Michael Chekin <mchekin@gmail.com>
@@ -153,9 +154,7 @@ class AuthHelperTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider gitlabPrivateTokenProvider
-     */
+    #[DataProvider('gitlabPrivateTokenProvider')]
     public function testAddAuthenticationHeaderWithGitlabPrivateToken(string $password): void
     {
         $headers = [
@@ -228,9 +227,7 @@ class AuthHelperTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider bitbucketPublicUrlProvider
-     */
+    #[DataProvider('bitbucketPublicUrlProvider')]
     public function testAddAuthenticationHeaderWithBitbucketPublicUrl(string $url): void
     {
         $headers = [
@@ -287,12 +284,11 @@ class AuthHelperTest extends TestCase
     }
 
     /**
-     * @dataProvider basicHttpAuthenticationProvider
-     *
      * @param array<string, string|null>                                  $auth
      *
      * @phpstan-param array{username: string|null, password: string|null} $auth
      */
+    #[DataProvider('basicHttpAuthenticationProvider')]
     public function testAddAuthenticationHeaderWithBasicHttpAuthentication(string $url, string $origin, array $auth): void
     {
         $headers = [
@@ -326,9 +322,7 @@ class AuthHelperTest extends TestCase
         );
     }
 
-    /**
-     * @dataProvider bitbucketPublicUrlProvider
-     */
+    #[DataProvider('bitbucketPublicUrlProvider')]
     public function testIsPublicBitBucketDownloadWithBitbucketPublicUrl(string $url): void
     {
         self::assertTrue($this->authHelper->isPublicBitBucketDownload($url));
diff --git a/tests/Composer/Test/Util/BitbucketTest.php b/tests/Composer/Test/Util/BitbucketTest.php
index 8b977e5..0c627bc 100644
--- a/tests/Composer/Test/Util/BitbucketTest.php
+++ b/tests/Composer/Test/Util/BitbucketTest.php
@@ -16,6 +16,7 @@ use Composer\Test\Mock\IOMock;
 use Composer\Util\Bitbucket;
 use Composer\Util\Http\Response;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\Depends;
 
 /**
  * @author Paul Wenke <wenke.paul@gmail.com>
@@ -421,9 +422,7 @@ class BitbucketTest extends TestCase
         self::assertSame('', $this->bitbucket->getToken());
     }
 
-    /**
-     * @depends testRequestAccessTokenWithValidOAuthConsumerAndValidStoredAccessToken
-     */
+    #[Depends('testRequestAccessTokenWithValidOAuthConsumerAndValidStoredAccessToken')]
     public function testGetTokenWithAccessToken(Bitbucket $bitbucket): void
     {
         self::assertSame($this->token, $bitbucket->getToken());
diff --git a/tests/Composer/Test/Util/ErrorHandlerTest.php b/tests/Composer/Test/Util/ErrorHandlerTest.php
index ae89d83..28287b6 100644
--- a/tests/Composer/Test/Util/ErrorHandlerTest.php
+++ b/tests/Composer/Test/Util/ErrorHandlerTest.php
@@ -14,6 +14,7 @@ namespace Composer\Test\Util;
 
 use Composer\Util\ErrorHandler;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
 
 /**
  * ErrorHandler test case
@@ -68,8 +69,8 @@ class ErrorHandlerTest extends TestCase
 
     /**
      * Test ErrorHandler handles warnings
-     * @doesNotPerformAssertions
      */
+    #[DoesNotPerformAssertions]
     public function testErrorHandlerRespectsAtOperator(): void
     {
         @trigger_error('test', E_USER_NOTICE);
diff --git a/tests/Composer/Test/Util/FilesystemTest.php b/tests/Composer/Test/Util/FilesystemTest.php
index e947e4f..4b110ae 100644
--- a/tests/Composer/Test/Util/FilesystemTest.php
+++ b/tests/Composer/Test/Util/FilesystemTest.php
@@ -15,6 +15,7 @@ namespace Composer\Test\Util;
 use Composer\Util\Platform;
 use Composer\Util\Filesystem;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class FilesystemTest extends TestCase
 {
@@ -51,9 +52,7 @@ class FilesystemTest extends TestCase
         }
     }
 
-    /**
-     * @dataProvider providePathCouplesAsCode
-     */
+    #[DataProvider('providePathCouplesAsCode')]
     public function testFindShortestPathCode(string $a, string $b, bool $directory, string $expected, bool $static = false, bool $preferRelative = false): void
     {
         $fs = new Filesystem;
@@ -111,9 +110,7 @@ class FilesystemTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider providePathCouples
-     */
+    #[DataProvider('providePathCouples')]
     public function testFindShortestPath(string $a, string $b, string $expected, bool $directory = false, bool $preferRelative = false): void
     {
         $fs = new Filesystem;
@@ -195,9 +192,7 @@ class FilesystemTest extends TestCase
         self::assertGreaterThanOrEqual(10, $fs->size($this->workingDir));
     }
 
-    /**
-     * @dataProvider provideNormalizedPaths
-     */
+    #[DataProvider('provideNormalizedPaths')]
     public function testNormalizePath(string $expected, string $actual): void
     {
         $fs = new Filesystem;
diff --git a/tests/Composer/Test/Util/GitTest.php b/tests/Composer/Test/Util/GitTest.php
index 9893645..0db040c 100644
--- a/tests/Composer/Test/Util/GitTest.php
+++ b/tests/Composer/Test/Util/GitTest.php
@@ -19,6 +19,7 @@ use Composer\Util\Filesystem;
 use Composer\Util\Git;
 use Composer\Test\Mock\ProcessExecutorMock;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class GitTest extends TestCase
 {
@@ -42,9 +43,7 @@ class GitTest extends TestCase
         $this->git = new Git($this->io, $this->config, $this->process, $this->fs);
     }
 
-    /**
-     * @dataProvider publicGithubNoCredentialsProvider
-     */
+    #[DataProvider('publicGithubNoCredentialsProvider')]
     public function testRunCommandPublicGitHubRepositoryNotInitialClone(string $protocol, string $expectedUrl): void
     {
         $commandCallable = function ($url) use ($expectedUrl): string {
@@ -90,9 +89,7 @@ class GitTest extends TestCase
         $this->git->runCommand($commandCallable, 'https://github.com/acme/repo', null, true);
     }
 
-    /**
-     * @dataProvider privateGithubWithCredentialsProvider
-     */
+    #[DataProvider('privateGithubWithCredentialsProvider')]
     public function testRunCommandPrivateGitHubRepositoryNotInitialCloneNotInteractiveWithAuthentication(string $gitUrl, string $protocol, string $gitHubToken, string $expectedUrl, int $expectedFailuresBeforeSuccess): void
     {
         $commandCallable = static function ($url) use ($expectedUrl): string {
@@ -130,9 +127,7 @@ class GitTest extends TestCase
         $this->git->runCommand($commandCallable, $gitUrl, null, true);
     }
 
-    /**
-     * @dataProvider privateBitbucketWithCredentialsProvider
-     */
+    #[DataProvider('privateBitbucketWithCredentialsProvider')]
     public function testRunCommandPrivateBitbucketRepositoryNotInitialCloneNotInteractiveWithAuthentication(string $gitUrl, ?string $bitbucketToken, string $expectedUrl, int $expectedFailuresBeforeSuccess, int $bitbucket_git_auth_calls = 0): void
     {
         $commandCallable = static function ($url) use ($expectedUrl): string {
@@ -185,12 +180,11 @@ class GitTest extends TestCase
     }
 
     /**
-     * @dataProvider privateBitbucketWithOauthProvider
-     *
      * @param string $gitUrl
      * @param string $expectedUrl
      * @param array{'username': string, 'password': string}[] $initial_config
      */
+    #[DataProvider('privateBitbucketWithOauthProvider')]
     public function testRunCommandPrivateBitbucketRepositoryNotInitialCloneInteractiveWithOauth(string $gitUrl, string $expectedUrl, array $initial_config = []): void
     {
         $commandCallable = static function ($url) use ($expectedUrl): string {
diff --git a/tests/Composer/Test/Util/Http/ProxyItemTest.php b/tests/Composer/Test/Util/Http/ProxyItemTest.php
index ccca76e..de27fad 100644
--- a/tests/Composer/Test/Util/Http/ProxyItemTest.php
+++ b/tests/Composer/Test/Util/Http/ProxyItemTest.php
@@ -14,12 +14,11 @@ namespace Composer\Test\Util\Http;
 
 use Composer\Util\Http\ProxyItem;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class ProxyItemTest extends TestCase
 {
-    /**
-     * @dataProvider dataMalformed
-     */
+    #[DataProvider('dataMalformed')]
     public function testThrowsOnMalformedUrl(string $url): void
     {
         self::expectException('RuntimeException');
@@ -42,9 +41,7 @@ class ProxyItemTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider dataFormatting
-     */
+    #[DataProvider('dataFormatting')]
     public function testUrlFormatting(string $url, string $expected): void
     {
         $proxyItem = new ProxyItem($url, 'http_proxy');
diff --git a/tests/Composer/Test/Util/Http/ProxyManagerTest.php b/tests/Composer/Test/Util/Http/ProxyManagerTest.php
index 04c756b..a9e140c 100644
--- a/tests/Composer/Test/Util/Http/ProxyManagerTest.php
+++ b/tests/Composer/Test/Util/Http/ProxyManagerTest.php
@@ -14,6 +14,7 @@ namespace Composer\Test\Util\Http;
 
 use Composer\Util\Http\ProxyManager;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 /**
  * @phpstan-import-type contextOptions from \Composer\Util\Http\RequestProxy
@@ -72,11 +73,10 @@ class ProxyManagerTest extends TestCase
     }
 
     /**
-     * @dataProvider dataCaseOverrides
-     *
      * @param array<string, string> $server
      * @param non-empty-string      $url
      */
+    #[DataProvider('dataCaseOverrides')]
     public function testLowercaseOverridesUppercase(array $server, string $url, string $expectedUrl): void
     {
         $_SERVER = array_merge($_SERVER, $server);
@@ -100,10 +100,9 @@ class ProxyManagerTest extends TestCase
     }
 
     /**
-     * @dataProvider dataCGIProxy
-     *
      * @param array<string, string> $server
      */
+    #[DataProvider('dataCGIProxy')]
     public function testCGIProxyIsOnlyUsedWhenNoHttpProxy(array $server, string $expectedUrl): void
     {
         $_SERVER = array_merge($_SERVER, $server);
@@ -144,12 +143,11 @@ class ProxyManagerTest extends TestCase
     }
 
     /**
-     * @dataProvider dataRequest
-     *
      * @param array<string, string> $server
      * @param non-empty-string      $url
      * @param ?contextOptions       $options
      */
+    #[DataProvider('dataRequest')]
     public function testGetProxyForRequest(array $server, string $url, ?array $options, string $status, bool $excluded): void
     {
         $_SERVER = array_merge($_SERVER, $server);
diff --git a/tests/Composer/Test/Util/Http/RequestProxyTest.php b/tests/Composer/Test/Util/Http/RequestProxyTest.php
index c019485..9cf736d 100644
--- a/tests/Composer/Test/Util/Http/RequestProxyTest.php
+++ b/tests/Composer/Test/Util/Http/RequestProxyTest.php
@@ -14,6 +14,7 @@ namespace Composer\Test\Util\Http;
 
 use Composer\Util\Http\RequestProxy;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class RequestProxyTest extends TestCase
 {
@@ -38,10 +39,9 @@ class RequestProxyTest extends TestCase
     }
 
     /**
-     * @dataProvider dataSecure
-     *
      * @param ?non-empty-string $url
      */
+    #[DataProvider('dataSecure')]
     public function testIsSecure(?string $url, bool $expected): void
     {
         $proxy = new RequestProxy($url, null, null, null);
@@ -69,10 +69,9 @@ class RequestProxyTest extends TestCase
     }
 
     /**
-     * @dataProvider dataStatus
-     *
      * @param ?non-empty-string $url
      */
+    #[DataProvider('dataStatus')]
     public function testGetStatus(?string $url, ?string $format, string $expected): void
     {
         $proxy = new RequestProxy($url, null, null, $url);
@@ -105,12 +104,12 @@ class RequestProxyTest extends TestCase
      * This test avoids HTTPS proxies so that it can be run on PHP < 7.3
      *
      * @requires extension curl
-     * @dataProvider dataCurlOptions
      *
      * @param ?non-empty-string $url
      * @param ?non-empty-string $auth
      * @param array<int, string|int> $expected
      */
+    #[DataProvider('dataCurlOptions')]
     public function testGetCurlOptions(?string $url, ?string $auth, array $expected): void
     {
         $proxy = new RequestProxy($url, $auth, null, null);
@@ -145,13 +144,13 @@ class RequestProxyTest extends TestCase
     /**
      * @requires PHP >= 7.3.0
      * @requires extension curl >= 7.52.0
-     * @dataProvider dataCurlSSLOptions
      *
      * @param non-empty-string $url
      * @param ?non-empty-string $auth
      * @param array<string, string> $sslOptions
      * @param array<int, string|int> $expected
      */
+    #[DataProvider('dataCurlSSLOptions')]
     public function testGetCurlOptionsWithSSL(string $url, ?string $auth, array $sslOptions, array $expected): void
     {
         $proxy = new RequestProxy($url, $auth, null, null);
diff --git a/tests/Composer/Test/Util/HttpDownloaderTest.php b/tests/Composer/Test/Util/HttpDownloaderTest.php
index aa550b5..927a0d7 100644
--- a/tests/Composer/Test/Util/HttpDownloaderTest.php
+++ b/tests/Composer/Test/Util/HttpDownloaderTest.php
@@ -26,11 +26,11 @@ class HttpDownloaderTest extends TestCase
         $config = $this->getMockBuilder('Composer\Config')->getMock();
         $config->expects($this->any())
             ->method('get')
-            ->will($this->returnCallback(static function ($key) {
+            ->willReturnCallback(static function ($key) {
                 if ($key === 'github-domains' || $key === 'gitlab-domains') {
                     return [];
                 }
-            }));
+            });
 
         return $config;
     }
diff --git a/tests/Composer/Test/Util/NoProxyPatternTest.php b/tests/Composer/Test/Util/NoProxyPatternTest.php
index 6e63911..186af50 100644
--- a/tests/Composer/Test/Util/NoProxyPatternTest.php
+++ b/tests/Composer/Test/Util/NoProxyPatternTest.php
@@ -14,12 +14,11 @@ namespace Composer\Test\Util;
 
 use Composer\Util\NoProxyPattern;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class NoProxyPatternTest extends TestCase
 {
-    /**
-     * @dataProvider dataHostName
-     */
+    #[DataProvider('dataHostName')]
     public function testHostName(string $noproxy, string $url, bool $expected): void
     {
         $matcher = new NoProxyPattern($noproxy);
@@ -44,9 +43,7 @@ class NoProxyPatternTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider dataIpAddress
-     */
+    #[DataProvider('dataIpAddress')]
     public function testIpAddress(string $noproxy, string $url, bool $expected): void
     {
         $matcher = new NoProxyPattern($noproxy);
@@ -69,9 +66,7 @@ class NoProxyPatternTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider dataIpRange
-     */
+    #[DataProvider('dataIpRange')]
     public function testIpRange(string $noproxy, string $url, bool $expected): void
     {
         $matcher = new NoProxyPattern($noproxy);
@@ -94,9 +89,7 @@ class NoProxyPatternTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider dataPort
-     */
+    #[DataProvider('dataPort')]
     public function testPort(string $noproxy, string $url, bool $expected): void
     {
         $matcher = new NoProxyPattern($noproxy);
diff --git a/tests/Composer/Test/Util/PackageSorterTest.php b/tests/Composer/Test/Util/PackageSorterTest.php
index 34a6692..c052548 100644
--- a/tests/Composer/Test/Util/PackageSorterTest.php
+++ b/tests/Composer/Test/Util/PackageSorterTest.php
@@ -17,6 +17,7 @@ use Composer\Package\Package;
 use Composer\Test\TestCase;
 use Composer\Util\PackageSorter;
 use Composer\Semver\Constraint\MatchAllConstraint;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class PackageSorterTest extends TestCase
 {
@@ -148,12 +149,11 @@ class PackageSorterTest extends TestCase
     }
 
     /**
-     * @dataProvider sortingOrdersDependenciesHigherThanPackageDataProvider
-     *
      * @param Package[] $packages
      * @param string[]  $expectedOrderedList
      * @param array<string, int> $weights
      */
+    #[DataProvider('sortingOrdersDependenciesHigherThanPackageDataProvider')]
     public function testSortingOrdersDependenciesHigherThanPackage(array $packages, array $expectedOrderedList, array $weights = []): void
     {
         $sortedPackages = PackageSorter::sortPackages($packages, $weights);
diff --git a/tests/Composer/Test/Util/ProcessExecutorTest.php b/tests/Composer/Test/Util/ProcessExecutorTest.php
index 006f232..28aca39 100644
--- a/tests/Composer/Test/Util/ProcessExecutorTest.php
+++ b/tests/Composer/Test/Util/ProcessExecutorTest.php
@@ -16,6 +16,7 @@ use Composer\IO\ConsoleIO;
 use Composer\Util\ProcessExecutor;
 use Composer\Test\TestCase;
 use Composer\IO\BufferIO;
+use PHPUnit\Framework\Attributes\DataProvider;
 use React\Promise\Promise;
 use Symfony\Component\Console\Helper\HelperSet;
 use Symfony\Component\Console\Input\ArrayInput;
@@ -67,9 +68,7 @@ class ProcessExecutorTest extends TestCase
         ProcessExecutor::setTimeout(60);
     }
 
-    /**
-     * @dataProvider hidePasswordProvider
-     */
+    #[DataProvider('hidePasswordProvider')]
     public function testHidePasswords(string $command, string $expectedCommandOutput): void
     {
         $process = new ProcessExecutor($buffer = new BufferIO('', StreamOutput::VERBOSITY_DEBUG));
@@ -132,10 +131,9 @@ class ProcessExecutorTest extends TestCase
     /**
      * Test various arguments are escaped as expected
      *
-     * @dataProvider dataEscapeArguments
-     *
      * @param string|false|null $argument
      */
+    #[DataProvider('dataEscapeArguments')]
     public function testEscapeArgument($argument, string $win, string $unix): void
     {
         $expected = defined('PHP_WINDOWS_VERSION_BUILD') ? $win : $unix;
diff --git a/tests/Composer/Test/Util/RemoteFilesystemTest.php b/tests/Composer/Test/Util/RemoteFilesystemTest.php
index d0e2133..88fab49 100644
--- a/tests/Composer/Test/Util/RemoteFilesystemTest.php
+++ b/tests/Composer/Test/Util/RemoteFilesystemTest.php
@@ -18,6 +18,8 @@ use Composer\IO\IOInterface;
 use Composer\Util\AuthHelper;
 use Composer\Util\RemoteFilesystem;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
 use PHPUnit\Framework\Attributes\Group;
 use PHPUnit\Framework\MockObject\MockObject;
 use ReflectionMethod;
@@ -145,9 +147,7 @@ class RemoteFilesystemTest extends TestCase
         self::assertAttributeEqualsCustom(50, 'lastProgress', $fs);
     }
 
-    /**
-     * @doesNotPerformAssertions
-     */
+    #[DoesNotPerformAssertions]
     public function testCallbackGetPassesThrough404(): void
     {
         $fs = new RemoteFilesystem($this->getIOInterfaceMock(), $this->getConfigMock());
@@ -278,10 +278,10 @@ class RemoteFilesystemTest extends TestCase
     /**
      * Tests that a BitBucket public download is correctly retrieved.
      *
-     * @dataProvider provideBitbucketPublicDownloadUrls
      * @param non-empty-string $url
      * @requires PHP 7.4.17
      */
+    #[DataProvider('provideBitbucketPublicDownloadUrls')]
     #[Group('remote')]
     public function testBitBucketPublicDownload(string $url, string $contents): void
     {
diff --git a/tests/Composer/Test/Util/StreamContextFactoryTest.php b/tests/Composer/Test/Util/StreamContextFactoryTest.php
index bb89cef..0104865 100644
--- a/tests/Composer/Test/Util/StreamContextFactoryTest.php
+++ b/tests/Composer/Test/Util/StreamContextFactoryTest.php
@@ -15,6 +15,7 @@ namespace Composer\Test\Util;
 use Composer\Util\Http\ProxyManager;
 use Composer\Util\StreamContextFactory;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class StreamContextFactoryTest extends TestCase
 {
@@ -32,13 +33,12 @@ class StreamContextFactoryTest extends TestCase
     }
 
     /**
-     * @dataProvider dataGetContext
-     *
      * @param mixed[] $expectedOptions
      * @param mixed[] $defaultOptions
      * @param mixed[] $expectedParams
      * @param mixed[] $defaultParams
      */
+    #[DataProvider('dataGetContext')]
     public function testGetContext(array $expectedOptions, array $defaultOptions, array $expectedParams, array $defaultParams): void
     {
         $context = StreamContextFactory::getContext('http://example.org', $defaultOptions, $defaultParams);
@@ -161,9 +161,7 @@ class StreamContextFactoryTest extends TestCase
         $context = StreamContextFactory::getContext('https://example.org', ['http' => ['method' => 'GET', 'header' => 'User-Agent: foo']]);
     }
 
-    /**
-     * @dataProvider dataSSLProxy
-     */
+    #[DataProvider('dataSSLProxy')]
     public function testSSLProxy(string $expected, string $proxy): void
     {
         $_SERVER['http_proxy'] = $proxy;
diff --git a/tests/Composer/Test/Util/SvnTest.php b/tests/Composer/Test/Util/SvnTest.php
index b17f722..867fe24 100644
--- a/tests/Composer/Test/Util/SvnTest.php
+++ b/tests/Composer/Test/Util/SvnTest.php
@@ -16,6 +16,7 @@ use Composer\Config;
 use Composer\IO\NullIO;
 use Composer\Util\Svn;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class SvnTest extends TestCase
 {
@@ -24,9 +25,8 @@ class SvnTest extends TestCase
      *
      * @param string $url    The SVN url.
      * @param non-empty-list<string> $expect The expectation for the test.
-     *
-     * @dataProvider urlProvider
      */
+    #[DataProvider('urlProvider')]
     public function testCredentials(string $url, array $expect): void
     {
         $svn = new Svn($url, new NullIO, new Config());
diff --git a/tests/Composer/Test/Util/TlsHelperTest.php b/tests/Composer/Test/Util/TlsHelperTest.php
index 64c0c4c..c4b4b53 100644
--- a/tests/Composer/Test/Util/TlsHelperTest.php
+++ b/tests/Composer/Test/Util/TlsHelperTest.php
@@ -14,14 +14,14 @@ namespace Composer\Test\Util;
 
 use Composer\Util\TlsHelper;
 use Composer\Test\TestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class TlsHelperTest extends TestCase
 {
     /**
-     * @dataProvider dataCheckCertificateHost
-     *
      * @param string[] $certNames
      */
+    #[DataProvider('dataCheckCertificateHost')]
     public function testCheckCertificateHost(bool $expectedResult, string $hostname, array $certNames): void
     {
         $certificate['subject']['commonName'] = $expectedCn = array_shift($certNames);
diff --git a/tests/Composer/Test/Util/UrlTest.php b/tests/Composer/Test/Util/UrlTest.php
index 0416790..5d55dfa 100644
--- a/tests/Composer/Test/Util/UrlTest.php
+++ b/tests/Composer/Test/Util/UrlTest.php
@@ -15,15 +15,15 @@ namespace Composer\Test\Util;
 use Composer\Util\Url;
 use Composer\Test\TestCase;
 use Composer\Config;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 class UrlTest extends TestCase
 {
     /**
-     * @dataProvider distRefsProvider
-     *
      * @param array<string, mixed> $conf
      * @param non-empty-string $url
      */
+    #[DataProvider('distRefsProvider')]
     public function testUpdateDistReference(string $url, string $expectedUrl, array $conf = [], string $ref = 'newref'): void
     {
         $config = new Config();
@@ -62,9 +62,7 @@ class UrlTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider sanitizeProvider
-     */
+    #[DataProvider('sanitizeProvider')]
     public function testSanitize(string $expected, string $url): void
     {
         self::assertSame($expected, Url::sanitize($url));
