Repository navigation
Conversation
Revinand
requested review from
CodeWithKyrian,
Nyholm,
chr-hertel and
soyuka
as code owners
October 21, 2026 11:12
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #612
Why it fails
SchemaGeneratordecides whether a parameter is nullable by searching its type string fornull(str_contains()inparseParametersInfo(),stripos()on the DocBlock type ingetParameterTypeString()). Forarray{name: string, nickname: string|null}thenullof thenicknamekey matches, so the parameter becomesarray|nulland the shape is dropped. Shape keys that are unions, such as?stringorint|string, went tomapSimpleTypeToJsonSchema()whole and fell back toobject.Change
hasNullBranch(), which looks fornullamong the top-level branches fromsplitUnion(). Anullinside a shape or generic no longer makes the parameter nullable;array{id: int}|nullstill does.parsePropertyDefinition()maps each branch of a key's union, sostring|nullbecomes["string", "null"],?stringbecomes["null", "string"]andint|stringbecomes["integer", "string"].CHANGELOG.mdentry under a new 0.9.1 heading.The third substring check, in
getTypeStringFromReflection(), works on the reflection type, which cannot hold a shape, so I left it as is.Verification
PHP 8.5.11 (composer:2 image),
composer install.testKeepsNullableAndUnionKeysOfArrayShapesInsideTheShape: on main it fails becausenullUnionMembergets['array', 'null']with emptyitems. With the change it passes.php-cs-fixer fix --dry-run: clean.tools/callreturns-32602. With the changetools/listshows the shape and both{"name": "Ada", "nickname": null}and{"name": "Ada", "nickname": "Countess"}are accepted.Not run
The interop and conformance suites.