@@ -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 ) {
@@ -4170,13 +4174,21 @@ static function (FuncInfo $funcInfo) use ($allConstInfos) {
4170
4174
$ functionTable = "CG(function_table) " ;
4171
4175
}
4172
4176
4173
- foreach ($ funcInfo ->attributes as $ attribute ) {
4174
- $ 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 );
4177
+ foreach ($ funcInfo ->attributes as $ key => $ attribute ) {
4178
+ $ code .= $ attribute ->generateCode (
4179
+ "zend_add_function_attribute(zend_hash_str_find_ptr( $ functionTable, \"" . $ funcInfo ->name ->getNameForAttributes () . "\", sizeof( \"" . $ funcInfo ->name ->getNameForAttributes () . "\") - 1) " ,
4180
+ "func_ " . $ funcInfo ->name ->getNameForAttributes () . "_ " . ($ key + 1 ),
4181
+ $ allConstInfos
4182
+ );
4175
4183
}
4176
4184
4177
4185
foreach ($ funcInfo ->args as $ index => $ arg ) {
4178
- foreach ($ arg ->attributes as $ attribute ) {
4179
- $ 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 );
4186
+ foreach ($ arg ->attributes as $ key => $ attribute ) {
4187
+ $ code .= $ attribute ->generateCode (
4188
+ "zend_add_parameter_attribute(zend_hash_str_find_ptr( $ functionTable, \"" . $ funcInfo ->name ->getNameForAttributes () . "\", sizeof( \"" . $ funcInfo ->name ->getNameForAttributes () . "\") - 1), $ index " ,
4189
+ "func_ {$ funcInfo ->name ->getNameForAttributes ()}_arg {$ index }_ " . ($ key + 1 ),
4190
+ $ allConstInfos
4191
+ );
4180
4192
}
4181
4193
}
4182
4194
@@ -4196,8 +4208,12 @@ function generateConstantAttributeInitialization(iterable $constInfos, iterable
4196
4208
static function (ConstInfo $ constInfo ) use ($ allConstInfos ) {
4197
4209
$ code = null ;
4198
4210
4199
- foreach ($ constInfo ->attributes as $ attribute ) {
4200
- $ code .= $ attribute ->generateCode ("zend_add_class_constant_attribute(class_entry, const_ " . $ constInfo ->name ->getDeclarationName (), "const_ " . $ constInfo ->name ->getDeclarationName (), $ allConstInfos );
4211
+ foreach ($ constInfo ->attributes as $ key => $ attribute ) {
4212
+ $ code .= $ attribute ->generateCode (
4213
+ "zend_add_class_constant_attribute(class_entry, const_ " . $ constInfo ->name ->getDeclarationName (),
4214
+ "const_ " . $ constInfo ->name ->getDeclarationName () . "_ " . ($ key + 1 ),
4215
+ $ allConstInfos
4216
+ );
4201
4217
}
4202
4218
4203
4219
return $ code ;
@@ -4212,8 +4228,12 @@ static function (ConstInfo $constInfo) use ($allConstInfos) {
4212
4228
function generatePropertyAttributeInitialization (iterable $ propertyInfos , iterable $ allConstInfos ): string {
4213
4229
$ code = "" ;
4214
4230
foreach ($ propertyInfos as $ propertyInfo ) {
4215
- foreach ($ propertyInfo ->attributes as $ attribute ) {
4216
- $ code .= $ attribute ->generateCode ("zend_add_property_attribute(class_entry, property_ " . $ propertyInfo ->name ->getDeclarationName (), "property_ " . $ propertyInfo ->name ->getDeclarationName (), $ allConstInfos );
4231
+ foreach ($ propertyInfo ->attributes as $ key => $ attribute ) {
4232
+ $ code .= $ attribute ->generateCode (
4233
+ "zend_add_property_attribute(class_entry, property_ " . $ propertyInfo ->name ->getDeclarationName (),
4234
+ "property_ " . $ propertyInfo ->name ->getDeclarationName () . "_ " . ($ key + 1 ),
4235
+ $ allConstInfos
4236
+ );
4217
4237
}
4218
4238
}
4219
4239
0 commit comments