Before this commit, we had two different PHPStan configuration files. One
for the lib directory (phpstan.neon) and another one for the tests directory
(phpstan-tests.neon). This commit combines both files into one
(phpstan.neon) to make it easier to maintain and make changes to PHPStan
configurations.
As part of this process, it was necessary to change the Robo command
`./do qa:phpstan` to call PHPStan only once and to
combine php-version-dependent-config-tests.php and
php-version-dependent-config-libs.php in a new file called
php-version-dependent-config.php.
Another benefit of this change is that running PHPStan only once with a
single configuration file means that it runs about 20% faster than
the previous setup.
[MAILPOET-4024]
I had to move loading those stubs to bootstrap files because it was not able to load the class
when placed in scanFiles.
Note this is also recommended in documentation https://github.com/php-stubs/woocommerce-stubs
[MAILPOET-3920]
This commit removes the checkGenericClassInNonGenericObjectType flag
from PHPStan configuration files and fixes all associated errors in our
code base.
[MAILPOET-3236]
This check doesn't produce any errors so we don't need to exclude it
from our checks. Note that this only removes the exclusion of this error
from phpstan.neon. The same error check is kept in phpstan-tests.neon as
there are some change that we need to make to two tests before being
able to update this file as well.
[MAILPOET-3236]
Since we updated to PHPStan 0.12.83 we started getting the error bellow.
It seems this happened because the message of an error that we were
already ignoring was changed. This commit simply updates the pattern we
use to ignore the error to reflect the change in the new PHPStan
version.
```
------ ---------------------------------------------------------------------
Line lib/Features/FeatureFlagsController.php
------ ---------------------------------------------------------------------
Ignored error pattern #^Cannot access offset \(int\|string\) on
array\|false# in path
/home/circleci/mailpoet/lib/Features/FeatureFlagsController.php was
not matched in reported errors.
44 Cannot access offset (int|string) on array<string,
MailPoet\Entities\FeatureFlagEntity>|false.
------ ---------------------------------------------------------------------
```
[MAILPOET-3491]