diff --git a/core/lib/Drupal/Core/Extension/InfoParserDynamic.php b/core/lib/Drupal/Core/Extension/InfoParserDynamic.php index bcdb294f2c0973ab71a4ab3de2f1ad3ba08354d9..55c6ddd953ee32d961ad1d5610c555b566d7ab96 100644 --- a/core/lib/Drupal/Core/Extension/InfoParserDynamic.php +++ b/core/lib/Drupal/Core/Extension/InfoParserDynamic.php @@ -26,8 +26,7 @@ class InfoParserDynamic implements InfoParserInterface { */ public function __construct(string $app_root = NULL) { if ($app_root === NULL) { - // @todo https://www.drupal.org/project/drupal/issues/3087975 Require - // $app_root argument. + @trigger_error('Calling InfoParserDynamic::__construct() without the $app_root argument is deprecated in drupal:10.1.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3293709', E_USER_DEPRECATED); $app_root = \Drupal::hasService('kernel') ? \Drupal::root() : DRUPAL_ROOT; } $this->root = $app_root; diff --git a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php index a7dad625b6d78eaea317d1e523876c355bc5ddb4..1e03986aa878e2913c304e6910ed24fbd3d17894 100644 --- a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php @@ -4,6 +4,7 @@ use Drupal\Core\Extension\ExtensionLifecycle; use Drupal\Core\Extension\InfoParser; +use Drupal\Core\Extension\InfoParserDynamic; use Drupal\Core\Extension\InfoParserException; use Drupal\Tests\UnitTestCase; use org\bovigo\vfs\vfsStream; @@ -560,4 +561,12 @@ public function providerLifecycleLink() { ]; } + /** + * @group legacy + */ + public function testDeprecation(): void { + $this->expectDeprecation('Calling InfoParserDynamic::__construct() without the $app_root argument is deprecated in drupal:10.1.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3293709'); + new InfoParserDynamic(); + } + }