for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types = 1);
namespace Venta\Container\Exception;
use Exception;
use Interop\Container\Exception\ContainerException as ContainerExceptionInterface;
use RuntimeException;
/**
* Class ContainerException
*
* @package Venta\Container\Exception
*/
abstract class ContainerException extends RuntimeException implements ContainerExceptionInterface
{
* List of entries referred to cause a circular reference.
* @var array
protected $referenceChain;
* Container entry identifier.
* @var string
protected $serviceId;
* CircularReferenceException constructor.
* @param string $entryId
* @param array $referenceChain
* @param Exception|null $previous
* @internal param string $message
public function __construct(string $entryId, array $referenceChain = [], Exception $previous = null)
$referenceChain[] = $this->serviceId = $entryId;
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
$this->referenceChain = $referenceChain;
parent::__construct($this->createMessage($previous), 0, $previous);
}
* Get reference chain.
* @return array
public function getReferenceChain(): array
return $this->referenceChain;
* Get container entry identifier which caused a circular reference error.
* @return string
public function getServiceId(): string
return $this->serviceId;
* Returns exception message
* @param Exception $previous
$previous
null|Exception
This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.
@param
It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.
abstract protected function createMessage(Exception $previous = null): string;
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.