From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Sat, 30 Aug 2025 11:26:51 +0200
Subject: Use RequiresPhpunit for tests failing with PHPUnit 12

---
 tests/ExportClosureTest.php | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/ExportClosureTest.php b/tests/ExportClosureTest.php
index 67e4e05..a953a44 100644
--- a/tests/ExportClosureTest.php
+++ b/tests/ExportClosureTest.php
@@ -9,6 +9,7 @@ use Brick\VarExporter\Tests\Classes\NoProperties;
 use Brick\VarExporter\Tests\Classes\PublicPropertiesOnly;
 use Brick\VarExporter\Tests\Classes\SetState;
 use Brick\VarExporter\VarExporter;
+use PHPUnit\Framework\Attributes\RequiresPhpunit;
 
 /**
  * The function & the const below do not exist, but their namespace should be taken into account by the exporter.
@@ -21,6 +22,7 @@ use const Brick\VarExporter\Dummy\Constants\IMPORTED_CONSTANT;
  */
 class ExportClosureTest extends AbstractTestCase
 {
+    #[RequiresPhpunit('< 12')]
     public function testExportSimpleClosure(): void
     {
         $var = function() {
@@ -36,6 +38,7 @@ class ExportClosureTest extends AbstractTestCase
         $this->assertExportEquals($expected, $var);
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testExportNestedComplexClosure(): void
     {
         $var = [
@@ -77,6 +80,7 @@ class ExportClosureTest extends AbstractTestCase
         $this->assertExportEquals($expected, $var);
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testExportNamespacedCode(): void
     {
         $var = function(SetState $a) : array {
@@ -105,6 +109,7 @@ class ExportClosureTest extends AbstractTestCase
         $this->assertExportEquals($expected, $var);
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testExportClosureWithStringsContainingLikeBreaks(): void
     {
         $var = function() {
@@ -159,6 +164,7 @@ World!';
         );
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testExportClosureWithUseAsVars(): void
     {
         $foo = 'b' . 'a' . 'r';
@@ -178,6 +184,7 @@ World!';
         $this->assertExportEquals($expected, $var, VarExporter::ADD_RETURN | VarExporter::CLOSURE_SNAPSHOT_USES);
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testExportClosureWithUseClosure(): void
     {
         $foo = 'b' . 'a' . 'r';
@@ -204,6 +211,7 @@ World!';
         $this->assertExportEquals($expected, $var, VarExporter::ADD_RETURN | VarExporter::CLOSURE_SNAPSHOT_USES);
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testExportArrowFunction(): void
     {
         $var = [fn ($planet) => 'hello ' . $planet]; // Wrapping in array for valid syntax PHP <7.4
@@ -233,6 +241,7 @@ World!';
         );
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testExportArrowFunctionWithContextVarAsVar(): void
     {
         $greet = 'hello';
@@ -252,6 +261,7 @@ World!';
         $this->assertExportEquals($expected, $var, VarExporter::ADD_RETURN | VarExporter::CLOSURE_SNAPSHOT_USES);
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testExportEnumMatchFunction(): void
     {
         $var = [
