Page MenuHomePhabricator

Use return type `never` in Wikibase
Open, Stalled, Needs TriagePublic

Description

build: Enable PhanPluginNeverReturnMethod and make pass added several @return never types to Wikibase code. Once we can require PHP 8.1 and have access to a language-level never return type, we should convert those return types; at that point, we can also remove this kind of code:

// @phan-suppress-next-line PhanPluginUnreachableCode Wanted to guarantee return never at the language level
throw new LogicException( 'ApiUsageException not thrown' );

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

Change #1169695 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] ApiErrorReporter: Use `never` return type

https://gerrit.wikimedia.org/r/1169695

Hm, this might be blocked further on T328919: Upgrade PHPUnit in MediaWiki code to PHPUnit 10:

PHP Fatal error: Cannot use 'never' as class name as it is reserved in /workspace/src/vendor/phpunit/phpunit/src/Framework/MockObject/MockClass.php(51) : eval()'d code on line 3

The fix for this issue – i.e. mocking classes with never-returning methods – was only included in PHPUnit 10.4.2, apparently.