Fix nullable PHP model hydration for empty strings#1440
Conversation
Greptile SummaryThis PR adds a narrow three-line guard to Confidence Score: 5/5Safe to merge — the fix is minimal, correctly scoped, and the prior guard-ordering concern is resolved. Single-file change with a 3-line guard that is logically correct; previous reviewer concern about ordering was addressed in the refining commit; no other issues found. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "Scope nullable PHP hydration to from()-b..." | Re-trigger Greptile |
Summary
nullduring PHP model hydration when the generated property type is nullablefrom()-hydrated values so optional enum/model fields no longer throw on wire-level""sentinelsContext
The PHP generator now emits nullable model properties for some response fields, but the shared
ArraySerializablehydrator still passed""intoType::from(...). That causes hydration failures for nullable enum-like fields where the API uses an empty string as an unset sentinel.Testing
docker run --rm -v $(pwd):/app -w /app php:8.3-cli php example.php phpcomposer lint-twigvendor/bin/phpunit tests/PHP83Test.php