Issue #3087975 by smustgrave, kim.pepper, alexpott, Wim Leers, longwave: Add deprecation to InfoParserDynamic::__construct() to require root path
parent
15744364dc
commit
55a120776d
|
@ -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;
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Drupal\Tests\Core\Extension;
|
|||
|
||||
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 @@ INFO;
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue