-
Notifications
You must be signed in to change notification settings - Fork 69
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
implementing Interfaces #163
Comments
nikeee
added a commit
to nikeee/ext-php-rs
that referenced
this issue
Oct 15, 2022
The zend API also has some standard interfaces it exposes: https://github.com/php/php-src/blob/c8c09b4aaee7ac447828564c6267e62eb304135b/Zend/zend_interfaces.h#L27-L33 ``` extern ZEND_API zend_class_entry *zend_ce_traversable; extern ZEND_API zend_class_entry *zend_ce_aggregate; extern ZEND_API zend_class_entry *zend_ce_iterator; extern ZEND_API zend_class_entry *zend_ce_arrayaccess; extern ZEND_API zend_class_entry *zend_ce_serializable; extern ZEND_API zend_class_entry *zend_ce_countable; extern ZEND_API zend_class_entry *zend_ce_stringable; ``` This surfaced in davidcole1340#163 and should make it possible to implement these interfaces.
I don't think I have actually tried to implement an interface, so I will give it a go and report back. To answer your question regarding |
davidcole1340
pushed a commit
to nikeee/ext-php-rs
that referenced
this issue
Oct 16, 2022
The zend API also has some standard interfaces it exposes: https://github.com/php/php-src/blob/c8c09b4aaee7ac447828564c6267e62eb304135b/Zend/zend_interfaces.h#L27-L33 ``` extern ZEND_API zend_class_entry *zend_ce_traversable; extern ZEND_API zend_class_entry *zend_ce_aggregate; extern ZEND_API zend_class_entry *zend_ce_iterator; extern ZEND_API zend_class_entry *zend_ce_arrayaccess; extern ZEND_API zend_class_entry *zend_ce_serializable; extern ZEND_API zend_class_entry *zend_ce_countable; extern ZEND_API zend_class_entry *zend_ce_stringable; ``` This surfaced in davidcole1340#163 and should make it possible to implement these interfaces.
davidcole1340
added a commit
that referenced
this issue
Oct 16, 2022
* Add some standard zend interfaces The zend API also has some standard interfaces it exposes: https://github.com/php/php-src/blob/c8c09b4aaee7ac447828564c6267e62eb304135b/Zend/zend_interfaces.h#L27-L33 ``` extern ZEND_API zend_class_entry *zend_ce_traversable; extern ZEND_API zend_class_entry *zend_ce_aggregate; extern ZEND_API zend_class_entry *zend_ce_iterator; extern ZEND_API zend_class_entry *zend_ce_arrayaccess; extern ZEND_API zend_class_entry *zend_ce_serializable; extern ZEND_API zend_class_entry *zend_ce_countable; extern ZEND_API zend_class_entry *zend_ce_stringable; ``` This surfaced in #163 and should make it possible to implement these interfaces. * Add some links to the php documentation * update docs.rs bindings Co-authored-by: David Cole <david.cole1340@gmail.com>
I tried adding am example in #167. Do the docs fail due to the version with the interface class entries not being released? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The docs state:
How do I use this to implement an interface provided by the standard library of PHP? For example, I want to implement
ArrayAccess
on my own class.My current approach is this:
But the
class
type seems to be private:If I get this to work, how do I actually implement the methods? Does having the appropriate method names suffice (putting renaming of methods aside)?
If this has a solution, I'd love to contribute this to the docs. I really like this library!
The text was updated successfully, but these errors were encountered: