Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
UseCase
I have a API which I consume and I want to map this to objects.
With PHP8.1 you have the wonderful support of readonly properties.
This works actual perfect with the json mapper and reduces the amount of boilerplate code to near zero.
My problem is, that the API I consume, often uses snake_case names and because of that I have to add setter functions to the model class. This leads to errors because you can not reset the property with a setter if it is a readonly property. There for I have to make it private and add a getter. All the boilerplate code is back.
Suggestion
So my suggestions is to add a new flag to support converting property keys to camelCase if they are not found.
I am not really confident with the naming so I am open for a better naming.
If you are fine with this I would add it to the readme to explain the usage.