Issue Task Resolved

#110415Raise phpunit/phpunit to ^11.5.56 for PHP 8.6 compatibility

Stefan Bürk 08/10/26, 20:00 updated 08/11/26, 05:15

Description

Running the unit test suite with PHP 8.6 triggers a PHP deprecation:

bc. Returning a value from a constructor is deprecated

PHP 8.6 deprecates returning a value from a constructor, see
https://wiki.php.net/rfc/deprecate-return-value-from-construct

The deprecation is not raised by TYPO3 code but by the code PHPUnit generates
for a test double – see
@vendor/phpunit/phpunit/src/Framework/MockObject/Generator/MockClass.php@ -
whenever an interface declaring __construct() is doubled. In the TYPO3 unit
test suite this affects the test doubles created for
@TYPO3\CMS\Install\FolderStructure\NodeInterface@ and
@TYPO3\CMS\Install\FolderStructure\RootNodeInterface@ in EXT:install tests.

It has been reported and fixed upstream:

The fix is released with phpunit/phpunit 11.5.56, therefore raising the
development dependency resolves the deprecation on all affected branches.

Verified with Build/Scripts/runTests.sh -p 8.6 -s unit:

  • main: 4 tests triggered the deprecation
  • 14.3: 2 tests triggered the deprecation
  • 13.4: 2 tests triggered the deprecation

With PHP 8.5 all three branches are unaffected, and no test failures or errors
occur on PHP 8.6 besides this deprecation.

Reviews 3