1 | <?php |
||
21 | class InlineParserEngine |
||
22 | { |
||
23 | protected $environment; |
||
24 | |||
25 | 1956 | public function __construct(Environment $environment) |
|
29 | |||
30 | /** |
||
31 | * @param Node $container |
||
32 | * @param ReferenceMap $referenceMap |
||
33 | */ |
||
34 | 1662 | public function parse(Node $container, ReferenceMap $referenceMap) |
|
45 | |||
46 | /** |
||
47 | * @param string $character |
||
48 | * @param InlineParserContext $inlineParserContext |
||
49 | * |
||
50 | * @return bool Whether we successfully parsed a character at that position |
||
51 | */ |
||
52 | 1659 | protected function parseCharacter($character, InlineParserContext $inlineParserContext) |
|
53 | 1 | { |
|
54 | 1659 | foreach ($this->environment->getInlineParsersForCharacter($character) as $parser) { |
|
55 | 1239 | if ($parser->parse($inlineParserContext)) { |
|
56 | 1228 | return true; |
|
57 | } |
||
58 | 525 | } |
|
59 | |||
60 | 1542 | return false; |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param InlineParserContext $inlineParserContext |
||
65 | */ |
||
66 | 1662 | protected function processInlines(InlineParserContext $inlineParserContext) |
|
77 | |||
78 | /** |
||
79 | * @param string $character |
||
80 | * @param Node $container |
||
81 | * @param InlineParserContext $inlineParserContext |
||
82 | */ |
||
83 | 1542 | private function addPlainText($character, Node $container, InlineParserContext $inlineParserContext) |
|
101 | } |
||
102 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.