Skip to content

Commit

Permalink
Fix Psalm issues (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Aug 23, 2023
1 parent 3290a11 commit 38965ba
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 41 deletions.
83 changes: 44 additions & 39 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/Converters/JUnitConverter.php
Expand Up @@ -122,11 +122,12 @@ private function createSourceNodes(array $xmlAsArray, SourceSuite $currentSuite)
$case->classname = $attrs->getStringNull('classname');
$case->assertions = $attrs->getIntNull('assertions');

/** @var array $output */
foreach ($xmlAsArray['_children'] as $output) {
$typeOfOutput = $output['_node'];
$type = $output['_attrs']['type'] ?? null;
$message = $output['_attrs']['message'] ?? null;
$details = ($output['_cdata'] ?? null) ?? $output['_text'] ?? null;
$details = $output['_cdata'] ?? $output['_text'] ?? null;

$caseOutput = new SourceCaseOutput($type, $message, $details);

Expand Down
6 changes: 5 additions & 1 deletion src/Converters/PhpUnitCloverStatsTcConverter.php
Expand Up @@ -33,14 +33,18 @@ final class PhpUnitCloverStatsTcConverter extends AbstractStatsTcConverter
public function toInternalMetric(string $sourceCode): Metrics
{
$cloverXml = new \SimpleXMLElement($sourceCode);
$info = data((array)$cloverXml->project->metrics)->getSelf('@attributes');
$info = data((array)$cloverXml->project?->metrics)->getSelf('@attributes');

$coveredClasses = 0;

$nodeClasses = $cloverXml->xpath('//class');
// @phpstan-ignore-next-line
if (\is_iterable($nodeClasses)) {
foreach ($nodeClasses as $class) {
if ($class->metrics === null) {
continue;
}

if ((int)$class->metrics['coveredmethods'] === (int)$class->metrics['methods']) {
$coveredClasses++;
}
Expand Down

0 comments on commit 38965ba

Please sign in to comment.