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

Always generate report files, even if no errors and warnings

This commit is contained in:
MacFJA 2017-09-27 00:18:24 +02:00 committed by Matthew Brown
parent 4145119268
commit a38c36c597
2 changed files with 37 additions and 6 deletions

View File

@ -209,12 +209,12 @@ class IssueBuffer
}
echo self::getOutput($project_checker->output_format, $project_checker->use_color);
foreach ($project_checker->reports as $format => $path) {
file_put_contents(
$path,
self::getOutput($format, $project_checker->use_color)
);
}
}
foreach ($project_checker->reports as $format => $path) {
file_put_contents(
$path,
self::getOutput($format, $project_checker->use_color)
);
}
if ($start_time) {

View File

@ -183,4 +183,35 @@ somefile.php:2:43:error - Could not verify return type \'string|null\' for psalm
// XML2Array::createArray(IssueBuffer::getOutput(ProjectChecker::TYPE_XML, false), LIBXML_NOCDATA)
//);
}
/**
* @return void
*/
public function testEmptyReportIfNotError()
{
$this->addFile(
'somefile.php',
'<?php ?>'
);
$file_checker = new FileChecker('somefile.php', $this->project_checker);
$file_checker->visitAndAnalyzeMethods();
$this->assertSame(
'[]
',
IssueBuffer::getOutput(ProjectChecker::TYPE_JSON, false)
);
$this->assertSame(
'',
IssueBuffer::getOutput(ProjectChecker::TYPE_EMACS, false)
);
$this->assertSame(
'<?xml version="1.0" encoding="UTF-8"?>
<report>
<item/>
</report>
',
IssueBuffer::getOutput(ProjectChecker::TYPE_XML, false)
);
}
}