1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Added Hook\AfterCodebasePopulatedInterface

This commit is contained in:
Bruce Weirdan 2019-02-24 18:40:06 +02:00 committed by Matthew Brown
parent 8650f9eb1a
commit 24a71be425
3 changed files with 27 additions and 0 deletions

View File

@ -306,6 +306,12 @@ class Config
*/
public $after_visit_classlikes = [];
/**
* Static methods to be called after codebase has been populated
* @var class-string<Hook\AfterCodebasePopulatedInterface>[]
*/
public $after_codebase_populated = [];
/** @var array<string, mixed> */
private $predefined_constants;

View File

@ -392,6 +392,14 @@ class ProjectAnalyzer
$this->config->visitStubFiles($this->codebase, $this->debug_output);
$plugin_classes = $this->config->after_codebase_populated;
if ($plugin_classes) {
foreach ($plugin_classes as $plugin_fq_class_name) {
$plugin_fq_class_name::afterCodebasePopulated($this->codebase);
}
}
$this->codebase->analyzer->analyzeFiles($this, $this->threads, $this->codebase->alter_code);
if ($this->parser_cache_provider) {

View File

@ -0,0 +1,13 @@
<?php
namespace Psalm\Plugin\Hook;
use Psalm\Codebase;
interface AfterCodebasePopulatedInterface
{
/**
* Called after codebase has been populated
* @return void
*/
public static function afterCodebasePopulated(Codebase $codebase);
}