Adding new `ReflectionConstant::getFileName()`

php.internals

Daniel Scherzer

1 year ago
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

Gina P. Banyard

1 year ago
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 (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 I think this makes sense and I'm in favour of having this part of 8.4. Best regards, Gina P. Banyard