Problem/Motivation
In #3107732: Add return typehints to setUp/tearDown methods in concrete test classes we added return type hints to concrete test classes. Unfortunately we also accidentally included Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase which is an abstract base class used in contrib, plus a few other abstract classes that might be extended elsewhere.
Proposed resolution
Remove void type hints all abstract test classes.
Remaining tasks
Discover the full set of classes.
User interface changes
API changes
Downstream users of MigrateProcessTestCase will no longer need to implement typehints.
Downstream users of other abstract classes will no longer need to implement typehints.
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | interdiff-5-10.txt | 568 bytes | jungle |
| #10 | 3131402-10.patch | 4.28 KB | jungle |
Comments
Comment #2
longwaveComment #3
longwaveComment #4
longwaveScope widened to include more classes, as per the below list - some false positives here though
Comment #5
longwaveComment #6
berdirthis one is a bit strange as there's only a single subclass, but doesn't matter too much. Better one too much where we don't add the return type than the opposite and breaking some contrib.
List of changed classes makes sense based on the output above. RTBC if it passes tests.
As maintainer of paragraphs, I'd appreciate this being committed as I'm otherwise forced to add : void to paragraphs.module which would require PHP 7.1.
As discused in slack, removing them again should not be an issue, even if some modules already updated their sbuclasses. Subclasses can define the return type, or the original issue of adding it to all non-base classes wouldn't have worked in the first place.
Comment #7
heddn+1 on RTBC.
Comment #9
alexpottneed to remove it from \Drupal\Tests\media\Functional\MediaFunctionalTestTrait::setUp too - which imo makes sense.
Comment #10
jungleAddressed #9. Testing failure should be fixed.
Comment #11
jungleAs testings passed, per comments in #6 and #7, I am setting this back to RTBC. If this is counted as self-RTBC, please feel free to revert it back. Thanks!
Comment #12
longwaveRTBC +1 :)
Comment #13
alexpottCommitted and pushed 9632fb98a1 to 9.1.x and ef544cd00b to 9.0.x. Thanks!