PHPUnit test fails on Drupal ^10.3 due to missing void return types

Created on 13 September 2024, 2 months ago

Problem/Motivation

Try to run tests on Drupal 10.3, get this:

Fatal error: Declaration of Drupal\Tests\pcb\Kernel\PermanentDatabaseBackendTest::testSetGet() must be compatible with Drupal\KernelTests\Core\Cache\GenericCacheBackendUnitTestBase::testSetGet(): void in /var/www/html/web/modules/contrib/pcb/tests/src/Kernel/PermanentDatabaseBackendTest.php on line 59

Steps to reproduce

Run tests on Drupal 10.3 or higher. Get above error.

Proposed resolution

Add void return types to methods that are overridden from GenericCacheBackendUnitTestBase. This should not affect compatibility with 10.2 or lower because making a return type more restrictive when extending or implementing an interface is generally permitted in PHP, but not the other way around. See 📌 Add void return typehints to all test methods Active for background.

Remaining tasks

See above.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇨🇦Canada ambient.impact Toronto

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024