classLoader, 'prod'); $kernel->boot(); $kernel->preHandle($request); // Cancel Drupal error handler to get all errors in STDOUT. \restore_error_handler(); \error_reporting(\E_ALL); return $kernel->getContainer(); } /** * Asserts Drupal instance. * * @throws \RuntimeException */ private static function assertInstallation(): void { $preflight = \defined('Drupal::VERSION') && \version_compare(\Drupal::VERSION, '10.0.0-dev', '>=') && \class_exists(InstalledVersions::class) && \class_exists(Request::class) && \class_exists(DrupalKernel::class); if (!$preflight) { throw new \RuntimeException('Could not load Drupal.'); } } }