This commit protects the code that renders styles for e-mails against a
fatal error that could happen if the variable $styles passed to Renderer::renderStyles()
is not an array of arrays. To do that, the code will now check if each value
of the array is an array. If not, we move on to the next value instead of
calling StylesHelper::setStyle(). I also added type hints to
StylesHelper::setStyle() and some of the methods that it calls to make
it more explicit what it expects to receive and what it returns.
[MAILPOET-3731]
This commit removes the checkGenericClassInNonGenericObjectType flag
from PHPStan configuration files and fixes all associated errors in our
code base.
[MAILPOET-3236]
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]
[MAILPOET-2286]
Additional preprocessing logic is needed to handle WooCommerce
blocks, so instead of making the Renderer class even bigger,
I am creating a new Preprocessor class. I wanted to move the
`addMailpoetLogoContentBlock` logic as well but it will break
tests and require a lot of refactor to fix them so I am leaving
it here for now.