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
I'd prefer to keep my classes free of any attributes. I have already fully typed properties, e.g. collections are typed as array<Product> so there's no really a need for additional annotation since the type can be already inferred.
Unfortunately that would require bringing in a docblock parser, which is a whole other ball of code on its own. Serde goes all-in on attributes specifically for that reason: The attribute parsing is built into the PHP engine, whereas using docblocks would require either some ugly string parsing hack or bringing in a larger existing library like Doctrine annotations. Not using Doctrine Annotations is a deliberate design goal for Serde.
This is exactly why attributes are such a good new feature: You don't need your own user-space parser anymore.
I might accept a patch that does one-off parsing of just@var if it's small and robust enough, but it's not something I am planning to work on myself.
Detailed description
Docs mention similar snippet like this:
Could it support docblocks so we don't have to add additional attributes?
Context
I'd prefer to keep my classes free of any attributes. I have already fully typed properties, e.g. collections are typed as
array<Product>
so there's no really a need for additional annotation since the type can be already inferred.So I'd like
work the same as
public int $i
.The text was updated successfully, but these errors were encountered: