1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

pass args through event (#4864)

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

View File

@ -738,7 +738,9 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer
$storage,
$this,
$codebase,
[]
[],
$type_provider,
$context
);
if ($codebase->config->eventDispatcher->dispatchAfterFunctionLikeAnalysis($event) === false) {

View File

@ -5,7 +5,9 @@ namespace Psalm\Plugin\EventHandler\Event;
use PhpParser\Node;
use Psalm\Codebase;
use Psalm\Context;
use Psalm\FileManipulation;
use Psalm\NodeTypeProvider;
use Psalm\StatementsSource;
use Psalm\Storage\FunctionLikeStorage;
@ -31,6 +33,14 @@ class AfterFunctionLikeAnalysisEvent
* @var FileManipulation[]
*/
private $file_replacements;
/**
* @var NodeTypeProvider
*/
private $node_type_provider;
/**
* @var Context
*/
private $context;
/**
* Called after a statement has been checked
@ -42,13 +52,17 @@ class AfterFunctionLikeAnalysisEvent
FunctionLikeStorage $classlike_storage,
StatementsSource $statements_source,
Codebase $codebase,
array $file_replacements = []
array $file_replacements,
NodeTypeProvider $node_type_provider,
Context $context
) {
$this->stmt = $stmt;
$this->classlike_storage = $classlike_storage;
$this->statements_source = $statements_source;
$this->codebase = $codebase;
$this->file_replacements = $file_replacements;
$this->node_type_provider = $node_type_provider;
$this->context = $context;
}
public function getStmt(): Node\FunctionLike
@ -86,4 +100,14 @@ class AfterFunctionLikeAnalysisEvent
{
$this->file_replacements = $file_replacements;
}
public function getNodeTypeProvider(): NodeTypeProvider
{
return $this->node_type_provider;
}
public function getContext(): Context
{
return $this->context;
}
}