fix(docs): Refactor attribute documentation in traits.#84
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughRefactors PHPDoc across 60+ trait files: replaces Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 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)
No actionable comments were generated in the recent review. 🎉 📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (5)
🧰 Additional context used🧠 Learnings (2)📚 Learning: 2026-02-08T20:05:36.407ZApplied to files:
📚 Learning: 2026-01-09T16:05:15.502ZApplied to files:
🔇 Additional comments (7)
✏️ Tip: You can disable this entire section by setting 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: 5
🤖 Fix all issues with AI agents
In `@CHANGELOG.md`:
- Line 57: Update the changelog entry that currently reads "Enh `#84`: Refactor
attribute documentation in traits (`@terabytesoftw`)" to use the bugfix prefix
consistent with the PR metadata — e.g. change "Enh `#84`" to "Bug `#84`" (or "Fix
`#84`") so the entry matches the PR title/description (fix(docs)); locate the
exact string "Enh `#84`: Refactor attribute documentation in traits
(`@terabytesoftw`)" and replace the prefix accordingly.
In `@src/Form/HasMin.php`:
- Line 25: The docblock asterisk on the "Usage example:" line in
src/Form/HasMin.php is misaligned (4 spaces instead of the expected 5), causing
ECS to fail; open the docblock that contains the "Usage example:" text and
correct the indentation of the leading asterisk to match the other docblock
lines (change the leading space count from 4 to 5) so the asterisk aligns with
the rest of the block in the HasMin.php docblock.
In `@src/Global/CanBeAutofocus.php`:
- Around line 23-27: Update the docblock for the CanBeAutofocus trait's
autofocus usage example to show a single representative boolean case: replace
the two-line example that shows both $element->autofocus(true); and
$element->autofocus(false); with a single line demonstrating
$element->autofocus(true); so the doc follows the repository convention for
boolean parameters.
In `@src/Global/HasDraggable.php`:
- Around line 28-33: The docblock examples in HasDraggable (method draggable)
redundantly show both boolean variants; remove one boolean example so the usage
shows a single representative boolean (e.g., $element->draggable(true);) and the
enum example ($element->draggable(Draggable::TRUE);) only, updating the docblock
in src/Global/HasDraggable.php accordingly.
In `@src/Global/HasTranslate.php`:
- Around line 28-33: The usage docs in HasTranslate.php list both boolean
variants for the translate() call; remove one of the boolean examples so only a
single representative boolean usage remains (e.g., keep
$element->translate(true)) while keeping the enum example
($element->translate(Translate::NO)); update the code comment block that
contains the translate() examples accordingly to be concise and consistent with
the repository convention.
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (72)
CHANGELOG.mdsrc/Element/HasAlt.phpsrc/Element/HasDecoding.phpsrc/Element/HasHeight.phpsrc/Element/HasHref.phpsrc/Element/HasLoading.phpsrc/Element/HasPopoverTarget.phpsrc/Element/HasPopoverTargetAction.phpsrc/Element/HasReferrerpolicy.phpsrc/Element/HasSrc.phpsrc/Element/HasSrcset.phpsrc/Element/HasUsemap.phpsrc/Element/HasWidth.phpsrc/Form/HasAccept.phpsrc/Form/HasAutocomplete.phpsrc/Form/HasChecked.phpsrc/Form/HasDirname.phpsrc/Form/HasForm.phpsrc/Form/HasList.phpsrc/Form/HasMax.phpsrc/Form/HasMaxlength.phpsrc/Form/HasMin.phpsrc/Form/HasMinlength.phpsrc/Form/HasMultiple.phpsrc/Form/HasPattern.phpsrc/Form/HasPlaceholder.phpsrc/Form/HasReadonly.phpsrc/Form/HasRequired.phpsrc/Form/HasSize.phpsrc/Form/HasStep.phpsrc/Global/CanBeAutofocus.phpsrc/Global/CanBeHidden.phpsrc/Global/HasAccesskey.phpsrc/Global/HasClass.phpsrc/Global/HasContentEditable.phpsrc/Global/HasDir.phpsrc/Global/HasDraggable.phpsrc/Global/HasId.phpsrc/Global/HasInputMode.phpsrc/Global/HasLang.phpsrc/Global/HasMicroData.phpsrc/Global/HasNonce.phpsrc/Global/HasPopover.phpsrc/Global/HasRole.phpsrc/Global/HasSpellcheck.phpsrc/Global/HasStyle.phpsrc/Global/HasTabindex.phpsrc/Global/HasTitle.phpsrc/Global/HasTranslate.phpsrc/HasAs.phpsrc/HasBlocking.phpsrc/HasCharset.phpsrc/HasContent.phpsrc/HasCrossorigin.phpsrc/HasDisabled.phpsrc/HasDownload.phpsrc/HasFetchpriority.phpsrc/HasHreflang.phpsrc/HasHttpEquiv.phpsrc/HasImagesizes.phpsrc/HasImagesrcset.phpsrc/HasIntegrity.phpsrc/HasMedia.phpsrc/HasName.phpsrc/HasPing.phpsrc/HasReferrerpolicy.phpsrc/HasRel.phpsrc/HasSizes.phpsrc/HasSrc.phpsrc/HasTarget.phpsrc/HasType.phpsrc/HasValue.php
🧰 Additional context used
🧠 Learnings (2)
📚 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:
src/Element/HasDecoding.phpsrc/Form/HasSize.phpsrc/HasRel.phpsrc/Element/HasPopoverTargetAction.phpsrc/Form/HasAccept.phpsrc/Element/HasPopoverTarget.phpsrc/Global/HasLang.phpsrc/Element/HasHref.phpsrc/HasTarget.phpsrc/Global/HasTranslate.phpsrc/Form/HasMin.phpsrc/HasHreflang.phpsrc/HasCharset.phpsrc/Form/HasForm.phpsrc/Global/HasDir.phpsrc/HasValue.phpsrc/HasSrc.phpsrc/Element/HasSrc.phpsrc/HasAs.phpsrc/Form/HasPlaceholder.phpsrc/Global/HasContentEditable.phpsrc/Form/HasRequired.phpsrc/Element/HasSrcset.phpsrc/HasBlocking.phpsrc/Global/CanBeAutofocus.phpsrc/HasHttpEquiv.phpsrc/Element/HasReferrerpolicy.phpsrc/Global/HasInputMode.phpsrc/HasReferrerpolicy.phpsrc/Global/HasNonce.phpsrc/HasCrossorigin.phpsrc/Global/CanBeHidden.phpsrc/Form/HasMultiple.phpsrc/HasContent.phpsrc/Element/HasLoading.phpsrc/Global/HasPopover.phpsrc/Element/HasUsemap.phpsrc/Element/HasAlt.phpsrc/HasName.phpsrc/Global/HasRole.phpsrc/HasDownload.phpsrc/Form/HasChecked.phpsrc/Global/HasClass.phpsrc/HasFetchpriority.phpsrc/Form/HasMinlength.phpsrc/Element/HasWidth.phpsrc/HasPing.phpsrc/Form/HasPattern.phpsrc/Global/HasMicroData.phpsrc/Form/HasMax.phpsrc/Global/HasStyle.phpsrc/Form/HasMaxlength.phpsrc/HasImagesrcset.phpsrc/HasDisabled.phpsrc/Form/HasList.phpsrc/Global/HasAccesskey.phpsrc/Global/HasDraggable.phpsrc/Form/HasStep.phpsrc/Element/HasHeight.phpsrc/HasType.phpsrc/Global/HasTitle.phpsrc/HasSizes.phpsrc/Form/HasReadonly.phpsrc/HasMedia.phpsrc/HasIntegrity.phpsrc/Global/HasSpellcheck.phpsrc/Global/HasTabindex.phpsrc/Global/HasId.phpsrc/Form/HasDirname.phpsrc/HasImagesizes.phpsrc/Form/HasAutocomplete.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:
src/Element/HasDecoding.phpsrc/Form/HasSize.phpsrc/HasRel.phpsrc/Element/HasPopoverTargetAction.phpsrc/Form/HasAccept.phpsrc/Element/HasPopoverTarget.phpsrc/Global/HasLang.phpsrc/Element/HasHref.phpsrc/HasTarget.phpsrc/Global/HasTranslate.phpsrc/Form/HasMin.phpsrc/HasHreflang.phpsrc/HasCharset.phpsrc/Form/HasForm.phpsrc/Global/HasDir.phpsrc/HasValue.phpsrc/HasSrc.phpsrc/Element/HasSrc.phpsrc/HasAs.phpsrc/Form/HasPlaceholder.phpsrc/Global/HasContentEditable.phpsrc/Form/HasRequired.phpsrc/Element/HasSrcset.phpsrc/HasBlocking.phpsrc/Global/CanBeAutofocus.phpsrc/HasHttpEquiv.phpsrc/Element/HasReferrerpolicy.phpsrc/Global/HasInputMode.phpsrc/HasReferrerpolicy.phpsrc/Global/HasNonce.phpsrc/HasCrossorigin.phpsrc/Global/CanBeHidden.phpsrc/Form/HasMultiple.phpsrc/HasContent.phpsrc/Element/HasLoading.phpsrc/Global/HasPopover.phpsrc/Element/HasUsemap.phpsrc/Element/HasAlt.phpsrc/HasName.phpsrc/Global/HasRole.phpsrc/HasDownload.phpsrc/Form/HasChecked.phpsrc/Global/HasClass.phpsrc/HasFetchpriority.phpsrc/Form/HasMinlength.phpsrc/Element/HasWidth.phpsrc/HasPing.phpsrc/Form/HasPattern.phpsrc/Global/HasMicroData.phpsrc/Form/HasMax.phpsrc/Global/HasStyle.phpsrc/Form/HasMaxlength.phpsrc/HasImagesrcset.phpsrc/HasDisabled.phpsrc/Form/HasList.phpsrc/Global/HasAccesskey.phpsrc/Global/HasDraggable.phpsrc/Form/HasStep.phpsrc/Element/HasHeight.phpsrc/HasType.phpsrc/Global/HasTitle.phpsrc/HasSizes.phpsrc/Form/HasReadonly.phpsrc/HasMedia.phpsrc/HasIntegrity.phpsrc/Global/HasSpellcheck.phpsrc/Global/HasTabindex.phpsrc/Global/HasId.phpsrc/Form/HasDirname.phpsrc/HasImagesizes.phpsrc/Form/HasAutocomplete.php
🪛 GitHub Actions: ecs
src/Form/HasMin.php
[error] 1-1: PHP CS Fixer reported 1 fixable error during ecs check. Run 'vendor/bin/ecs check --fix' to apply the fix.
⏰ 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.3-ubuntu-latest
- GitHub Check: phpunit / PHP 8.2-windows-2022
- GitHub Check: phpunit / PHP 8.3-windows-2022
- GitHub Check: phpunit / PHP 8.5-ubuntu-latest
- GitHub Check: phpunit / PHP 8.2-ubuntu-latest
- GitHub Check: phpstan / PHP 8.5-ubuntu-latest
- GitHub Check: linter / Super Linter
- GitHub Check: easy-coding-standard / PHP 8.5-ubuntu-latest
- GitHub Check: linter / Super Linter
🔇 Additional comments (69)
src/Global/HasPopover.php (1)
15-15: LGTM!The
@mixinannotation is correctly added, consistent with the PR-wide documentation refactor.src/Global/HasInputMode.php (1)
15-15: LGTM!Consistent
@mixinannotation update.src/HasHttpEquiv.php (1)
16-16: LGTM!The
@mixinannotation and reorganized usage examples are consistent with the PR-wide pattern.Also applies to: 29-35
src/Global/HasLang.php (1)
16-16: LGTM!Consistent documentation update with
@mixinannotation and usage examples.Also applies to: 27-33
src/Global/HasClass.php (1)
40-45: LGTM!The
@paramand@returnannotation repositioning is consistent with the docblock reorganization pattern. The omission of@mixin HasAttributesis correct here sinceHasClassmanages attributes directly rather than delegating tosetAttribute().src/HasImagesizes.php (1)
14-14: LGTM!Consistent
@mixinannotation and docblock reorganization.Also applies to: 33-37
src/HasFetchpriority.php (1)
15-15: LGTM!Consistent documentation refactor with
@mixinannotation and reorganized usage examples.Also applies to: 28-34
src/Global/HasRole.php (1)
16-16: LGTM!Consistent
@mixinannotation and usage example documentation updates.Also applies to: 27-33
src/Form/HasPattern.php (1)
14-14: Documentation updates look good.The
@mixinannotation correctly declares the dependency on\UIAwesome\Html\Mixin\HasAttributes, and the reflowed@param/@returnannotations accurately match the method signature. Consistent with the PR-wide docblock standardization.Also applies to: 31-34
src/HasDownload.php (1)
33-39: Docblock updates are consistent with the PR pattern.The
@paramand@returnannotations correctly match the method signature. Minor note: the@linkon line 39 duplicates the class-level@linkon line 15 (both point to the same MDN URL). This is harmless but could be removed to reduce redundancy if desired.src/Form/HasForm.php (1)
14-14: LGTM.The
@mixinannotation and reflowed@param/@returnannotations are correct and consistent with the PR-wide documentation pattern.Also applies to: 31-34
src/Form/HasReadonly.php (1)
12-12: LGTM.The
@mixinannotation and reflowed@param/@returnare correct, matching thebool|nullsignature andstaticreturn type.Also applies to: 29-33
src/HasCrossorigin.php (1)
15-15: LGTM.The
@mixinannotation is correctly placed, and the new usage examples effectively demonstrate the three main invocation patterns (string literal, enum constant, andnullremoval). Good documentation improvement.Also applies to: 28-34
src/HasDisabled.php (1)
12-12: LGTM.Consistent with the PR-wide docblock standardization. Annotations correctly match the method signature.
Also applies to: 29-33
src/Form/HasSize.php (1)
17-17: LGTM.The
@mixinannotation and reflowed annotations are correct. The@param,@throws, and@returntags accurately document the method's contract and match its signature.Also applies to: 34-39
src/Form/HasChecked.php (1)
12-12: LGTM.The
@mixinannotation and reflowed@param/@returnare correct and consistent with the rest of the PR.Also applies to: 29-33
src/Form/HasMaxlength.php (1)
14-41: Docblock refactor looks good.The
@mixinannotation correctly documents the dependency onHasAttributes, and the reordered@param/@returnplacement after the usage example is consistent with the PR-wide pattern.src/Global/CanBeHidden.php (1)
9-32: LGTM — consistent docblock refactor.The
@mixinannotation and reflowed annotations align with the PR-wide documentation standard.src/Form/HasAccept.php (1)
11-36: LGTM.Docblock changes are consistent with the PR-wide refactor pattern.
src/HasValue.php (1)
11-14: LGTM.The
@mixinannotation replacement is consistent with the broader documentation refactor.src/HasName.php (1)
11-39: LGTM.Docblock changes follow the established pattern. The
{@see}cross-reference toMetaNameis a nice touch for IDE discoverability.src/Element/HasPopoverTargetAction.php (1)
13-39: LGTM.Consistent
@mixinannotation update; the@throwsplacement between@paramand@returnis appropriate.src/HasRel.php (1)
13-42: LGTM.Docblock updates are consistent. The copyright year (2025) is correctly preserved per repository conventions. Based on learnings: "Preserve the original copyright year in file headers when moving PHP source files between packages within the ui-awesome repositories."
src/HasHreflang.php (1)
11-37: LGTM.Clean docblock refactor consistent with the rest of the PR.
src/Form/HasMultiple.php (1)
12-12: Docblock refactor looks good.The
@mixinannotation correctly documents the dependency onHasAttributes(which providessetAttribute), and the parameter/return reflow is clean.Also applies to: 29-33
src/HasType.php (1)
16-16: LGTM.The
@mixinannotation and usage examples are well-structured. The three examples effectively illustrate the distinct value categories (MIME type string, keyword, andnullfor removal).Also applies to: 29-35
src/Form/HasMinlength.php (1)
17-17: LGTM.Consistent
@mixinannotation and clean docblock reflow. The@throwsannotation is properly preserved in the updated layout.Also applies to: 34-40
src/Form/HasRequired.php (1)
12-12: LGTM.Consistent with the documentation refactor pattern across the PR.
Also applies to: 29-33
src/Form/HasDirname.php (1)
14-14: LGTM.Clean docblock refactor, consistent with the rest of the PR.
Also applies to: 31-34
src/HasPing.php (1)
14-14: LGTM.Consistent documentation refactor.
Also applies to: 33-36
src/HasAs.php (1)
16-16: LGTM.Good usage examples demonstrating both the string and enum input paths alongside
nullfor removal. The@mixinannotation and docblock reflow are consistent with the PR pattern.Also applies to: 29-35
src/Form/HasStep.php (1)
14-14: LGTM.Consistent documentation refactor. The
@paramdescription clearly explains the'any'keyword andnullsemantics.Also applies to: 32-36
src/Global/HasTranslate.php (1)
14-18: LGTM —@mixinannotation is consistent with the PR-wide pattern.The
@mixinannotation correctly communicates to IDEs and static analysis tools that this trait depends onHasAttributes.src/Global/HasTitle.php (1)
14-34: LGTM — clean docblock reorganization.The
@mixinannotation and reflowed@param/@returnannotations are consistent with the rest of the PR.src/Global/HasNonce.php (1)
14-34: LGTM — consistent with the documentation refactor pattern.src/Form/HasPlaceholder.php (1)
14-34: LGTM — docblock updates are consistent.src/HasBlocking.php (1)
15-41: LGTM — well-structured docblock with distinct examples for each input type.src/Form/HasList.php (1)
14-34: LGTM — consistent docblock refactoring.src/Form/HasMax.php (1)
14-35: LGTM — the multiple examples are justified here sincemaxsupports meaningfully different formats (numeric, date, time).src/Global/HasTabindex.php (1)
15-15: LGTM — documentation refactor is consistent.The
@mixinannotation and PHPDoc reflow follow the established pattern across the PR. No functional changes.Also applies to: 32-38
src/HasImagesrcset.php (1)
14-14: LGTM — consistent documentation update.Also applies to: 32-36
src/Global/HasDir.php (1)
15-15: LGTM — usage examples consolidated and@mixinannotation added consistently.Also applies to: 26-32
src/Form/HasAutocomplete.php (1)
14-14: LGTM — consistent with the broader documentation refactor.Also applies to: 32-35
src/HasTarget.php (1)
15-15: LGTM — documentation update follows the established pattern.Also applies to: 28-34
src/Global/HasContentEditable.php (1)
17-17: LGTM —@mixinannotation and usage example placement are consistent.Also applies to: 28-34
src/Global/HasMicroData.php (1)
14-14: LGTM — all five microdata method docblocks are consistently reformatted.The
@mixinannotation and uniform blank-line separation between@param,@return, and@linktags acrossitemId,itemProp,itemRef,itemScope, anditemTypelook good.Also applies to: 29-34, 49-54, 69-74, 89-94, 109-114
src/HasContent.php (1)
14-14: LGTM — consistent documentation refactor.Also applies to: 33-36
src/HasCharset.php (1)
14-43: Documentation refactor looks good.The
@mixinannotation correctly replaces the previous@methodhint, and the usage examples within the method docblock are well-structured, showing string, enum, and null variants.src/HasIntegrity.php (1)
14-37: LGTM — consistent documentation update.src/Global/CanBeAutofocus.php (1)
12-31: Mixin annotation and docblock reflow look correct.The
@mixinannotation and repositioned@param/@returntags are consistent with the rest of the PR.src/HasReferrerpolicy.php (1)
16-42: LGTM — clean documentation refactor with usage examples covering string, enum, and null.src/HasMedia.php (1)
14-36: LGTM — consistent with the broader documentation refactor.src/HasSizes.php (1)
14-36: LGTM — documentation changes are well-structured and consistent.src/Global/HasAccesskey.php (1)
14-33: LGTM — mixin annotation and docblock formatting are consistent with the PR pattern.src/Global/HasId.php (1)
14-33: LGTM — clean and consistent documentation update.src/Global/HasStyle.php (1)
14-14: Docblock refactor looks good.The
@mixinannotation and reflowed@param/@return/@phpstan-paramtags are consistent with the broader PR pattern. The@phpstan-paramproviding a more specific array type is a nice touch.Also applies to: 45-51
src/Global/HasSpellcheck.php (1)
16-16: LGTM.Docblock changes are consistent with the PR-wide refactor. The
@throwsannotation is correctly preserved for the validation logic.Also applies to: 32-37
src/Element/HasPopoverTarget.php (1)
14-14: LGTM. Consistent@mixinannotation and well-structured docblock.src/Element/HasHeight.php (1)
14-14: LGTM. Docblock changes are consistent with the PR pattern.Also applies to: 32-36
src/HasSrc.php (1)
14-14: LGTM. Clean refactor, consistent with other files.Also applies to: 33-36
src/Element/HasReferrerpolicy.php (1)
16-16: LGTM. The new usage example block with string, enum, andnullvariants is helpful. Docblock structure is consistent with the rest of the PR.Also applies to: 32-37
src/Element/HasHref.php (1)
14-14: LGTM — consistent docblock refactor.The
@mixinannotation and reflowed@param/@returnplacement align with the broader PR pattern. No functional changes.Also applies to: 33-36
src/Element/HasAlt.php (1)
14-14: LGTM.Also applies to: 31-35
src/Element/HasWidth.php (1)
14-14: LGTM.Also applies to: 33-37
src/Element/HasDecoding.php (1)
16-16: LGTM — usage example and mixin annotation cleanly added.Also applies to: 28-34
src/Element/HasSrc.php (1)
14-14: LGTM.Also applies to: 31-34
src/Element/HasSrcset.php (1)
13-13: LGTM.Also applies to: 32-36
src/Element/HasUsemap.php (1)
14-14: LGTM.Also applies to: 30-34
src/Element/HasLoading.php (1)
16-16: LGTM — usage example consolidated and mixin annotation added consistently.Also applies to: 28-34
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Pull Request