Skip to content

refactor: optimizing extends and implements #193

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

Merged
merged 5 commits into from
Apr 3, 2025

Conversation

jmjoy
Copy link
Member

@jmjoy jmjoy commented Apr 3, 2025

This pull request includes significant refactoring and improvements to the phper/src/classes.rs file. The changes primarily focus on simplifying the handling of zend_class_entry pointers by introducing the InnerClassEntry enum and updating related structures and methods accordingly.

Key changes include:

Refactoring of zend_class_entry Handling:

  • Introduced InnerClassEntry enum to encapsulate zend_class_entry pointers and names, replacing the previous use of Rc<RefCell<*mut zend_class_entry>> and Option<String>. [1] [2]
  • Updated StateClass and Interface structs to use InnerClassEntry for managing zend_class_entry pointers and names. [1] [2]
  • Modified methods in StateClass and Interface to handle the new InnerClassEntry structure, including from_name, null, bind, and as_class_entry. [1] [2]

Simplification of Interface Extensions:

  • Simplified the InterfaceEntity struct by changing the extends field to directly store Interface instances instead of boxed closures.
  • Updated the extends method in InterfaceEntity to push Interface instances directly.
  • Adjusted the binding logic in InterfaceEntity to use the updated Interface structure for class implementations.

Miscellaneous:

  • Consolidated use statements for ptr module in phper/src/classes.rs.

@jmjoy jmjoy requested review from Copilot and brettmc April 3, 2025 05:16
Copilot

This comment was marked as outdated.

@jmjoy jmjoy marked this pull request as draft April 3, 2025 07:04
@jmjoy jmjoy marked this pull request as ready for review April 3, 2025 08:58
@jmjoy
Copy link
Member Author

jmjoy commented Apr 3, 2025

Find a clever solution to #195 : prevent the StateClass created by from_name from calling the new_object method

@jmjoy jmjoy merged commit 944a88a into phper-framework:master Apr 3, 2025
22 checks passed
@jmjoy jmjoy deleted the extends branch April 3, 2025 10:38
This was referenced Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants