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

Use setTypehint and setDocTypes instead of just setType and addComment #49

Closed sidux closed 4 years ago

sidux commented 4 years ago

Hi,

It would be interesting if you handle phpdoc types as actual types with automatic resolution by adding methods addDocType($type, $description), getDocTypes and getTypeHint, setTypeHint for the default typing. The getTypes will return a merge of both.

Using https://github.com/Roave/BetterReflection will make it easier.

If you are interested in can create a PR for that.

dg commented 4 years ago

I don't know what you exactly need it for, but the goal of this library is to generate code, not class representations (a reflection), so I think it wouldn't be able to do these things.