upgrade to laravel 8.x
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of the php-code-coverage package.
|
||||
* This file is part of phpunit/php-code-coverage.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
@@ -9,17 +9,25 @@
|
||||
*/
|
||||
namespace SebastianBergmann\CodeCoverage\Driver;
|
||||
|
||||
use function sprintf;
|
||||
use SebastianBergmann\CodeCoverage\BranchAndPathCoverageNotSupportedException;
|
||||
use SebastianBergmann\CodeCoverage\DeadCodeDetectionNotSupportedException;
|
||||
use SebastianBergmann\CodeCoverage\Filter;
|
||||
use SebastianBergmann\CodeCoverage\NoCodeCoverageDriverAvailableException;
|
||||
use SebastianBergmann\CodeCoverage\NoCodeCoverageDriverWithPathCoverageSupportAvailableException;
|
||||
use SebastianBergmann\CodeCoverage\RawCodeCoverageData;
|
||||
|
||||
/**
|
||||
* Interface for code coverage drivers.
|
||||
* @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
|
||||
*/
|
||||
interface Driver
|
||||
abstract class Driver
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @see http://xdebug.org/docs/code_coverage
|
||||
*/
|
||||
public const LINE_EXECUTED = 1;
|
||||
public const LINE_NOT_EXECUTABLE = -2;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
@@ -33,15 +41,127 @@ interface Driver
|
||||
*
|
||||
* @see http://xdebug.org/docs/code_coverage
|
||||
*/
|
||||
public const LINE_NOT_EXECUTABLE = -2;
|
||||
public const LINE_EXECUTED = 1;
|
||||
|
||||
/**
|
||||
* Start collection of code coverage information.
|
||||
* @var int
|
||||
*
|
||||
* @see http://xdebug.org/docs/code_coverage
|
||||
*/
|
||||
public function start(bool $determineUnusedAndDead = true): void;
|
||||
public const BRANCH_NOT_HIT = 0;
|
||||
|
||||
/**
|
||||
* Stop collection of code coverage information.
|
||||
* @var int
|
||||
*
|
||||
* @see http://xdebug.org/docs/code_coverage
|
||||
*/
|
||||
public function stop(): array;
|
||||
public const BRANCH_HIT = 1;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $collectBranchAndPathCoverage = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $detectDeadCode = false;
|
||||
|
||||
/**
|
||||
* @throws NoCodeCoverageDriverAvailableException
|
||||
* @throws PcovNotAvailableException
|
||||
* @throws PhpdbgNotAvailableException
|
||||
* @throws XdebugNotAvailableException
|
||||
* @throws Xdebug2NotEnabledException
|
||||
* @throws Xdebug3NotEnabledException
|
||||
*
|
||||
* @deprecated Use DriverSelector::forLineCoverage() instead
|
||||
*/
|
||||
public static function forLineCoverage(Filter $filter): self
|
||||
{
|
||||
return (new Selector)->forLineCoverage($filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws NoCodeCoverageDriverWithPathCoverageSupportAvailableException
|
||||
* @throws XdebugNotAvailableException
|
||||
* @throws Xdebug2NotEnabledException
|
||||
* @throws Xdebug3NotEnabledException
|
||||
*
|
||||
* @deprecated Use DriverSelector::forLineAndPathCoverage() instead
|
||||
*/
|
||||
public static function forLineAndPathCoverage(Filter $filter): self
|
||||
{
|
||||
return (new Selector)->forLineAndPathCoverage($filter);
|
||||
}
|
||||
|
||||
public function canCollectBranchAndPathCoverage(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function collectsBranchAndPathCoverage(): bool
|
||||
{
|
||||
return $this->collectBranchAndPathCoverage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BranchAndPathCoverageNotSupportedException
|
||||
*/
|
||||
public function enableBranchAndPathCoverage(): void
|
||||
{
|
||||
if (!$this->canCollectBranchAndPathCoverage()) {
|
||||
throw new BranchAndPathCoverageNotSupportedException(
|
||||
sprintf(
|
||||
'%s does not support branch and path coverage',
|
||||
$this->nameAndVersion()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->collectBranchAndPathCoverage = true;
|
||||
}
|
||||
|
||||
public function disableBranchAndPathCoverage(): void
|
||||
{
|
||||
$this->collectBranchAndPathCoverage = false;
|
||||
}
|
||||
|
||||
public function canDetectDeadCode(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function detectsDeadCode(): bool
|
||||
{
|
||||
return $this->detectDeadCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DeadCodeDetectionNotSupportedException
|
||||
*/
|
||||
public function enableDeadCodeDetection(): void
|
||||
{
|
||||
if (!$this->canDetectDeadCode()) {
|
||||
throw new DeadCodeDetectionNotSupportedException(
|
||||
sprintf(
|
||||
'%s does not support dead code detection',
|
||||
$this->nameAndVersion()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->detectDeadCode = true;
|
||||
}
|
||||
|
||||
public function disableDeadCodeDetection(): void
|
||||
{
|
||||
$this->detectDeadCode = false;
|
||||
}
|
||||
|
||||
abstract public function nameAndVersion(): string;
|
||||
|
||||
abstract public function start(): void;
|
||||
|
||||
abstract public function stop(): RawCodeCoverageData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user