Last active
October 21, 2021 21:22
Revisions
-
dantleech revised this gist
Mar 2, 2018 . 1 changed file with 0 additions and 4 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,3 @@ $drupalKernel->boot(); return $autoload; -
dantleech revised this gist
Mar 2, 2018 . 1 changed file with 14 additions and 6 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,30 @@ <?php use Drupal\Console\Core\Utils\DrupalFinder; use Drupal\Console\Bootstrap\DrupalKernel; use Symfony\Component\HttpFoundation\Request; $autoload = require_once __DIR__ . '/autoload.php'; $root = getcwd(); $drupalFinder = new DrupalFinder(); if (!$drupalFinder->locateRoot($root)) { die('DrupalConsole must be executed within a Drupal Site.'); } chdir($drupalFinder->getDrupalRoot()); $drupalKernel = DrupalKernel::createFromRequest( Request::createFromGlobals(), $autoload, 'prod', true, $drupalFinder->getDrupalRoot() ); $drupalKernel->boot(); return $autoload; $container = $drupal->boot(); return $autoload; -
dantleech revised this gist
Mar 2, 2018 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,11 @@ ``` $ composer require phpstan/phpstan ``` Drupal dynamically adds to the class autoloader at runtime, so it is necessary to bootstrap Drupal in order that it is fully populated. Note that this may require that the database be accessible (i.e. may be problematic when working with Docker). This is why we use a custom autoload file below. ``` $ ./bin/phpstan analyse --level=7 -c phpstan.neon docroot/modules/custom ``` -
dantleech revised this gist
Mar 2, 2018 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ Drupal dynamically adds to the class autoloader at runtime, so it is necessary to bootstrap Drupal in order that it is fully populated. Note that this may require that the database be accessible (i.e. may be problematic when working with Docker). This is why we use a custom autoload file below. ``` $ phpstan analyse --level=7 -c phpstan.neon docroot/modules/custom -
dantleech revised this gist
Mar 2, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ parameters: bootstrap: ./docroot/phpstan_autoload.php -
dantleech revised this gist
Mar 2, 2018 . 2 changed files with 6 additions and 6 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +0,0 @@ This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ Drupal dynamically adds to the class autoloader at runtime, so it is necessary to bootstrap Drupal in order that it is fully populated. This is why we use a custom autoload file below. ``` $ phpstan analyse --level=7 -c phpstan.neon docroot/modules/custom ``` -
dantleech revised this gist
Mar 2, 2018 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ Drupal dynamically adds to the class autoloader at runtime, so it is necessary to bootstrap Drupal in order that it is fully populated. ``` phpstan analyse --level=7 -c phpstan.neon docroot/modules/custom ``` -
dantleech created this gist
Mar 2, 2018 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ parameters: bootstrap: ./docroot/phpstan_autoload.php This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ <?php use Drupal\Console\Core\Utils\DrupalFinder; use Drupal\Console\Bootstrap\Drupal; use Drupal\Console\Application; $autoload = require_once __DIR__ . '/autoload.php'; $root = getcwd(); $drupalFinder = new DrupalFinder(); if (!$drupalFinder->locateRoot($root)) { echo ('DrupalConsole must be executed within a Drupal Site.'); exit(1); } chdir($drupalFinder->getDrupalRoot()); $drupal = new Drupal($autoload, $drupalFinder); $container = $drupal->boot(); return $autoload;