Skip to content

Instantly share code, notes, and snippets.

@dantleech
Last active February 16, 2023 01:18
Show Gist options
  • Save dantleech/84d82659583e55d0ffeb48d36d27a9fc to your computer and use it in GitHub Desktop.
Save dantleech/84d82659583e55d0ffeb48d36d27a9fc to your computer and use it in GitHub Desktop.
<?php
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\DrupalKernel;
$autoload = require __DIR__ . '/vendor/autoload.php';
$cwd = getcwd();
chdir('docroot');
$drupalKernel = DrupalKernel::createFromRequest(
Request::createFromGlobals(),
$autoload,
'dev',
true,
__DIR__
);
$drupalKernel->boot();
$drupalKernel->getContainer()->get('module_handler')->loadAll();
chdir($cwd);
return $autoload;
parameters:
bootstrap: ./drupal_phpstan_autoload.php
ignoreErrors:
- '#Function pager_.*#'
- ... ignore some other errors here, not _all_ functions are registered in the bootstrap
@Spudley
Copy link

Spudley commented Aug 30, 2018

I resolved the above by adding:

    autoload_directories:
        - %rootDir%/../../../web/modules/custom

to the parameters in phpstan.neon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment