In client code we expect that botch category and product ids
are strings but we send strings for lists based on posts and integers
for lists based on terms. We use mostly string values so this change unifies
that all ids for autocomplete lists are strings.
[MAILPOET-3555]
This commit fixes the following PHPStan error what started happening
after the update to version 0.12.83. It seems that our model classes
work with properties using both snake_case and camelCase names, so that
is why the change made here doesn't affect the modified unit test.
```
------ ---------------------------------------------
Line tests/integration/Models/SubscriberTest.php
------ ---------------------------------------------
740 Access to an undefined property
MailPoet\Models\Subscriber::$deleted_at.
------ ---------------------------------------------
```
[MAILPOET-3491]
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]
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 ignores the following PHPStan error introduced after the update to version 0.12.83. It seems the error is caused by a problem in Carbon's documentation so there is not way for us to fix it for now. Carbon's constructor accepts an instance of DateTimeInterface, but its phpdoc block only mentions string or null.
```
------ ----------------------------------------------------------------------
Line lib/Entities/NewsletterEntity.php
------ ----------------------------------------------------------------------
283 Parameter #1 $time of class MailPoetVendor\Carbon\Carbon constructor
expects string|null, DateTimeInterface|null given.
------ ----------------------------------------------------------------------
```
[MAILPOET-3491]
This commit fixes the following PHPStan errors introduced after the
update to version 0.12.83:
```
------ ----------------------------------------------------------------------
Line lib/Listing/Handler.php
------ ----------------------------------------------------------------------
18 Parameter #1 $callback of function call_user_func_array expects
callable(): mixed, array(class-string|object, 'listingQuery') given.
45 Parameter #1 $callback of function call_user_func_array expects
callable(): mixed, array(class-string|object, 'groups') given.
54 Parameter #1 $callback of function call_user_func_array expects
callable(): mixed, array(class-string|object, 'filters') given.
62 Parameter #1 $callback of function call_user_func_array expects
callable(): mixed, array(class-string|object, 'listingQuery') given.
------ ----------------------------------------------------------------------
```
It was necessary to use both is_callable() and method_exists() instead
of just is_callable(), as a parent class of the model classes implements
__call() and thus is_callable() always returns true even when the
method doesn't exist (and in those cases method_exists() returns false).
[MAILPOET-3491]
This commit replaces the usage of Paris with Doctrine inside
MailPoet\API\JSON\v1\Forms::listing(). It also introduces a new class
MailPoet\Form\Listing\FormListingRepository that is used by listing() to
prepare the query that is executed by Doctrine and a new
MailPoet\API\JSON\ResponseBuilders\FormsResponseBuilder::buildForListing()
method to prepare the response that is returned by listing(). A few tests were
adjusted and new tests were added for the new class.
[MAILPOET-3036]