A fix for T362027: Using rest.php seems to show Math has a hard dependancy on WikibaseClient due to use of 'Math.WikibaseConnector' service in master (https://gerrit.wikimedia.org/r/1017449), REL1_40 and REL1_41 works fine.
Backporting it to REL1_39 (https://gerrit.wikimedia.org/r/1017792) results in some test failures:
https://integration.wikimedia.org/ci/job/quibble-composer-mysql-php74-noselenium/58/console
14:04:37 1) RestStructureTest::testRoutePathAndMethodForDuplicates 14:04:37 filemtime(): stat failed for /workspace/src//workspace/src/extensions/Math/popupRestRoutes.json 14:04:37 14:04:37 /workspace/src/includes/Rest/Router.php:186 14:04:37 /workspace/src/includes/Rest/Router.php:221 14:04:37 /workspace/src/vendor/wikimedia/testing-access-wrapper/src/TestingAccessWrapper.php:114 14:04:37 /workspace/src/tests/phpunit/structure/RestStructureTest.php:169 14:04:37 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:500 14:04:37 14:04:37 -- 14:04:37 14:04:37 There were 2 warnings: 14:04:37 14:04:37 1) Warning 14:04:37 The data provider specified for RestStructureTest::testPathParameters is invalid. 14:04:37 InvalidArgumentException: Passed variable is not an array or object 14:04:37 /workspace/src/includes/Rest/Router.php:221 14:04:37 /workspace/src/vendor/wikimedia/testing-access-wrapper/src/TestingAccessWrapper.php:114 14:04:37 /workspace/src/tests/phpunit/structure/RestStructureTest.php:88 14:04:37 14:04:37 2) Warning 14:04:37 The data provider specified for RestStructureTest::testParameters is invalid. 14:04:37 InvalidArgumentException: Passed variable is not an array or object 14:04:37 /workspace/src/includes/Rest/Router.php:221 14:04:37 /workspace/src/vendor/wikimedia/testing-access-wrapper/src/TestingAccessWrapper.php:114 14:04:37 /workspace/src/tests/phpunit/structure/RestStructureTest.php:153
There seems to be a duplication of part of the path (/workspace/src/)...