for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Paraunit\Coverage;
use Paraunit\Lifecycle\ProcessEvent;
use Paraunit\Process\AbstractParaunitProcess;
use Paraunit\Proxy\Coverage\CodeCoverage;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Class CoverageMerger
* @package Paraunit\Coverage
*/
class CoverageMerger implements EventSubscriberInterface
{
/** @var CoverageFetcher */
private $coverageFetcher;
/** @var CodeCoverage */
private $coverageData;
* CoverageMerger constructor.
* @param CoverageFetcher $coverageFetcher
public function __construct(CoverageFetcher $coverageFetcher)
$this->coverageFetcher = $coverageFetcher;
}
public static function getSubscribedEvents(): array
return [
ProcessEvent::PROCESS_PARSING_COMPLETED => 'onProcessParsingCompleted',
];
* @param ProcessEvent $processEvent
public function onProcessParsingCompleted(ProcessEvent $processEvent)
$process = $processEvent->getProcess();
if ($process->isToBeRetried()) {
return;
$this->merge($process);
private function merge(AbstractParaunitProcess $process)
$newCoverageData = $this->coverageFetcher->fetch($process);
if ($this->coverageData instanceof CodeCoverage) {
$this->coverageData->merge($newCoverageData);
$newCoverageData
object<Paraunit\Proxy\Coverage\CodeCoverage>
object<self>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
} else {
$this->coverageData = $newCoverageData;
public function getCoverageData(): CodeCoverage
return $this->coverageData;
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: