Dear Internals,
Last week I sent a patch[1] to address a feature request[2] for a way to identify at runtime what file a constant was declared in. Since this adds the filename (a zend_string
) to every zend_constant
instance, it is not the most trivial of changes.
It was suggested[3] by iluuu1994 that this may qualify as a small change that can be merged without an RFC, if there are no objections on the mailing list. So, are there any objections?
I’ll note that the ReflectionConstant
class was added[4] as part of PHP 8.4, so it would be great if this new method could also be included as part of the 8.4 release.
Thanks,
–Daniel Scherzer (https://github.com/DanielEScherzer)
[1] https://github.com/php/php-src/pull/15847
[2] https://github.com/php/php-src/issues/15723
[3] https://github.com/php/php-src/pull/15847#issuecomment-2345774089
[4] https://github.com/php/php-src/pull/13669
On Monday, 16 September 2024 at 20:00, Daniel Scherzer <daniel.e.scherzer@gmail.com> wrote:
Dear Internals,
Last week I sent a patch[1] to address a feature request[2] for a way to identify at runtime what file a constant was declared in. Since this adds the filename (a `zend_string`) to every `zend_constant` instance, it is not the most trivial of changes.
It was suggested[3] by iluuu1994 that this may qualify as a small change that can be merged without an RFC, if there are no objections on the mailing list. So, are there any objections?
I'll note that the `ReflectionConstant` class was added[4] as part of PHP 8.4, so it would be great if this new method could also be included as part of the 8.4 release.
Thanks,
--Daniel Scherzer (DanielEScherzer · GitHub)
[1] GH-15723: add `ReflectionConstant::getFileName()` by DanielEScherzer · Pull Request #15847 · php/php-src · GitHub
[2] `ReflectionConstant` in PHP 8.4 does not offer declaration file information · Issue #15723 · php/php-src · GitHub
[3] GH-15723: add `ReflectionConstant::getFileName()` by DanielEScherzer · Pull Request #15847 · php/php-src · GitHub
[4] Implement ReflectionConstant by iluuu1994 · Pull Request #13669 · php/php-src · GitHub
I think this makes sense and I'm in favour of having this part of 8.4.
Best regards,
Gina P. Banyard