function DrupalAutoloader::loadAndCatchErrors
1 call to DrupalAutoloader::loadAndCatchErrors()
- DrupalAutoloader::register in vendor/
mglaman/ phpstan-drupal/ src/ Drupal/ DrupalAutoloader.php
File
-
vendor/
mglaman/ phpstan-drupal/ src/ Drupal/ DrupalAutoloader.php, line 359
Class
Namespace
mglaman\PHPStanDrupal\DrupalCode
protected function loadAndCatchErrors(string $path) : void {
try {
require_once $path;
} catch (ContainerNotInitializedException $e) {
$path = str_replace(dirname($this->drupalRoot) . '/', '', $path);
// This can happen when drupal_get_path or drupal_get_filename are used outside the scope of a function.
@trigger_error("{$path} invoked the Drupal container outside of the scope of a function or class method. It was not loaded.", E_USER_WARNING);
} catch (Throwable $e) {
$path = str_replace(dirname($this->drupalRoot) . '/', '', $path);
// Something prevented the extension file from loading.
@trigger_error("{$path} failed loading due to {$e->getMessage()}", E_USER_WARNING);
}
}