Skip to content

Commit bac8040

Browse files
committed
Fix unrelated test failure and apply suggestion from code review
1 parent 0850914 commit bac8040

File tree

4 files changed

+52
-17
lines changed

4 files changed

+52
-17
lines changed

ext/zend_test/test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static zend_class_entry *zend_test_class;
3939
static zend_class_entry *zend_test_child_class;
4040
static zend_class_entry *zend_test_trait;
4141
static zend_class_entry *zend_test_attribute;
42+
static zend_class_entry *zend_test_repeatable_attribute;
4243
static zend_class_entry *zend_test_parameter_attribute;
4344
static zend_class_entry *zend_test_property_attribute;
4445
static zend_class_entry *zend_test_class_with_method_with_parameter_attribute;
@@ -736,6 +737,9 @@ PHP_MINIT_FUNCTION(zend_test)
736737
attr->validator = zend_attribute_validate_zendtestattribute;
737738
}
738739

740+
zend_test_repeatable_attribute = register_class_ZendTestRepeatableAttribute();
741+
zend_mark_internal_attribute(zend_test_repeatable_attribute);
742+
739743
zend_test_parameter_attribute = register_class_ZendTestParameterAttribute();
740744
zend_mark_internal_attribute(zend_test_parameter_attribute);
741745

ext/zend_test/test.stub.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,25 @@ public function returnsThrowable(): Exception {}
5454

5555
trait _ZendTestTrait {
5656
/** @var int */
57-
#[ZendTestAttribute]
58-
#[ZendTestAttribute]
57+
#[ZendTestRepeatableAttribute]
58+
#[ZendTestRepeatableAttribute]
5959
public const TEST_CONST = 1;
6060

6161
/** @var mixed */
62-
#[ZendTestAttribute]
62+
#[ZendTestRepeatableAttribute]
6363
#[ZendTestPropertyAttribute("testProp")]
6464
public $testProp;
6565

6666
#[ZendTestAttribute]
6767
public function testMethod(): bool {}
6868
}
6969

70-
#[Attribute(Attribute::TARGET_ALL|Attribute::IS_REPEATABLE)]
70+
#[Attribute(Attribute::TARGET_ALL)]
7171
final class ZendTestAttribute {
72+
}
7273

74+
#[Attribute(Attribute::TARGET_ALL|Attribute::IS_REPEATABLE)]
75+
final class ZendTestRepeatableAttribute {
7376
}
7477

7578
#[Attribute(Attribute::TARGET_PARAMETER)]

ext/zend_test/test_arginfo.h

Lines changed: 36 additions & 11 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: 5 additions & 2 deletions
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)