New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Serializer] Extract types of constructor parameters from docblock comment #25524
Comments
@lyrixx maybe something you'd like to do since you're in that kind of business these days? :) |
Ahah, Good try ;) I'm currently moving an API to api platform and I'm hitting E_TOO_MANY_BUGS (symfony, flex/recipes, api-platform/core and api-platform/docs) So I'm sorry but I think I will not be able to implement this feature |
Isn't this related to #25605? |
@dunglas any thoughs on how to fix this ? |
I found in one normalizer test:
Using PhpDocExtractor, activates reading blocks like:
It supports after 3.4 (#29513) Only update documentation required |
@dvc day-saver thx! :) |
Just some link that I was inspired by: My finally serializer that can successfully deserialize nested arrays of objects is: $extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
$converter = new CamelCaseToSnakeCaseNameConverter();
$normalizers = [
new DateTimeNormalizer(),
new ArrayDenormalizer(),
new ObjectNormalizer(null, $converter, null, $extractor),
];
$encoders = [new JsonEncoder()];
return new Serializer($normalizers, $encoders); |
Currenly PhpDocExtractor works only with class properties. It's not possible to clarify the type of the constructor parameter through docblock comment.
Expected result:
Actual result:
The text was updated successfully, but these errors were encountered: