Skip to content

ext/standard: Add get_declared_enums function #15443

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ayesh
Copy link
Member

@Ayesh Ayesh commented Aug 16, 2024

Adds a get_declared_enums() function that returns a list of declared Enums. This function is similar to the existing get_declared_(classes|interfaces|traits) functions.

RFC: https://wiki.php.net/rfc/get_declared_enums

@Ayesh Ayesh changed the title ext/standard: Add \get_declared_enums\ function ext/standard: Add get_declared_enums function Aug 16, 2024
@Ayesh Ayesh force-pushed the get_declared_enums-2 branch from cea03f6 to f702eaf Compare August 16, 2024 15:02
@Ayesh Ayesh force-pushed the get_declared_enums-2 branch from f702eaf to 45b80b8 Compare August 16, 2024 15:56
@Ayesh Ayesh force-pushed the get_declared_enums-2 branch 2 times, most recently from 9c8f154 to 18d4150 Compare August 16, 2024 16:43
@Ayesh Ayesh force-pushed the get_declared_enums-2 branch from 18d4150 to 7c38bc2 Compare August 17, 2024 04:12
@cmb69 cmb69 added the RFC label Aug 18, 2024
@Ayesh Ayesh force-pushed the get_declared_enums-2 branch from 7c38bc2 to 7192914 Compare August 21, 2024 17:58
Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any problems.
Not sure if somebody need this, but implementation is really small.

@iluuu1994 please make a final decision.

@Ayesh
Copy link
Member Author

Ayesh commented Aug 26, 2024

Thank you so much @dstogov for the review.
@jrfnl started a draft RFC (https://wiki.php.net/rfc/get_declared_enums) about changing class_exists() and get_declared_classes() to not count Enums as classes. This PR covers the first part of adding a get_declared_enums function (which is not a breaking change).

If the RMs / @iluuu1994 would like to have this on PHP 8.4, that'll be super awesome!

@jrfnl
Copy link
Contributor

jrfnl commented Aug 26, 2024

@dstogov FYI: Based on a preliminary discussion about this on the internals mailing list, this will need an RFC. I've prepared one in draft and we (@Ayesh and me) intend to open the formal discussion period for the RFC some time this week (probably once the discussion around default expressions has died down a little).

@jrfnl
Copy link
Contributor

jrfnl commented Aug 26, 2024

@Ayesh snap! What a timing ;-)

@cmb69

This comment was marked as off-topic.

@iluuu1994

This comment was marked as off-topic.

@cmb69

This comment was marked as off-topic.

@cmb69

This comment was marked as off-topic.

Adds a `get_declared_enums()` function that returns a list of declared Enums.
This function is similar to the existing `get_declared_(classes|interfaces|traits)` functions.

Co-Authored-By: Ilija Tovilo <[email protected]>
@Ayesh Ayesh force-pushed the get_declared_enums-2 branch from 2b9ffa9 to 2aa0770 Compare October 16, 2024 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants