Skip to content

ReflectionConstant in PHP 8.4 does not offer declaration file information #15723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
janedbal opened this issue Sep 3, 2024 · 4 comments
Closed

Comments

@janedbal
Copy link

janedbal commented Sep 3, 2024

Description

When I spotted this new reflection class, I was hoping I could use it for detection of originated vendor package. But as I can see, there is no getFileName method. Is this due to some technical limitation or can that be added? Thank you

cc @iluuu1994

@iluuu1994
Copy link
Member

Hi @janedbal. Yes, we don't currently have this information available at runtime. You can leave this open as a feature request.

DanielEScherzer added a commit to DanielEScherzer/php-src that referenced this issue Sep 12, 2024
Allow determining the name of the file that defined a constant, when the
constant was defined in userland code via `define()`. For constants defined by
PHP core or extensions, `false` is returned, matching the existing
`getFileName()` methods on other reflection classes.
@DanielEScherzer
Copy link
Member

Unfortunately my understanding is that it is too late to include this in 8.4 as a new feature, since we have already tagged the first release candidate, but I've sent a PR at #15847

@iluuu1994
Copy link
Member

iluuu1994 commented Sep 12, 2024

That doesn't sound right, RC1 is scheduled for September 26th. I think they are only tagged 2 days prior.

@DanielEScherzer
Copy link
Member

That doesn't sound right, RC1 is scheduled for September 26th. I think they are only tagged 2 days prior.

Oh, I guess I misread the last tag - good to know that this can still be included

DanielEScherzer added a commit to DanielEScherzer/php-src that referenced this issue Sep 19, 2024
Allow determining the name of the file that defined a constant, when the
constant was defined in userland code via `define()`. For constants defined by
PHP core or extensions, `false` is returned, matching the existing
`getFileName()` methods on other reflection classes.
DanielEScherzer added a commit to DanielEScherzer/php-src that referenced this issue Oct 8, 2024
Allow determining the name of the file that defined a constant, when the
constant was defined in userland code via `define()`. For constants defined by
PHP core or extensions, `false` is returned, matching the existing
`getFileName()` methods on other reflection classes.
DanielEScherzer added a commit to DanielEScherzer/php-src that referenced this issue Oct 25, 2024
Allow determining the name of the file that defined a constant, when the
constant was defined in userland code via `define()`. For constants defined by
PHP core or extensions, `false` is returned, matching the existing
`getFileName()` methods on other reflection classes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants