# Adding new `ReflectionConstant::getFileName()`

- Thread: https://externals.io/message/125571
- Original archive: https://news-web.php.net/php.internals/125571
- Started by Daniel Scherzer on 2024-09-16T18:00:25+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #125571 — Daniel Scherzer — 2024-09-16T18:00:25+00:00

URL: https://externals.io/message/125571#125571

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

---

## #125585 — Gina P. Banyard — 2024-09-17T15:58:24+00:00

URL: https://externals.io/message/125571#125585 · In reply to: #125571

> 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
