- Issue created by @longwave
- 🇬🇧United Kingdom longwave UK
Actually the same
@return object
is present in Symfony 7 but for some reason this isn't triggered in Drupal 11, maybe because of the changes around PHPUnit 10? - Status changed to Needs review
5 months ago 9:08am 8 August 2024 - 🇦🇺Australia mstrelan
✨ Enforce return types in all new methods and functions RTBC would have caught this.
I would RTBC but I guess we should see if it passes on 10.x
- Status changed to RTBC
5 months ago 1:36pm 8 August 2024 - 🇺🇸United States smustgrave
Seems straight forward
Been keeping an eye on ✨ Enforce return types in all new methods and functions RTBC but not sure I'm one that can make the call.
- 🇬🇧United Kingdom longwave UK
FWIW on @mondrake's suggestion I split the MockClient class out to its own file instead of keeping it inside WebAssertTest and the deprecation is triggered in 11.x:
$ ddev test core/tests/Drupal/Tests/Core/Test/WebAssertTest.php PHPUnit 10.5.29 by Sebastian Bergmann and contributors. Runtime: PHP 8.3.8 Configuration: /var/www/html/drupal/core/phpunit.xml.dist D........................ 25 / 25 (100%) Time: 00:00.129, Memory: 6.00 MB 1 test triggered 1 deprecation: 1) /var/www/html/drupal/vendor/symfony/error-handler/DebugClassLoader.php:341 Method "Symfony\Component\BrowserKit\AbstractBrowser::doRequest()" might add "object" as a native return type declaration in the future. Do the same in child class "Drupal\Tests\Core\Test\MockClient" now to avoid errors or add an explicit @return annotation to suppress this message. Triggered by: * Drupal\Tests\Core\Test\WebAssertTest::testResponseHeaderExists /var/www/html/drupal/core/tests/Drupal/Tests/Core/Test/WebAssertTest.php:75 OK, but there were issues! Tests: 25, Assertions: 65, Deprecations: 1.
- 🇮🇹Italy mondrake 🇮🇹
Another good reason, on top of 📌 Method getMockForAbstractClass() of class PHPUnit\Framework\TestCase is deprecated in PHPUnit 10 - replace in Plugin component tests Needs review , to keep every class in its own autoloadable file also in tests.
- 🇬🇧United Kingdom catch
I think we should probably split these classes out, even if it feels neater to me to keep them in the tests they're used in, it's obviously causing other problems. However given 10.x pipelines are actually failing, let's quick fix this. Committed/pushed to 11.x and cherry-picked back through to 10.3.x, thanks!
- Status changed to Fixed
5 months ago 9:00am 9 August 2024 Automatically closed - issue fixed for 2 weeks with no activity.