Skip to content

Commit b2a274f

Browse files
committed
Remove test for repeatable attributes
1 parent 8dee6ba commit b2a274f

File tree

4 files changed

+53
-71
lines changed

4 files changed

+53
-71
lines changed

ext/zend_test/test.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ 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;
42-
static zend_class_entry *zend_test_repeatable_attribute;
4343
static zend_class_entry *zend_test_parameter_attribute;
4444
static zend_class_entry *zend_test_property_attribute;
4545
static zend_class_entry *zend_test_class_with_method_with_parameter_attribute;
@@ -727,6 +727,8 @@ PHP_MINIT_FUNCTION(zend_test)
727727
memcpy(&zend_test_class_handlers, &std_object_handlers, sizeof(zend_object_handlers));
728728
zend_test_class_handlers.get_method = zend_test_class_method_get;
729729

730+
zend_attribute_test_class = register_class_ZendAttributeTest();
731+
730732
zend_test_trait = register_class__ZendTestTrait();
731733

732734
register_test_symbols(module_number);
@@ -737,9 +739,6 @@ PHP_MINIT_FUNCTION(zend_test)
737739
attr->validator = zend_attribute_validate_zendtestattribute;
738740
}
739741

740-
zend_test_repeatable_attribute = register_class_ZendTestRepeatableAttribute();
741-
zend_mark_internal_attribute(zend_test_repeatable_attribute);
742-
743742
zend_test_parameter_attribute = register_class_ZendTestParameterAttribute();
744743
zend_mark_internal_attribute(zend_test_parameter_attribute);
745744

ext/zend_test/test.stub.php

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

55-
trait _ZendTestTrait {
55+
class ZendAttributeTest {
5656
/** @var int */
57-
#[ZendTestRepeatableAttribute]
58-
#[ZendTestRepeatableAttribute]
57+
#[ZendTestAttribute]
5958
public const TEST_CONST = 1;
6059

6160
/** @var mixed */
62-
#[ZendTestRepeatableAttribute]
6361
#[ZendTestPropertyAttribute("testProp")]
6462
public $testProp;
6563

6664
#[ZendTestAttribute]
6765
public function testMethod(): bool {}
6866
}
6967

70-
#[Attribute(Attribute::TARGET_ALL)]
71-
final class ZendTestAttribute {
68+
trait _ZendTestTrait {
69+
/** @var mixed */
70+
public $testProp;
71+
72+
public function testMethod(): bool {}
7273
}
7374

74-
#[Attribute(Attribute::TARGET_ALL|Attribute::IS_REPEATABLE)]
75-
final class ZendTestRepeatableAttribute {
75+
#[Attribute(Attribute::TARGET_ALL)]
76+
final class ZendTestAttribute {
7677
}
7778

7879
#[Attribute(Attribute::TARGET_PARAMETER)]

ext/zend_test/test_arginfo.h

Lines changed: 37 additions & 45 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: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,18 @@ 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());
14-
var_dump($reflectionConstant->getAttributes()[1]->newInstance());
1510

16-
$reflectionProperty = new ReflectionProperty(Foo::class, "testProp");
11+
$reflectionProperty = new ReflectionProperty(ZendAttributeTest::class, "testProp");
1712
var_dump($reflectionProperty->getAttributes()[0]->newInstance());
18-
var_dump($reflectionProperty->getAttributes()[1]->newInstance());
1913

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

2317
?>
2418
--EXPECTF--
25-
object(ZendTestRepeatableAttribute)#%d (%d) {
26-
}
27-
object(ZendTestRepeatableAttribute)#%d (%d) {
28-
}
29-
object(ZendTestRepeatableAttribute)#%d (%d) {
19+
object(ZendTestAttribute)#%d (%d) {
3020
}
3121
object(ZendTestPropertyAttribute)#%d (%d) {
3222
["parameter"]=>

0 commit comments

Comments
 (0)