nette / php-generator

🐘 Generates neat PHP code for you. Supports new PHP 8.3 features.
https://doc.nette.org/php-generator
Other
2.11k stars 138 forks source link

Optimize work with constants (self:: / static::) #101

Closed Eugentis closed 2 years ago

Eugentis commented 2 years ago

While you are working with real classes it can be very useful to have ability to make self and static references in generated consts.

I suppose the most effective and fast approach can be using check of beginning const value. If value string starts from self:: or static:: it should make value as reference.

Now it tries to save it as simple strings....

Is it possible?

mabar commented 2 years ago

Use literal https://github.com/nette/php-generator#literals