Commit d34eaeb
committed
bug #61728 [TypeInfo] Fix issue with merging union type with a nullable union type (matijn-made)
This PR was merged into the 7.3 branch.
Discussion
----------
[TypeInfo] Fix issue with merging union type with a nullable union type
| Q | A
| ------------- | ---
| Branch? | 7.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues |
| License | MIT
The new TypeInfo component doesn't handle this situation correctly.
Found this after upgrading to 7.3, where the PropertyInfo now calls TypeInfo, given this docblock:
```php
/**
* `@phpstan`-type NullableUnionType = string|int|null
* `@phpstan`-type UnionWithNullableUnionType = float|NullableUnionType
*/
```
In 7.3 it will throw `Symfony\Component\TypeInfo\Exception\InvalidArgumentException: Cannot set "Symfony\Component\TypeInfo\Type\UnionType" as a "Symfony\Component\TypeInfo\Type\UnionType" part.` exception.
This PR makes sure that nullable union types are also merged, before being passed to a new UnionType
Commits
-------
3f4e4228fd6 Fix issue with merging union type with a nullable union type2 files changed
+5
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
207 | 211 | | |
208 | 212 | | |
209 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
303 | | - | |
304 | | - | |
| 302 | + | |
305 | 303 | | |
306 | 304 | | |
307 | 305 | | |
| |||
0 commit comments