feat(attribute): Enhance HasAria, HasData, and HasEvents traits to support prefix attributes aria-, data-, and on.#83
Conversation
… to support prefix attributes `aria-`, `data-`, and `on`.
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughRefactors HasAria, HasData, and HasEvents traits to use prefix-aware attribute helpers: bulk methods accept an optional prefix and trait-specific add/values/remove methods delegate to generic methods with 'aria-', 'data-', or 'on' prefixes. Test providers gain "without prefix" cases; changelog updated. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/Global/HasEvents.php`:
- Around line 17-21: Fix the PHPDoc typo in the HasEvents trait by changing
"amd" to "and" in the `@method` description for set (the line reading "Sets a
single attribute amd returns a new instance."); do the same corrective change in
the corresponding PHPDoc blocks of the HasAria and HasData traits so the `@method`
docs for attributes, remove, and set read "...attribute and returns a new
instance." instead of "...amd returns...".
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
CHANGELOG.mdsrc/Global/HasAria.phpsrc/Global/HasData.phpsrc/Global/HasEvents.phptests/Provider/Global/AriaProvider.phptests/Provider/Global/DataProvider.phptests/Provider/Global/EventProvider.php
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2026-01-09T16:05:15.502Z
Learnt from: terabytesoftw
Repo: ui-awesome/html-attribute PR: 18
File: tests/Support/Provider/Global/ContentEditableProvider.php:32-33
Timestamp: 2026-01-09T16:05:15.502Z
Learning: Preserve the original copyright year in file headers when moving PHP source files between packages within the ui-awesome repositories (e.g., from ui-awesome/html-core to ui-awesome/html-attribute). Do not update the header year to the current year; keep the original creation year as stated in the header. This applies to all PHP files throughout the repo that are moved between packages.
Applied to files:
tests/Provider/Global/DataProvider.phptests/Provider/Global/AriaProvider.phptests/Provider/Global/EventProvider.phpsrc/Global/HasData.phpsrc/Global/HasAria.phpsrc/Global/HasEvents.php
📚 Learning: 2026-02-08T20:05:36.407Z
Learnt from: terabytesoftw
Repo: ui-awesome/html-attribute PR: 80
File: src/HasValue.php:35-35
Timestamp: 2026-02-08T20:05:36.407Z
Learning: In the ui-awesome/html-attribute repository, for methods that accept multiple values of the same type (e.g., boolean true/false), document with a single representative example rather than exhaustively listing all variations. This keeps documentation concise while conveying the intended usage. Apply this consistently across PHP docblocks and examples.
Applied to files:
tests/Provider/Global/DataProvider.phptests/Provider/Global/AriaProvider.phptests/Provider/Global/EventProvider.phpsrc/Global/HasData.phpsrc/Global/HasAria.phpsrc/Global/HasEvents.php
📚 Learning: 2026-02-07T13:44:00.931Z
Learnt from: terabytesoftw
Repo: ui-awesome/html-attribute PR: 78
File: tests/Global/HasDirTest.php:92-92
Timestamp: 2026-02-07T13:44:00.931Z
Learning: In PHP test methods that start with testThrowInvalidArgumentException, do not append 'Invalid' again in the method name suffix (e.g., prefer testThrowInvalidArgumentExceptionForSettingDirValue over testThrowInvalidArgumentExceptionForSettingInvalidDirValue). The exception type already communicates invalid input, so the repeated word is redundant. Apply this convention to all similar test methods under the tests/ directory.
Applied to files:
tests/Provider/Global/DataProvider.phptests/Provider/Global/AriaProvider.phptests/Provider/Global/EventProvider.php
🧬 Code graph analysis (1)
src/Global/HasAria.php (1)
src/HasValue.php (1)
value(44-47)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: phpunit / PHP 8.2-ubuntu-latest
- GitHub Check: phpunit / PHP 8.4-ubuntu-latest
- GitHub Check: phpunit / PHP 8.1-windows-2022
- GitHub Check: phpunit / PHP 8.4-windows-2022
- GitHub Check: phpunit / PHP 8.2-windows-2022
- GitHub Check: phpunit / PHP 8.3-ubuntu-latest
- GitHub Check: linter / Super Linter
- GitHub Check: linter / Super Linter
- GitHub Check: phpunit / PHP 8.3-ubuntu-latest
🔇 Additional comments (7)
CHANGELOG.md (1)
56-56: LGTM!Changelog entry follows the established format and accurately describes the enhancement.
src/Global/HasEvents.php (1)
29-101: Clean delegation pattern with consistent prefix handling.All three methods (
addEvent,events,removeEvent) cleanly delegate to the sharedsetAttribute/attributes/removeAttributehelpers with the'on'prefix. The approach is consistent with the sibling traits.src/Global/HasAria.php (1)
29-111: LGTM!Consistent prefix delegation for
aria-*attributes. The three methods mirror the pattern inHasEventsandHasData.src/Global/HasData.php (1)
29-108: LGTM!Consistent prefix delegation for
data-*attributes.tests/Provider/Global/DataProvider.php (1)
190-195: LGTM!The "without prefix" test cases consistently verify that bare keys (e.g.,
'label') are automatically prefixed to'data-label'across all three provider methods (renderAttribute,value,values).Also applies to: 335-340, 473-477
tests/Provider/Global/AriaProvider.php (1)
190-195: LGTM!The "without prefix" cases properly verify automatic
aria-prefixing across all three provider methods.Also applies to: 341-346, 479-483
tests/Provider/Global/EventProvider.php (1)
160-165: LGTM!The "without prefix" cases properly verify automatic
onprefixing for event attributes across all three provider methods.Also applies to: 275-280, 361-365
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…from `HasAria`, `HasData`, and `HasEvents` traits.
Pull Request