From 8f73eb785b7f015082917f4776194219e4251bfe Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Thu, 5 Nov 2020 09:36:14 +0100 Subject: [PATCH] Load stuff that is needed in runtime during PHPStan analysis [MAILPOET-3029] --- tasks/phpstan/bootstrap.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tasks/phpstan/bootstrap.php b/tasks/phpstan/bootstrap.php index 71e7bb2026..f52b73480c 100644 --- a/tasks/phpstan/bootstrap.php +++ b/tasks/phpstan/bootstrap.php @@ -22,4 +22,12 @@ define('MAILPOET_VERSION', '1.0.0'); $dbConfig = new \MailPoet\Config\Database(); $dbConfig->defineTables(); +// This needs to be set because \MailPoet\Doctrine\TablePrefixMetadataFactory can't construct without it +MailPoet\Config\Env::$dbPrefix = 'wp_'; +// Classes needed in runtime +MailPoet\Mailer\WordPress\PHPMailerLoader::load(); +require_once(ABSPATH . 'wp-includes/class-wp-widget.php'); // We extend this class it is need in runtime +// Load tracy +$tracyPath = __DIR__ . '/../../tools/vendor/tracy.phar'; +require_once($tracyPath);