Skip to content

Commit 2abe28b

Browse files
committed
Remove trait test
1 parent d16c6fe commit 2abe28b

File tree

4 files changed

+49
-12
lines changed

4 files changed

+49
-12
lines changed

ext/zend_test/test.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ ZEND_DECLARE_MODULE_GLOBALS(zend_test)
3737
static zend_class_entry *zend_test_interface;
3838
static zend_class_entry *zend_test_class;
3939
static zend_class_entry *zend_test_child_class;
40+
static zend_class_entry *zend_attribute_test_class;
4041
static zend_class_entry *zend_test_trait;
4142
static zend_class_entry *zend_test_attribute;
4243
static zend_class_entry *zend_test_repeatable_attribute;
@@ -597,6 +598,12 @@ static ZEND_METHOD(_ZendTestChildClass, returnsThrowable)
597598
zend_throw_error(NULL, "Dummy");
598599
}
599600

601+
static ZEND_METHOD(ZendAttributeTest, testMethod)
602+
{
603+
ZEND_PARSE_PARAMETERS_NONE();
604+
RETURN_TRUE;
605+
}
606+
600607
static ZEND_METHOD(_ZendTestTrait, testMethod)
601608
{
602609
ZEND_PARSE_PARAMETERS_NONE();
@@ -727,6 +734,8 @@ PHP_MINIT_FUNCTION(zend_test)
727734
memcpy(&zend_test_class_handlers, &std_object_handlers, sizeof(zend_object_handlers));
728735
zend_test_class_handlers.get_method = zend_test_class_method_get;
729736

737+
zend_attribute_test_class = register_class_ZendAttributeTest();
738+
730739
zend_test_trait = register_class__ZendTestTrait();
731740

732741
register_test_symbols(module_number);

ext/zend_test/test.stub.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class _ZendTestChildClass extends _ZendTestClass
5252
public function returnsThrowable(): Exception {}
5353
}
5454

55-
trait _ZendTestTrait {
55+
class ZendAttributeTest {
5656
/** @var int */
5757
#[ZendTestRepeatableAttribute]
5858
#[ZendTestRepeatableAttribute]
@@ -67,6 +67,13 @@ trait _ZendTestTrait {
6767
public function testMethod(): bool {}
6868
}
6969

70+
trait _ZendTestTrait {
71+
/** @var mixed */
72+
public $testProp;
73+
74+
public function testMethod(): bool {}
75+
}
76+
7077
#[Attribute(Attribute::TARGET_ALL)]
7178
final class ZendTestAttribute {
7279
}

ext/zend_test/test_arginfo.h

Lines changed: 29 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/zend_test/tests/gen_stub_test_03.phpt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,15 @@ zend_test
55
--FILE--
66
<?php
77

8-
class Foo {
9-
use _ZendTestTrait;
10-
}
11-
12-
$reflectionConstant = new ReflectionClassConstant(Foo::class, "TEST_CONST");
8+
$reflectionConstant = new ReflectionClassConstant(ZendAttributeTest::class, "TEST_CONST");
139
var_dump($reflectionConstant->getAttributes()[0]->newInstance());
1410
var_dump($reflectionConstant->getAttributes()[1]->newInstance());
1511

16-
$reflectionProperty = new ReflectionProperty(Foo::class, "testProp");
12+
$reflectionProperty = new ReflectionProperty(ZendAttributeTest::class, "testProp");
1713
var_dump($reflectionProperty->getAttributes()[0]->newInstance());
1814
var_dump($reflectionProperty->getAttributes()[1]->newInstance());
1915

20-
$reflectionMethod = new ReflectionMethod(Foo::class, "testMethod");
16+
$reflectionMethod = new ReflectionMethod(ZendAttributeTest::class, "testMethod");
2117
var_dump($reflectionMethod->getAttributes()[0]->newInstance());
2218

2319
?>

0 commit comments

Comments
 (0)