jsonmapper icon indicating copy to clipboard operation
jsonmapper copied to clipboard

php 8.0 constructor property promotion with array and associated annotation

Open wundii opened this issue 11 months ago • 0 comments

The is an extension of JsonMapper for Php 8 to include constructor property promotion with array and associated annotation.

Starting from php 8 version there is constructor property promotion. The reflection always only reads the overlying annotation from the respective property. As soon as you use the new php 8 notation with the constructor, I wrote a small extension. If the read annotation from the reflection class is empty and php greater than 8.0 is used and there exists a constructor, then get this annotation and search there the right element based on the requested variable.

With this extension, the entities can be built much cleaner in php8, if the properties should be private and readonly.

The unit test are passing.

wundii avatar Aug 26 '23 05:08 wundii