mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 12:24:49 +01:00
Only create after analysis event if they exist
Fixes #5008 - this does some git execing, so we don’t want it to always run
This commit is contained in:
parent
8954c12eaa
commit
2fbfc429b7
@ -544,22 +544,26 @@ class IssueBuffer
|
||||
$source_control_info = null;
|
||||
$build_info = (new \Psalm\Internal\ExecutionEnvironment\BuildInfoCollector($_SERVER))->collect();
|
||||
|
||||
try {
|
||||
$source_control_info = (new \Psalm\Internal\ExecutionEnvironment\GitInfoCollector())->collect();
|
||||
} catch (\RuntimeException $e) {
|
||||
// do nothing
|
||||
if ($codebase->config->eventDispatcher->after_analysis
|
||||
|| $codebase->config->eventDispatcher->legacy_after_analysis
|
||||
) {
|
||||
try {
|
||||
$source_control_info = (new \Psalm\Internal\ExecutionEnvironment\GitInfoCollector())->collect();
|
||||
} catch (\RuntimeException $e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
/** @psalm-suppress ArgumentTypeCoercion due to Psalm bug */
|
||||
$event = new AfterAnalysisEvent(
|
||||
$codebase,
|
||||
$issues_data,
|
||||
$build_info,
|
||||
$source_control_info
|
||||
);
|
||||
|
||||
$codebase->config->eventDispatcher->dispatchAfterAnalysis($event);
|
||||
}
|
||||
|
||||
/** @psalm-suppress ArgumentTypeCoercion due to Psalm bug */
|
||||
$event = new AfterAnalysisEvent(
|
||||
$codebase,
|
||||
$issues_data,
|
||||
$build_info,
|
||||
$source_control_info
|
||||
);
|
||||
|
||||
$codebase->config->eventDispatcher->dispatchAfterAnalysis($event);
|
||||
|
||||
foreach ($project_analyzer->generated_report_options as $report_options) {
|
||||
if (!$report_options->output_path) {
|
||||
throw new \UnexpectedValueException('Output path should not be null here');
|
||||
|
Loading…
Reference in New Issue
Block a user