File tree Expand file tree Collapse file tree 4 files changed +52
-17
lines changed Expand file tree Collapse file tree 4 files changed +52
-17
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ static zend_class_entry *zend_test_class;
39
39
static zend_class_entry * zend_test_child_class ;
40
40
static zend_class_entry * zend_test_trait ;
41
41
static zend_class_entry * zend_test_attribute ;
42
+ static zend_class_entry * zend_test_repeatable_attribute ;
42
43
static zend_class_entry * zend_test_parameter_attribute ;
43
44
static zend_class_entry * zend_test_property_attribute ;
44
45
static zend_class_entry * zend_test_class_with_method_with_parameter_attribute ;
@@ -736,6 +737,9 @@ PHP_MINIT_FUNCTION(zend_test)
736
737
attr -> validator = zend_attribute_validate_zendtestattribute ;
737
738
}
738
739
740
+ zend_test_repeatable_attribute = register_class_ZendTestRepeatableAttribute ();
741
+ zend_mark_internal_attribute (zend_test_repeatable_attribute );
742
+
739
743
zend_test_parameter_attribute = register_class_ZendTestParameterAttribute ();
740
744
zend_mark_internal_attribute (zend_test_parameter_attribute );
741
745
Original file line number Diff line number Diff line change @@ -54,22 +54,25 @@ public function returnsThrowable(): Exception {}
54
54
55
55
trait _ZendTestTrait {
56
56
/** @var int */
57
- #[ZendTestAttribute ]
58
- #[ZendTestAttribute ]
57
+ #[ZendTestRepeatableAttribute ]
58
+ #[ZendTestRepeatableAttribute ]
59
59
public const TEST_CONST = 1 ;
60
60
61
61
/** @var mixed */
62
- #[ZendTestAttribute ]
62
+ #[ZendTestRepeatableAttribute ]
63
63
#[ZendTestPropertyAttribute("testProp " )]
64
64
public $ testProp ;
65
65
66
66
#[ZendTestAttribute]
67
67
public function testMethod (): bool {}
68
68
}
69
69
70
- #[Attribute(Attribute::TARGET_ALL |Attribute:: IS_REPEATABLE )]
70
+ #[Attribute(Attribute::TARGET_ALL )]
71
71
final class ZendTestAttribute {
72
+ }
72
73
74
+ #[Attribute(Attribute::TARGET_ALL |Attribute::IS_REPEATABLE )]
75
+ final class ZendTestRepeatableAttribute {
73
76
}
74
77
75
78
#[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