jolicode / automapper

:rocket: Very FAST :rocket: PHP AutoMapper with on the fly code generation
https://automapper.jolicode.com/
MIT License
154 stars 15 forks source link

fix: handle deprecated class LNumber in nikic/php-parser v5 #148

Closed nikophil closed 6 months ago

nikophil commented 6 months ago

I think since the Automapper is the only entrypoint of this whole lib, we can add class_alias() in this class, and problem would be solved.

WDYT?

joelwurtz commented 6 months ago

Not a fan of this, i would keep declaring the alias where it is really needed, not on the AutoMapper class, main problem is that if we change this later (like some lib that don't depend on the AutoMapper class) we would not have those alias

GromNaN commented 6 months ago

Using class_alias for classes that don't belong to this library can lead to other issues (like an other library checking if the class exist ...). That's bad that php-parser doesn't provide a clean migration path. The best would be that php-parser 4.x would have provided the new classes directly.

A clean alternative would be to create factory functions here, that uses the correct class name depending on the php-parser version.

nikophil commented 6 months ago

like an other library checking if the class exist ...

you're right, I did not think about it

The best would be that php-parser 4.x would have provided the new classes directly.

indeed :shrug: this deprecation layer is not really clean IMO

A clean alternative would be to create factory functions here, that uses the correct class name depending on the php-parser version.

this was actually what I done in an earlier version :sweat_smile: