Skip to content

Commit d11c94a

Browse files
committed
Fix unrelated test failure and apply suggestion from code review
1 parent 616e1d3 commit d11c94a

File tree

4 files changed

+52
-17
lines changed

4 files changed

+52
-17
lines changed

ext/zend_test/test.c

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static zend_class_entry *zend_test_class;
3838
static zend_class_entry *zend_test_child_class;
3939
static zend_class_entry *zend_test_trait;
4040
static zend_class_entry *zend_test_attribute;
41+
static zend_class_entry *zend_test_repeatable_attribute;
4142
static zend_class_entry *zend_test_parameter_attribute;
4243
static zend_class_entry *zend_test_property_attribute;
4344
static zend_class_entry *zend_test_class_with_method_with_parameter_attribute;
@@ -684,6 +685,9 @@ PHP_MINIT_FUNCTION(zend_test)
684685
attr->validator = zend_attribute_validate_zendtestattribute;
685686
}
686687

688+
zend_test_repeatable_attribute = register_class_ZendTestRepeatableAttribute();
689+
zend_mark_internal_attribute(zend_test_repeatable_attribute);
690+
687691
zend_test_parameter_attribute = register_class_ZendTestParameterAttribute();
688692
zend_mark_internal_attribute(zend_test_parameter_attribute);
689693

ext/zend_test/test.stub.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,25 @@ public function returnsThrowable(): Exception {}
4949

5050
trait _ZendTestTrait {
5151
/** @var int */
52-
#[ZendTestAttribute]
53-
#[ZendTestAttribute]
52+
#[ZendTestRepeatableAttribute]
53+
#[ZendTestRepeatableAttribute]
5454
public const TEST_CONST = 1;
5555

5656
/** @var mixed */
57-
#[ZendTestAttribute]
57+
#[ZendTestRepeatableAttribute]
5858
#[ZendTestPropertyAttribute("testProp")]
5959
public $testProp;
6060

6161
#[ZendTestAttribute]
6262
public function testMethod(): bool {}
6363
}
6464

65-
#[Attribute(Attribute::TARGET_ALL|Attribute::IS_REPEATABLE)]
65+
#[Attribute(Attribute::TARGET_ALL)]
6666
final class ZendTestAttribute {
67+
}
6768

69+
#[Attribute(Attribute::TARGET_ALL|Attribute::IS_REPEATABLE)]
70+
final class ZendTestRepeatableAttribute {
6871
}
6972

7073
#[Attribute(Attribute::TARGET_PARAMETER)]

ext/zend_test/test_arginfo.h

+36-11
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_02.phpt

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Foo {
1111

1212
$reflectionConstant = new ReflectionClassConstant(Foo::class, "TEST_CONST");
1313
var_dump($reflectionConstant->getAttributes()[0]->newInstance());
14+
var_dump($reflectionConstant->getAttributes()[1]->newInstance());
1415

1516
$reflectionProperty = new ReflectionProperty(Foo::class, "testProp");
1617
var_dump($reflectionProperty->getAttributes()[0]->newInstance());
@@ -21,9 +22,11 @@ var_dump($reflectionMethod->getAttributes()[0]->newInstance());
2122

2223
?>
2324
--EXPECTF--
24-
object(ZendTestAttribute)#%d (%d) {
25+
object(ZendTestRepeatableAttribute)#%d (%d) {
2526
}
26-
object(ZendTestAttribute)#%d (%d) {
27+
object(ZendTestRepeatableAttribute)#%d (%d) {
28+
}
29+
object(ZendTestRepeatableAttribute)#%d (%d) {
2730
}
2831
object(ZendTestPropertyAttribute)#%d (%d) {
2932
["parameter"]=>

0 commit comments

Comments
 (0)