Fix PHPStan parameter type error introduced after update to version 0.12.83

This commit fixes the following PHPStan errors introduced after the update to version 0.12.83:

```
 ------ ----------------------------------------------------------------------
  Line   lib/Newsletter/Renderer/Blocks/Footer.php
 ------ ----------------------------------------------------------------------
  18     Parameter #1 $html of method MailPoet\Util\pQuery\pQuery::parseStr()
         expects string, array|string|null given.
 ------ ----------------------------------------------------------------------

 ------ ----------------------------------------------------------------------
  Line   lib/Newsletter/Renderer/Blocks/Header.php
 ------ ----------------------------------------------------------------------
  18     Parameter #1 $html of method MailPoet\Util\pQuery\pQuery::parseStr()
         expects string, array|string|null given.
 ------ ----------------------------------------------------------------------
```

[MAILPOET-3491]
This commit is contained in:
Rodrigo Primo
2021-04-06 15:23:56 -03:00
committed by Veljko V
parent 90526362cc
commit 030bd8c1c8
4 changed files with 18 additions and 0 deletions

View File

@ -14,6 +14,9 @@ class Header {
$lineHeight = sprintf(
'%spx', StylesHelper::$defaultLineHeight * (int)$element['styles']['text']['fontSize']
);
if (!is_string($element['text'])) {
throw new \RuntimeException('$element[\'text\'] should be a string.');
}
$dOMParser = new pQuery();
$DOM = $dOMParser->parseStr($element['text']);
if (isset($element['styles']['link'])) {