IBX-9727: [Tests] Fixed strict types for core field type tests #576
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Related PRs:
Description:
This PR fixes strict types for
\Ibexa\Tests\Core\FieldType\BaseFieldTypeTestCaseand its children.There are a few interesting aspects of those changes.
BaseFieldTypeTestCasewhich includes extensive documentation how to implement data provider. Those PHPDoc blocks were copied 1:1 from the base into the children. Now that I needed to fix return strict type in these blocks, I decided to remove the redundancy instead of fixing it everywhere as well.yieldnamed data provider sets instead of returning them.phpstan-ignore <identifier>ignores as the sole purpose of those tests is to test what PHPStan reports as an error too. Once we get strict types to the actual field type implementations, those tests will be easily spotted and removed. However I'm not gonna do it in this PR for sanity reasons.\Ibexa\Tests\Core\FieldType\FieldTypeTestCasewhich inherits\Ibexa\Tests\Core\FieldType\BaseFieldTypeTestCase. The only one directly ineritting\Ibexa\Tests\Core\FieldType\BaseFieldTypeTestCaseis generic field type test. The only difference between the other core types and the generic one is that the latter one doesn't implementComparable. That was reflected by keepingon
BaseFieldTypeTestCaseand applying covariance onFieldTypeTestCasein the form of:as one of the tests calls
\Ibexa\Contracts\Core\FieldType\Comparable::valuesEqualmethod.Maybe generic field type should also implement comparable, but it's unclear to me how to make it in a clean way.
SonarQube duplication report is valid, but out of scope here.
For QA:
No QA required.