From: Ruud Kamphuis <ruudk@users.noreply.github.com>
Date: Mon, 25 Nov 2024 11:50:28 +0100
Subject: [Twig 4] Add PHPUnit as dev dependency

Origin: backport, https://github.com/twigphp/twig/commit/c352a8d283bdf39e1b6bcc31e1a9be0bcfc82cb1
---
 composer.json                                 |  4 ++--
 tests/DeprecatedCallableInfoTest.php          |  5 ++---
 tests/LexerTest.php                           | 12 +++---------
 tests/Util/CallableArgumentsExtractorTest.php |  5 ++---
 4 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/composer.json b/composer.json
index 3662366..1962434 100644
--- a/composer.json
+++ b/composer.json
@@ -5,7 +5,6 @@
     "keywords": ["templating"],
     "homepage": "https://twig.symfony.com",
     "license": "BSD-3-Clause",
-    "minimum-stability": "dev",
     "authors": [
         {
             "name": "Fabien Potencier",
@@ -32,7 +31,8 @@
     "require-dev": {
         "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0",
         "psr/container": "^1.0|^2.0",
-        "phpstan/phpstan": "^2.0"
+        "phpstan/phpstan": "^2.0",
+        "phpunit/phpunit": "^11.4"
     },
     "autoload": {
         "files": [
diff --git a/tests/DeprecatedCallableInfoTest.php b/tests/DeprecatedCallableInfoTest.php
index 454d826..f30cc2e 100644
--- a/tests/DeprecatedCallableInfoTest.php
+++ b/tests/DeprecatedCallableInfoTest.php
@@ -11,14 +11,13 @@ namespace Twig\Tests;
  * file that was distributed with this source code.
  */
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Twig\DeprecatedCallableInfo;
 
 class DeprecatedCallableInfoTest extends TestCase
 {
-    /**
-     * @dataProvider provideTestsForTriggerDeprecation
-     */
+    #[DataProvider('provideTestsForTriggerDeprecation')]
     public function testTriggerDeprecation($expected, DeprecatedCallableInfo $info)
     {
         $info->setType('function');
diff --git a/tests/LexerTest.php b/tests/LexerTest.php
index 839f156..a22a2fb 100644
--- a/tests/LexerTest.php
+++ b/tests/LexerTest.php
@@ -530,9 +530,7 @@ bar
         $this->assertTrue($stream->isEOF());
     }
 
-    /**
-     * @dataProvider getTemplateForInlineCommentsForVariable
-     */
+    #[DataProvider('getTemplateForInlineCommentsForVariable')]
     public function testInlineCommentForVariable(string $template)
     {
         $lexer = new Lexer(new Environment(new ArrayLoader()));
@@ -563,9 +561,7 @@ bar
         }}'];
     }
 
-    /**
-     * @dataProvider getTemplateForInlineCommentsForBlock
-     */
+    #[DataProvider('getTemplateForInlineCommentsForBlock')]
     public function testInlineCommentForBlock(string $template)
     {
         $lexer = new Lexer(new Environment(new ArrayLoader()));
@@ -601,9 +597,7 @@ bar
         %}me{% endif %}'];
     }
 
-    /**
-     * @dataProvider getTemplateForInlineCommentsForComment
-     */
+    #[DataProvider('getTemplateForInlineCommentsForComment')]
     public function testInlineCommentForComment(string $template)
     {
         $lexer = new Lexer(new Environment(new ArrayLoader()));
diff --git a/tests/Util/CallableArgumentsExtractorTest.php b/tests/Util/CallableArgumentsExtractorTest.php
index a06e19a..25e91c6 100644
--- a/tests/Util/CallableArgumentsExtractorTest.php
+++ b/tests/Util/CallableArgumentsExtractorTest.php
@@ -11,6 +11,7 @@ namespace Twig\Tests\Util;
  * file that was distributed with this source code.
  */
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
 use Twig\Error\SyntaxError;
@@ -86,9 +87,7 @@ class CallableArgumentsExtractorTest extends TestCase
         $this->assertEquals(['arg1'], $this->getArguments('custom_static_function', __CLASS__.'::customStaticFunction', ['arg1' => 'arg1']));
     }
 
-    /**
-     * @dataProvider getGetArgumentsConversionData
-     */
+    #[DataProvider('getGetArgumentsConversionData')]
     public function testGetArgumentsConversion($arg1, $arg2)
     {
         $this->assertEquals([null], $this->getArguments('custom', eval("return fn (\$$arg1) => '';"), [$arg1 => null]));
