You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After updating from Symfony 5.3 to Symfony 5.4, our code started to crash. This is because new PhpStanExtractor was introduced that was prioritized above older extractors. This extractor started to return null type and hence serializer failed to denormalize our objects.
It returns null, because this is a UnionTypeNode containing ConstTypeNode and IdentifierTypeNode (null). However PhpStanTypeHelper doesn't handle ConstTypeNode and hence symfony/property-info will return null only.
Similar issue is for @var non-empty-array<int, string> with error like
Symfony\Component\Serializer\Exception\NotNormalizableValueException : The type of the "slugs" attribute for class "Haushalt\Bl\DomainBundle\Domain\Routing\Entity\RouteInformation" must be one of "Haushalt\Bl\DomainBundle\Domain\Routing\Entity\non-empty-array" ("array" given).
This PR was squashed before being merged into the 5.4 branch.
Discussion
----------
[PropertyInfo] Fix phpstan extractor issues
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#44491
| License | MIT
| Doc PR |
Since this crashes denormalization for codebase that was upgraded from 5.3 to 5.4, I am classifying this as a bugfix.
This PR fixes 2 issues. One is with docblocks like `/** `@var` Foo::*|null */`, where Extractor returns `null` only and afterwards Serializer fails to accept anything else. Second is `/** `@var` non-empty-array<...> */` where extractor doesn't recognize that `non-empty-array` is still an array and afterwards Serializer fails complaining that `array` is not an `non-empty-array`
Commits
-------
0302128 [PropertyInfo] Fix phpstan extractor issues
Uh oh!
There was an error while loading. Please reload this page.
Description
After updating from Symfony 5.3 to Symfony 5.4, our code started to crash. This is because new PhpStanExtractor was introduced that was prioritized above older extractors. This extractor started to return
null
type and hence serializer failed to denormalize our objects.It returns null, because this is a UnionTypeNode containing ConstTypeNode and IdentifierTypeNode (null). However PhpStanTypeHelper doesn't handle ConstTypeNode and hence symfony/property-info will return
null
only.Example
On Symfony 5.3, this returns string|null. On Symfony 5.4, because PhpStanExtractor was added which doesn't correctly handle unions, it returns null.
The text was updated successfully, but these errors were encountered: