[php-src] Issue #20974: Request to add support for `Trait` in the extension layer
| From: | matyhtf | Date: | Mon, 19 Jan 2026 07:17:18 +0000 |
| Subject: | [php-src] Issue #20974: Request to add support for `Trait` in the extension layer | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251569@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20974
Author: matyhtf
### Description
Request to add a new ZendAPI:
zend_class_use_traits that will allow internals classes
in the extension to use Traits.
```c
static zend_class_entry *register_class_TestClass(zend_class_entry *class_entry_TestClassInterface)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "TestClass", class_TestClass_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
zend_class_use_traits(class_entry, 2, class_entry_TraitA, class_entry_TraitB);
}
```