Skip to content

Language: IS_REPEATABLE attributes + ReflectionAttribute::isRepeated() (#6912) - #6959

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-6912-is-repeatable-attributes
Jun 6, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-6912-is-repeatable-attributes

Conversation

@PurHur

@PurHur PurHur commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • AttributeClassRegistry tracks user attribute class #[Attribute] flags at compile time
  • AttributeNames::validateDuplicates() allows repeated attributes when Attribute::IS_REPEATABLE is set; marks all duplicate instances with AttributeEntry::$isRepeated
  • ReflectionAttribute::isRepeated() VM builtin reads compile-time metadata (php-src ext/reflection/php_reflection.c)

Closes #6912

php-src reference

Area File
Repeatable flag Zend/zend_attributes.c — zend_mark_attribute_repeatable
Compile-time duplicate guard Zend/zend_compile.c — zend_is_attribute_repeated
Reflection API ext/reflection/php_reflection.c — ReflectionAttribute::isRepeated

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro/maintainer_attr_isrepeated2.php
vendor/bin/phpunit test/compliance/VMTest.php --filter attribute_is_repeatable
'

Output:

2
rep0
rep1

PHPUnit ... OK (1 test, 1 assertion)

Also: vendor/bin/phpunit test/unit/AttributeNamesDuplicateTest.php — OK (6 tests)

Made with Cursor

…d() (#6912)

Compile-time duplicate guard now reads Attribute::IS_REPEATABLE from registered
attribute classes; reflection exposes isRepeated on duplicate instances per Zend.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language: IS_REPEATABLE attributes + ReflectionAttribute::isRepeated() — compile rejects valid repeats (zend_attributes.c)

1 participant