-
Notifications
You must be signed in to change notification settings - Fork 7.9k
GH-15723: add ReflectionConstant::getFileName()
#15847
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds new behavior in cost of increasing each zend_constant size.
New behavior requires the RFC process and can't go into the feature frozen PHP-8.4.
Personally, I don't see significant value. On the other hand, the cost is not significant.
One of the real-world usages I'd use it for is unused composer package analysis, see current issue |
@DanielEScherzer Thank you for your PR! It's a bit late in the release process but you might still have time to consult the internals mailing list, and ask if there are any objections to adding this in 8.4.
This is no longer accurate. Small feature additions have historically been allowed without requiring RFCs. It's generally understood that they are ok if announced on the ML with no objections. This is indeed vague, and I think we would benefit from specifying this process. Additionally, features are now allowed all the way up to release candidates since https://wiki.php.net/rfc/release_cycle_update. |
I wonder whether it's reasonable to store the line number at the same time? |
I've sent an email to internals (my first one!) - https://news-web.php.net/php.internals/125571 // https://externals.io/message/125571 |
042b6c1
to
25164f2
Compare
There have been no objections on the ML, but unfortunately it has only been posted 5 days ago. 8.4 RC1 is tagged on Tuesday, so I would suggest delaying this for 8.5. |
Thats understandable, but annoying that this won't be included. Can we add the |
How is this evolving? Any chance this gets into PHP 8.4 release? Thanks |
@janedbal No, RC1 has landed. This will be delayed to 8.5. |
25164f2
to
12502f8
Compare
Well, this missed 8.4, but since that has been branched I hope it can be merged for 8.5 - I've rebased to resolve the merge conflict and added an entry to UPGRADING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a bit inconsistent not to offer getStartLine
(getEndLine
might be overkill).
Another note: We don't have this field or getStartLine
on ReflectionClassConstant
. The former we can get through getDeclaringClass
though.
I'd be happy to add |
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.
1f56a2f
to
701b5e5
Compare
Looks good, I merged this now as there were no complaints on the list. Thanks! |
Allow determining the name of the file that defined a constant, when the constant was defined in userland code via
define()
orconst
. For constants defined by PHP core or extensions,false
is returned, matching the existinggetFileName()
methods on other reflection classes.