php-sdk/tests/Unit/Capability/Discovery
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Christopher Hertel ced762614b
[Capability] Stop a union type losing a branch (#434)
* [Capability] Stop a union type losing a branch

mapPhpTypeToJsonSchemaType() tested for array syntax before splitting the
union, so string[]|int mapped to array alone; applyArrayConstraints() then
overwrote the type with array whenever the union contained one, dropping the
scalar branch a second time. A tool declaring such a parameter rejected a
valid integer argument.

The split now happens first and only at the top level, so array<int|string>
and array{a: int|string} stay one type rather than two that do not exist, and
the array branch keeps its items alongside the others - which is what 2020-12
means by items: a constraint that applies only when the instance is an array.

* Apply suggestion from @chr-hertel

* Isolate the array branch before inferring its element type

* Don't apply items to arrays whose union branches disagree on element type
2026-08-18 14:54:52 +02:00
..
Fixtures [Schema][Client][Server] Close MCP Apps gaps: extension negotiation checks (#429) 2026-08-18 01:46:53 +02:00
CachedDiscovererTest.php fix: because the cached discoveryState does not use ->setDiscoveryState(), it is found that the discoveryState cannot be used (#120) 2025-10-26 23:25:09 +01:00
DiscovererToolTitleTest.php [Schema][Server] Add top-level title to Tool (#288) 2026-04-26 15:37:40 +02:00
DiscoveryStateTest.php [Server] Allow runtime-resolved element handlers (#294) 2026-05-29 07:16:12 +02:00
DiscoveryTest.php [Schema][Client][Server] Close MCP Apps gaps: extension negotiation checks (#429) 2026-08-18 01:46:53 +02:00
DocBlockParserTest.php style: apply php-cs-fixer and PHPStan fixes (#289) 2026-04-20 20:49:15 +02:00
DocBlockTestFixture.php feat: Add output schema support to MCP tools (#153) 2026-01-11 21:14:48 +01:00
HandlerResolverTest.php [Server] Allow pre-built instance handlers in element registration (#375) 2026-07-06 01:13:41 +02:00
SchemaGeneratorFixture.php [Schema] Support PHPStan/Psalm integer ranges (#422) 2026-08-16 09:31:28 +02:00
SchemaGeneratorTest.php [Schema] Support PHPStan/Psalm integer ranges (#422) 2026-08-16 09:31:28 +02:00
SchemaGeneratorUnionTest.php [Capability] Stop a union type losing a branch (#434) 2026-08-18 14:54:52 +02:00
SchemaValidatorTest.php style: apply php-cs-fixer and PHPStan fixes (#289) 2026-04-20 20:49:15 +02:00
UnionFixture.php [Capability] Stop a union type losing a branch (#434) 2026-08-18 14:54:52 +02:00