Verified Commit 55a12077 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3087975 by smustgrave, kim.pepper, alexpott, Wim Leers, longwave: Add...

Issue #3087975 by smustgrave, kim.pepper, alexpott, Wim Leers, longwave: Add deprecation to InfoParserDynamic::__construct() to require root path
parent 15744364
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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;
+9 −0
Original line number Diff line number Diff line
@@ -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();
  }

}