-
-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Description
Need impl 2 interface features:
Rust struct declared as php_class and impl trait declared as php_interface
#[php_interface]
#[php(name = "ExtPhpRs\\Interface\\HelloInterface")]
trait HelloTrait {
fn say_hello(): String;
}
#[php_class]
#[php(name = "ExtPhpRs\\Test")]
struct Test;
impl HelloTrait for Test {
fn say_hello(): String {
String::from("Hello")
}
}<?php
assert(class_exists('ExtPhpRs\Test'), 'Class not exist');
assert(interface_exists('ExtPhpRs\Interface\HelloInterface'), 'Interface not exist');
assert(is_a('ExtPhpRs\Test', ExtPhpRs\Interface\HelloInterface', true));Convert supertrait to interface extending
#[php_interface]
#[php(name = "ExtPhpRs\\Interface\\BaseInterface")]
trait BaseTrait {}
#[php_interface]
#[php(name = "ExtPhpRs\\Interface\\ChildInterface")]
trait ChildTrait: BaseTrait { }<?php
assert(interface_exists('ExtPhpRs\Interface\BaseInterface'), 'Interface not exist');
assert(interface_exists('ExtPhpRs\Interface\ChildInterface'), 'Interface not exist');
assert(is_a('ExtPhpRs\Interface\ChildInterface', 'ExtPhpRs\Interface\BaseInterface', true), 'Interface could extend ExtPhpRs\Interface\BaseInterface');Additional Context
- I can try implementing this feature myself (please assign me to this issue)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request