When upgrading packages, I recently found out that JsonType no longer supports the "somekey" => "array:empty" constraint. The tests which use this constraint fail due to a warning emitted: "Array to string conversion".
Because of this I was forced to downgrade this package to ^1.4.
I think that there should be no typecast at all, i.e. the $value argument to matchFilter(...) should have no type annotation (or mixed) and it should be checked to be a string in the filters that really need it.
Otherwise, we cannot test non-string values to match a type, which seems incorrect.
When upgrading packages, I recently found out that JsonType no longer supports the
"somekey" => "array:empty"
constraint. The tests which use this constraint fail due to a warning emitted: "Array to string conversion".After some investigation, I found that this conversion warning is emitted here: https://github.com/Codeception/module-rest/blob/master/src/Codeception/Util/JsonType.php#L173
This
(string)
cast is the cause of the warning. This typecast was introduced when migrating the codebase to PHP 7.4, here: https://github.com/Codeception/module-rest/commit/da2666b9#diff-5f18b614b32e2a743f0b10105d11c820ed509f8e52e68fd770666988143ae44dL172-R178Because of this I was forced to downgrade this package to ^1.4.
I think that there should be no typecast at all, i.e. the
$value
argument tomatchFilter(...)
should have no type annotation (ormixed
) and it should be checked to be a string in the filters that really need it.Otherwise, we cannot test non-string values to match a type, which seems incorrect.