From fbda084836ce426367cb9447c67f54228aeca050 Mon Sep 17 00:00:00 2001 From: soyuka Date: Fri, 11 Sep 2026 14:42:19 +0200 Subject: [PATCH 1/2] fix(metadata): add BadRequestException for 4.3 src/Mcp references ApiPlatform\Metadata\Exception\BadRequestException, which only existed from 4.4 on. The 4.3 MCP jobs passed only because #8522 had pinned the metadata sibling to ^5.0@alpha; with the correct ^4.3 constraint restored they fail with "Class not found". Copied verbatim from 4.4 so the merge-up is a no-op. Fixes the 6 api-platform/mcp jobs (2 errors each) and PHPStan (4 errors). --- .../Exception/BadRequestException.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/Metadata/Exception/BadRequestException.php diff --git a/src/Metadata/Exception/BadRequestException.php b/src/Metadata/Exception/BadRequestException.php new file mode 100644 index 00000000000..414a510b228 --- /dev/null +++ b/src/Metadata/Exception/BadRequestException.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace ApiPlatform\Metadata\Exception; + +/** + * Framework-agnostic 400 Bad Request, mapped by both the Symfony and Laravel error handlers. + */ +class BadRequestException extends \RuntimeException implements ExceptionInterface, HttpExceptionInterface +{ + public function getStatusCode(): int + { + return 400; + } + + /** + * @return array + */ + public function getHeaders(): array + { + return []; + } +} From 8a9dfd6d91cbc389d91eb1d3f9c921a200ca31bd Mon Sep 17 00:00:00 2001 From: soyuka Date: Fri, 11 Sep 2026 14:53:50 +0200 Subject: [PATCH 2/2] fix(mcp): update tools/list schema expectation #8522 rewrote array `type` nodes into anyOf branches in Mcp\JsonSchema\SchemaFactory (see #8504) but left McpTest::testToolsList asserting the old `type: [string, null]` shape, so it was merged red. This single assertion accounts for the failure in all 11 PHPUnit jobs on 4.3. --- tests/Functional/McpTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Functional/McpTest.php b/tests/Functional/McpTest.php index 5cff5220061..7794f671e5e 100644 --- a/tests/Functional/McpTest.php +++ b/tests/Functional/McpTest.php @@ -470,7 +470,7 @@ public function testToolsList(): void 'id' => ['type' => 'integer'], 'title' => ['type' => 'string'], 'isbn' => ['type' => 'string'], - 'status' => ['type' => ['string', 'null']], + 'status' => ['anyOf' => [['type' => 'string'], ['type' => 'null']]], ], ], ],