1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-29 20:28:59 +01:00

adds statements list in the event (#4835)

This commit is contained in:
orklah 2021-01-07 15:04:50 +01:00 committed by Daniil Gentili
parent 7f4550a889
commit e99cf5f514
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 19 additions and 2 deletions

View File

@ -271,7 +271,7 @@ class FileAnalyzer extends SourceAnalyzer
}
}
$event = new AfterFileAnalysisEvent($this, $this->context, $file_storage, $codebase);
$event = new AfterFileAnalysisEvent($this, $this->context, $file_storage, $codebase, $stmts);
$codebase->config->eventDispatcher->dispatchAfterFileAnalysis($event);
$this->class_analyzers_to_analyze = [];

View File

@ -3,6 +3,7 @@
namespace Psalm\Plugin\EventHandler\Event;
use PhpParser\Node\Stmt;
use Psalm\Codebase;
use Psalm\Context;
use Psalm\StatementsSource;
@ -26,20 +27,28 @@ class AfterFileAnalysisEvent
* @var Codebase
*/
private $codebase;
/**
* @var Stmt[]
*/
private $stmts;
/**
* Called after a file has been checked
*
* @param array<Stmt> $stmts
*/
public function __construct(
StatementsSource $statements_source,
Context $file_context,
FileStorage $file_storage,
Codebase $codebase
Codebase $codebase,
array $stmts
) {
$this->statements_source = $statements_source;
$this->file_context = $file_context;
$this->file_storage = $file_storage;
$this->codebase = $codebase;
$this->stmts = $stmts;
}
public function getStatementsSource(): StatementsSource
@ -61,4 +70,12 @@ class AfterFileAnalysisEvent
{
return $this->codebase;
}
/**
* @return Stmt[]
*/
public function getStmts(): array
{
return $this->stmts;
}
}