TestMissingDependency.php

Same filename and directory in other branches
  1. 11.x core/modules/system/tests/modules/router_test_directory/src/Controller/TestMissingDependency.php

Namespace

Drupal\router_test\Controller

File

core/modules/system/tests/modules/router_test_directory/src/Controller/TestMissingDependency.php

View source
<?php

declare (strict_types=1);
namespace Drupal\router_test\Controller;

use Drupal\a_module_that_does_not_exist\SomeController;
use Symfony\Component\Routing\Attribute\Route;

/**
 * A controller that declares a route but extends a class from a missing module.
 *
 * A missing parent class (rather than a missing trait) is used deliberately: it
 * is reported as a catchable error on all supported PHP versions, whereas a
 * missing trait only became catchable in PHP 8.5.
 */
class TestMissingDependency extends SomeController {
  
  /**
   * Builds something.
   *
   * @return array
   *   A render array.
   */
  public function build() : array {
    return [];
  }

}

Classes

Title Deprecated Summary
TestMissingDependency A controller that declares a route but extends a class from a missing module.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.