File tree 4 files changed +52
-17
lines changed
4 files changed +52
-17
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ static zend_class_entry *zend_test_class;
38
38
static zend_class_entry * zend_test_child_class ;
39
39
static zend_class_entry * zend_test_trait ;
40
40
static zend_class_entry * zend_test_attribute ;
41
+ static zend_class_entry * zend_test_repeatable_attribute ;
41
42
static zend_class_entry * zend_test_parameter_attribute ;
42
43
static zend_class_entry * zend_test_property_attribute ;
43
44
static zend_class_entry * zend_test_class_with_method_with_parameter_attribute ;
@@ -684,6 +685,9 @@ PHP_MINIT_FUNCTION(zend_test)
684
685
attr -> validator = zend_attribute_validate_zendtestattribute ;
685
686
}
686
687
688
+ zend_test_repeatable_attribute = register_class_ZendTestRepeatableAttribute ();
689
+ zend_mark_internal_attribute (zend_test_repeatable_attribute );
690
+
687
691
zend_test_parameter_attribute = register_class_ZendTestParameterAttribute ();
688
692
zend_mark_internal_attribute (zend_test_parameter_attribute );
689
693
Original file line number Diff line number Diff line change @@ -49,22 +49,25 @@ public function returnsThrowable(): Exception {}
49
49
50
50
trait _ZendTestTrait {
51
51
/** @var int */
52
- #[ZendTestAttribute ]
53
- #[ZendTestAttribute ]
52
+ #[ZendTestRepeatableAttribute ]
53
+ #[ZendTestRepeatableAttribute ]
54
54
public const TEST_CONST = 1 ;
55
55
56
56
/** @var mixed */
57
- #[ZendTestAttribute ]
57
+ #[ZendTestRepeatableAttribute ]
58
58
#[ZendTestPropertyAttribute("testProp " )]
59
59
public $ testProp ;
60
60
61
61
#[ZendTestAttribute]
62
62
public function testMethod (): bool {}
63
63
}
64
64
65
- #[Attribute(Attribute::TARGET_ALL |Attribute:: IS_REPEATABLE )]
65
+ #[Attribute(Attribute::TARGET_ALL )]
66
66
final class ZendTestAttribute {
67
+ }
67
68
69
+ #[Attribute(Attribute::TARGET_ALL |Attribute::IS_REPEATABLE )]
70
+ final class ZendTestRepeatableAttribute {
68
71
}
69
72
70
73
#[Attribute(Attribute::TARGET_PARAMETER )]
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ class Foo {
11
11
12
12
$ reflectionConstant = new ReflectionClassConstant (Foo::class, "TEST_CONST " );
13
13
var_dump ($ reflectionConstant ->getAttributes ()[0 ]->newInstance ());
14
+ var_dump ($ reflectionConstant ->getAttributes ()[1 ]->newInstance ());
14
15
15
16
$ reflectionProperty = new ReflectionProperty (Foo::class, "testProp " );
16
17
var_dump ($ reflectionProperty ->getAttributes ()[0 ]->newInstance ());
@@ -21,9 +22,11 @@ var_dump($reflectionMethod->getAttributes()[0]->newInstance());
21
22
22
23
?>
23
24
--EXPECTF--
24
- object(ZendTestAttribute )#%d (%d) {
25
+ object(ZendTestRepeatableAttribute )#%d (%d) {
25
26
}
26
- object(ZendTestAttribute)#%d (%d) {
27
+ object(ZendTestRepeatableAttribute)#%d (%d) {
28
+ }
29
+ object(ZendTestRepeatableAttribute)#%d (%d) {
27
30
}
28
31
object(ZendTestPropertyAttribute)#%d (%d) {
29
32
["parameter"]=>
You can’t perform that action at this time.
0 commit comments