@@ -2567,8 +2567,12 @@ function (Name $item) {
2567
2567
$ code .= "\n#if (PHP_VERSION_ID >= " . PHP_82_VERSION_ID . ") " ;
2568
2568
}
2569
2569
2570
- foreach ($ this ->attributes as $ attribute ) {
2571
- $ code .= $ attribute ->generateCode ("zend_add_class_attribute(class_entry " , "class_ $ escapedName " , $ allConstInfos );
2570
+ foreach ($ this ->attributes as $ key => $ attribute ) {
2571
+ $ code .= $ attribute ->generateCode (
2572
+ "zend_add_class_attribute(class_entry " ,
2573
+ "class_ {$ escapedName }_ " . ($ key + 1 ),
2574
+ $ allConstInfos
2575
+ );
2572
2576
}
2573
2577
2574
2578
if (!$ php82MinimumCompatibility ) {
@@ -4134,13 +4138,21 @@ static function (FuncInfo $funcInfo) use ($allConstInfos) {
4134
4138
$ functionTable = "CG(function_table) " ;
4135
4139
}
4136
4140
4137
- foreach ($ funcInfo ->attributes as $ attribute ) {
4138
- $ code .= $ attribute ->generateCode ("zend_add_function_attribute(zend_hash_str_find_ptr( $ functionTable, \"" . $ funcInfo ->name ->getNameForAttributes () . "\", sizeof( \"" . $ funcInfo ->name ->getNameForAttributes () . "\") - 1) " , "func_ " . $ funcInfo ->name ->getNameForAttributes (), $ allConstInfos );
4141
+ foreach ($ funcInfo ->attributes as $ key => $ attribute ) {
4142
+ $ code .= $ attribute ->generateCode (
4143
+ "zend_add_function_attribute(zend_hash_str_find_ptr( $ functionTable, \"" . $ funcInfo ->name ->getNameForAttributes () . "\", sizeof( \"" . $ funcInfo ->name ->getNameForAttributes () . "\") - 1) " ,
4144
+ "func_ " . $ funcInfo ->name ->getNameForAttributes () . "_ " . ($ key + 1 ),
4145
+ $ allConstInfos
4146
+ );
4139
4147
}
4140
4148
4141
4149
foreach ($ funcInfo ->args as $ index => $ arg ) {
4142
- foreach ($ arg ->attributes as $ attribute ) {
4143
- $ code .= $ attribute ->generateCode ("zend_add_parameter_attribute(zend_hash_str_find_ptr( $ functionTable, \"" . $ funcInfo ->name ->getNameForAttributes () . "\", sizeof( \"" . $ funcInfo ->name ->getNameForAttributes () . "\") - 1), $ index " , "func_ {$ funcInfo ->name ->getNameForAttributes ()}_arg {$ index }" , $ allConstInfos );
4150
+ foreach ($ arg ->attributes as $ key => $ attribute ) {
4151
+ $ code .= $ attribute ->generateCode (
4152
+ "zend_add_parameter_attribute(zend_hash_str_find_ptr( $ functionTable, \"" . $ funcInfo ->name ->getNameForAttributes () . "\", sizeof( \"" . $ funcInfo ->name ->getNameForAttributes () . "\") - 1), $ index " ,
4153
+ "func_ {$ funcInfo ->name ->getNameForAttributes ()}_arg {$ index }_ " . ($ key + 1 ),
4154
+ $ allConstInfos
4155
+ );
4144
4156
}
4145
4157
}
4146
4158
@@ -4160,8 +4172,12 @@ function generateConstantAttributeInitialization(iterable $constInfos, iterable
4160
4172
static function (ConstInfo $ constInfo ) use ($ allConstInfos ) {
4161
4173
$ code = null ;
4162
4174
4163
- foreach ($ constInfo ->attributes as $ attribute ) {
4164
- $ code .= $ attribute ->generateCode ("zend_add_class_constant_attribute(class_entry, const_ " . $ constInfo ->name ->getDeclarationName (), "const_ " . $ constInfo ->name ->getDeclarationName (), $ allConstInfos );
4175
+ foreach ($ constInfo ->attributes as $ key => $ attribute ) {
4176
+ $ code .= $ attribute ->generateCode (
4177
+ "zend_add_class_constant_attribute(class_entry, const_ " . $ constInfo ->name ->getDeclarationName (),
4178
+ "const_ " . $ constInfo ->name ->getDeclarationName () . "_ " . ($ key + 1 ),
4179
+ $ allConstInfos
4180
+ );
4165
4181
}
4166
4182
4167
4183
return $ code ;
@@ -4176,8 +4192,12 @@ static function (ConstInfo $constInfo) use ($allConstInfos) {
4176
4192
function generatePropertyAttributeInitialization (iterable $ propertyInfos , iterable $ allConstInfos ): string {
4177
4193
$ code = "" ;
4178
4194
foreach ($ propertyInfos as $ propertyInfo ) {
4179
- foreach ($ propertyInfo ->attributes as $ attribute ) {
4180
- $ code .= $ attribute ->generateCode ("zend_add_property_attribute(class_entry, property_ " . $ propertyInfo ->name ->getDeclarationName (), "property_ " . $ propertyInfo ->name ->getDeclarationName (), $ allConstInfos );
4195
+ foreach ($ propertyInfo ->attributes as $ key => $ attribute ) {
4196
+ $ code .= $ attribute ->generateCode (
4197
+ "zend_add_property_attribute(class_entry, property_ " . $ propertyInfo ->name ->getDeclarationName (),
4198
+ "property_ " . $ propertyInfo ->name ->getDeclarationName () . "_ " . ($ key + 1 ),
4199
+ $ allConstInfos
4200
+ );
4181
4201
}
4182
4202
}
4183
4203
0 commit comments