mirror of
https://github.com/danog/psalm.git
synced 2024-12-11 16:59:45 +01:00
Merge pull request #10728 from ohader/10725-before-file-analysis-event-stmts
This commit is contained in:
commit
6129891cc7
@ -150,8 +150,7 @@ class FileAnalyzer extends SourceAnalyzer
|
||||
return;
|
||||
}
|
||||
|
||||
$event = new BeforeFileAnalysisEvent($this, $this->context, $file_storage, $codebase);
|
||||
|
||||
$event = new BeforeFileAnalysisEvent($this, $this->context, $file_storage, $codebase, $stmts);
|
||||
$codebase->config->eventDispatcher->dispatchBeforeFileAnalysis($event);
|
||||
|
||||
if ($codebase->alter_code) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Psalm\Plugin\EventHandler\Event;
|
||||
|
||||
use PhpParser\Node\Stmt;
|
||||
use Psalm\Codebase;
|
||||
use Psalm\Context;
|
||||
use Psalm\StatementsSource;
|
||||
@ -13,22 +14,29 @@ final class BeforeFileAnalysisEvent
|
||||
private Context $file_context;
|
||||
private FileStorage $file_storage;
|
||||
private Codebase $codebase;
|
||||
/**
|
||||
* @var list<Stmt>
|
||||
*/
|
||||
private array $stmts;
|
||||
|
||||
/**
|
||||
* Called before a file has been checked
|
||||
*
|
||||
* @param list<Stmt> $stmts
|
||||
* @internal
|
||||
*/
|
||||
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
|
||||
@ -50,4 +58,12 @@ final class BeforeFileAnalysisEvent
|
||||
{
|
||||
return $this->codebase;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<Stmt>
|
||||
*/
|
||||
public function getStmts(): array
|
||||
{
|
||||
return $this->stmts;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user