| 1 | <?php declare(strict_types = 1); |
||
| 9 | class TemplateResolver implements EmailPartResolver |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var Engine |
||
| 13 | */ |
||
| 14 | private $templateEngine; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Constructor. |
||
| 18 | * |
||
| 19 | * @param Engine $templateEngine |
||
| 20 | */ |
||
| 21 | 3 | public function __construct(Engine $templateEngine) |
|
| 25 | |||
| 26 | /** |
||
| 27 | * {@inheritdoc} |
||
| 28 | */ |
||
| 29 | 3 | public function addPart(Email $email, EmailPart $part) |
|
| 35 | |||
| 36 | /** |
||
| 37 | * Render the template. |
||
| 38 | * |
||
| 39 | * @param Template $part |
||
| 40 | * |
||
| 41 | * @return string |
||
| 42 | */ |
||
| 43 | 3 | private function render(Template $part) |
|
| 48 | } |
||
| 49 |
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.