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
Trying to deserialize some DTO that receives an enum-array as parameter in the constructor. That enum is defined in a different namespace then the DTO. The type is annotated in the doc block.
How to reproduce
Setup
namespace App\AuthServer\Aggregate\AuthApp;
use App\AuthServer\Entity\OAuth\Scope;
class ClientCreated
{
/**
* @param Scope[] $scopes
*/
public function __construct(
public readonly array $scopes,
) {}
}
I think that it is rather linked to the fact that the property is promoted. Indeed, actually, promoted property's PHPDoc was unexpectedly ignored. This PR should fix it.
This PR was merged into the 7.2 branch.
Discussion
----------
[TypeInfo] Fix promoted property phpdoc reading
| Q | A
| ------------- | ---
| Branch? | 7.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix#59650
| License | MIT
The read of promoted property's PHPDoc was missing in `PhpDocAwareReflectionTypeResolver`.
This PR adds it.
Commits
-------
90dc4ee [TypeInfo] Fix promoted property phpdoc reading
Symfony version(s) affected
7.2.x
Description
Trying to deserialize some DTO that receives an enum-array as parameter in the constructor. That enum is defined in a different namespace then the DTO. The type is annotated in the doc block.
How to reproduce
Setup
Call
Different variations fail as well (e.g.
list<Scope>
).Possible Solution
I traced this down to the
StringTypeResolver
/TypeContext
:The use is not respected here, and therefore this returns the wrong full class of
App\AuthServer\Aggregate\AuthApp\Scope
Additional Context
Using the FQCN in the docblock works:
The text was updated successfully, but these errors were encountered: