1 | <?php declare(strict_types = 1); |
||
14 | abstract class ContainerException extends RuntimeException implements ContainerExceptionInterface |
||
15 | { |
||
16 | /** |
||
17 | * List of entries referred to cause a circular reference. |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | private $referenceChain; |
||
22 | |||
23 | /** |
||
24 | * Container entry identifier. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | private $serviceId; |
||
29 | |||
30 | /** |
||
31 | * CircularReferenceException constructor. |
||
32 | * |
||
33 | * @param string $entryId |
||
34 | * @param array $referenceChain |
||
35 | * @param Exception|null $previous |
||
36 | * @internal param string $message |
||
37 | */ |
||
38 | 7 | public function __construct(string $entryId, array $referenceChain = [], Exception $previous = null) |
|
44 | |||
45 | /** |
||
46 | * Get reference chain. |
||
47 | * |
||
48 | * @return array |
||
49 | */ |
||
50 | 7 | public function referenceChain(): array |
|
54 | |||
55 | /** |
||
56 | * Get container entry identifier which caused a circular reference error. |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | 6 | public function serviceId(): string |
|
64 | |||
65 | /** |
||
66 | * Adds service Ids to the reference chain. |
||
67 | * |
||
68 | * @param string[] ...$serviceId |
||
69 | */ |
||
|
|||
70 | 3 | protected function addToReferenceChain(string ...$serviceId) |
|
74 | |||
75 | /** |
||
76 | * Returns exception message |
||
77 | * |
||
78 | * @param Exception $previous |
||
79 | * @return string |
||
80 | */ |
||
81 | abstract protected function createMessage(Exception $previous = null): string; |
||
82 | |||
83 | } |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.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.