Conditions | 3 |
Paths | 4 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public static function configureTwig(Twig $twig): void |
||
24 | { |
||
25 | $loader = $twig->getLoader(); |
||
26 | if (!$loader instanceof ChainLoader) { |
||
27 | $loader = new ChainLoader([$loader]); |
||
28 | $twig->setLoader($loader); |
||
29 | } |
||
30 | $loader->addLoader(self::createTwigLoader()); |
||
31 | |||
32 | if (!$twig->hasExtension(CommonMarkExtension::class)) { |
||
33 | $twig->addExtension(new CommonMarkExtension()); |
||
34 | } |
||
35 | } |
||
36 | |||
47 |
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.