These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | declare(strict_types = 1); |
||
3 | |||
4 | namespace AlexMasterov\EquipTwig; |
||
5 | |||
6 | use Equip\Formatter\HtmlFormatter; |
||
7 | use Twig_Environment; |
||
8 | |||
9 | final class TwigFormatter extends HtmlFormatter |
||
10 | { |
||
11 | /** |
||
12 | * @var Twig_Environment |
||
13 | */ |
||
14 | private $environment; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | private $template; |
||
20 | |||
21 | public function __construct(Twig_Environment $environment) |
||
22 | { |
||
23 | 3 | $this->environment = $environment; |
|
24 | } |
||
25 | 3 | ||
26 | 3 | public function withTemplate(string $template): self |
|
27 | { |
||
28 | $copy = clone $this; |
||
29 | $copy->template = $template; |
||
30 | |||
31 | return $copy; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | 1 | * @inheritDoc |
|
36 | */ |
||
37 | 1 | public function format(string $content): string |
|
38 | 1 | { |
|
39 | return $this->environment->render($this->template, $content); |
||
0 ignored issues
–
show
|
|||
40 | 1 | } |
|
41 | } |
||
42 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: