Skip to content

fix(docs): Update documentation for HTML attribute elements in Element namespace.#72

Merged
terabytesoftw merged 2 commits into
mainfrom
fix_mini_21
Feb 4, 2026
Merged

fix(docs): Update documentation for HTML attribute elements in Element namespace.#72
terabytesoftw merged 2 commits into
mainfrom
fix_mini_21

Conversation

@terabytesoftw
Copy link
Copy Markdown
Contributor

Pull Request

Q A
Is bugfix? ✔️
New feature?
Breaks BC?

@terabytesoftw terabytesoftw added the bug Something isn't working label Feb 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 4, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Documentation

    • Clarified HTML attribute docs to target specific tag elements (e.g., , , ) and removed external spec links from docblocks.
    • Added changelog entry documenting the documentation update.
  • Tests

    • Restructured test provider namespaces and updated test data to use revised enum values.
    • Renamed local variables in tests for clarity; test behavior unchanged.

Walkthrough

The PR updates PHPDoc wording across Element attribute traits to target "tag elements" and adjusts docblock links/references; it moves test providers from Tests\Support\Provider\Element to Tests\Provider\Element, updates provider imports to use PHPForge\Support\Stub\BackedString, and adapts test data keys/values accordingly; adds a CHANGELOG entry for Bug #72.

Changes

Cohort / File(s) Summary
Element trait documentation refinements
src/Element/Has{Alt,Decoding,Height,Href,Loading,Referrerpolicy,Src,Srcset,Usemap,Width}.php
Reworded docblocks to target "tag elements" (e.g., <img>, <svg>), removed or replaced external @link URLs with local @see refs where applicable. No signature or behavior changes.
Test file import updates
tests/Element/Has{Alt,Decoding,Height,Href,Loading,Referrerpolicy,Src,Srcset,Usemap,Width}Test.php
Updated Provider imports from UIAwesome\Html\Attribute\Tests\Support\Provider\Element\*ProviderUIAwesome\Html\Attribute\Tests\Provider\Element\*Provider. No test logic changes.
Test provider namespace & stub changes
tests/Provider/Element/{Alt,Decoding,Height,Href,Loading,Referrerpolicy,Src,Srcset,Usemap,Width}Provider.php
Moved providers to UIAwesome\Html\Attribute\Tests\Provider\Element; replaced internal stub imports with use PHPForge\Support\Stub\{BackedString, Unit};; renamed test key 'enum backed' → 'enum backed string' and replaced Backed::VALUEBackedString::VALUE; some local variable renames ($staticCase$staticCases).
Changelog
CHANGELOG.md
Added 0.5.3 entry for Bug #72: "Update documentation for HTML attribute elements in Element namespace".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I nudge the docs with careful paws,

Tags now named without a pause.
Providers hop to tidy lands,
BackedStrings clasp in tiny hands.
A small clean change—one rabbit's cheer!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 76.92% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating documentation for HTML attribute elements in the Element namespace, which aligns with all the modifications across the trait files.
Description check ✅ Passed The description is related to the changeset; it correctly identifies this as a documentation bugfix with no breaking changes, matching the documentation updates throughout the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_mini_21

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2442d81 and c355189.

📒 Files selected for processing (10)
  • src/Element/HasAlt.php
  • src/Element/HasDecoding.php
  • src/Element/HasHeight.php
  • src/Element/HasHref.php
  • src/Element/HasLoading.php
  • src/Element/HasReferrerpolicy.php
  • src/Element/HasSrc.php
  • src/Element/HasSrcset.php
  • src/Element/HasUsemap.php
  • src/Element/HasWidth.php
🧰 Additional context used
🧠 Learnings (1)
📚 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/HasHref.php
  • src/Element/HasLoading.php
  • src/Element/HasReferrerpolicy.php
  • src/Element/HasAlt.php
  • src/Element/HasWidth.php
  • src/Element/HasHeight.php
  • src/Element/HasDecoding.php
  • src/Element/HasSrc.php
  • src/Element/HasSrcset.php
  • src/Element/HasUsemap.php
⏰ 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). (14)
  • GitHub Check: phpunit / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.1-ubuntu-latest
  • GitHub Check: composer-require-checker / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.2-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.3-windows-2022
  • GitHub Check: linter / Super Linter
  • GitHub Check: easy-coding-standard / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.4-windows-2022
  • GitHub Check: phpunit / PHP 8.1-windows-2022
  • GitHub Check: phpunit / PHP 8.2-windows-2022
  • GitHub Check: phpunit / PHP 8.4-ubuntu-latest
  • GitHub Check: mutation / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.3-ubuntu-latest
  • GitHub Check: linter / Super Linter
🔇 Additional comments (12)
src/Element/HasHeight.php (1)

16-20: Doc update looks good and remains accurate.

src/Element/HasSrcset.php (1)

10-28: Doc updates look clear and accurate.
No functional impact, and the revised wording improves clarity of srcset usage.

Also applies to: 41-46

src/Element/HasReferrerpolicy.php (1)

14-22: Doc update looks correct and consistent.
The refined scope and local {@see} reference are clear and aligned with the trait’s usage.

Also applies to: 60-60

src/Element/HasUsemap.php (1)

12-23: Docblock wording update looks good.

Clearer scope for tag elements and consistent phrasing.

src/Element/HasLoading.php (2)

18-23: Doc wording aligns with tag-element scope.

Clearer phrasing for tag elements and the specific <img>/<iframe> context reads well.


55-62: Enum reference + example improve clarity.

Pointing to Loading and demonstrating null unsetting makes usage explicit.

src/Element/HasDecoding.php (1)

18-21: LGTM! Documentation updates are accurate and improve clarity.

The changes correctly:

  • Generalize the scope from "image elements" to "tag elements" while still explicitly noting <img> and <svg> support.
  • Replace the external HTML spec URL reference with a local {@see Decoding} PHPDoc reference, which improves IDE navigation and discoverability since Decoding is already imported.

Also applies to: 56-56

src/Element/HasWidth.php (1)

16-19: LGTM!

The documentation updates correctly narrow the scope to "tag elements" and provide appropriate examples (<img>, <svg>). This aligns with the PR objective and maintains consistency with similar changes across other Has* files in this PR.

src/Element/HasAlt.php (1)

16-16: LGTM! Documentation improvements enhance clarity.

The updated wording from "tags and components" to "tag elements" is more precise and consistent. This improves the documentation's clarity about the trait's intended use for HTML element attributes.

Also applies to: 19-19

src/Element/HasHref.php (1)

19-19: Clarify the scope of the HasHref trait in the documentation.

The trait is documented as "Designed for use in tag elements (<a> and <svg>)" but the trait implementation is generic and reusable. The HTML specification defines href on additional elements like <area>, <base>, and <link>. If the trait is intended to support these elements as well, the documentation should be updated to reflect the broader applicability. Alternatively, if the scope is intentionally limited to <a> and <svg>, confirm this is the documented design intent.

src/Element/HasSrc.php (2)

40-41: Image-specific documentation consistent with line 19.

The documentation states "URL of the image to display in the element," which is consistent with line 19's focus on <img> elements. If the verification at line 19 confirms this trait should support other elements with src attributes (like <iframe>, <audio>, etc.), this description should also be generalized to "URL of the resource" or similar.


19-19: Remove this review comment—the documentation is correct and intentional.

The codebase contains two distinct HasSrc traits with different scopes:

  • src/HasSrc.php (generic): supports multiple elements (script, img, video, audio, iframe, input, source, track, embed)
  • src/Element/HasSrc.php (under review): image-specific, limited to <img> elements

The Element/ namespace and documentation specifying <img> are intentional design choices. The image-specific version is grouped with other image-only attribute traits (HasAlt, HasDecoding, HasLoading, HasSrcset) in the same directory, and references image-specific MDN documentation. This reflects the correct architectural distinction between generic and specialized versions.

Likely an incorrect or invalid review comment.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/Element/HasUsemap.php`:
- Around line 16-19: Update the docblocks in the HasUsemap trait to replace the
awkward phrase "tags elements" with "tag elements" (singular "tag") in both
occurrences within the class/file documentation (the description lines that
mention intended use for <img> tag elements and the "Designed for use in tag
elements (`<img>`)" line) so the comments read "Intended for use in tag
elements..." and "Designed for use in tag elements (`<img`)."
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d6ac3f and 2442d81.

📒 Files selected for processing (31)
  • CHANGELOG.md
  • src/Element/HasAlt.php
  • src/Element/HasDecoding.php
  • src/Element/HasHeight.php
  • src/Element/HasHref.php
  • src/Element/HasLoading.php
  • src/Element/HasReferrerpolicy.php
  • src/Element/HasSrc.php
  • src/Element/HasSrcset.php
  • src/Element/HasUsemap.php
  • src/Element/HasWidth.php
  • tests/Element/HasAltTest.php
  • tests/Element/HasDecodingTest.php
  • tests/Element/HasHeightTest.php
  • tests/Element/HasHrefTest.php
  • tests/Element/HasLoadingTest.php
  • tests/Element/HasReferrerpolicyTest.php
  • tests/Element/HasSrcTest.php
  • tests/Element/HasSrcsetTest.php
  • tests/Element/HasUsemapTest.php
  • tests/Element/HasWidthTest.php
  • tests/Provider/Element/AltProvider.php
  • tests/Provider/Element/DecodingProvider.php
  • tests/Provider/Element/HeightProvider.php
  • tests/Provider/Element/HrefProvider.php
  • tests/Provider/Element/LoadingProvider.php
  • tests/Provider/Element/ReferrerpolicyProvider.php
  • tests/Provider/Element/SrcProvider.php
  • tests/Provider/Element/SrcsetProvider.php
  • tests/Provider/Element/UsemapProvider.php
  • tests/Provider/Element/WidthProvider.php
🧰 Additional context used
🧠 Learnings (1)
📚 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/Element/HasReferrerpolicyTest.php
  • src/Element/HasDecoding.php
  • tests/Element/HasSrcsetTest.php
  • tests/Element/HasHrefTest.php
  • src/Element/HasSrc.php
  • tests/Element/HasHeightTest.php
  • src/Element/HasUsemap.php
  • tests/Element/HasDecodingTest.php
  • tests/Element/HasUsemapTest.php
  • src/Element/HasReferrerpolicy.php
  • src/Element/HasHeight.php
  • tests/Element/HasLoadingTest.php
  • tests/Provider/Element/DecodingProvider.php
  • src/Element/HasAlt.php
  • tests/Provider/Element/WidthProvider.php
  • tests/Provider/Element/HrefProvider.php
  • src/Element/HasWidth.php
  • tests/Provider/Element/SrcsetProvider.php
  • src/Element/HasLoading.php
  • tests/Provider/Element/SrcProvider.php
  • tests/Element/HasWidthTest.php
  • tests/Provider/Element/ReferrerpolicyProvider.php
  • src/Element/HasSrcset.php
  • tests/Element/HasSrcTest.php
  • tests/Element/HasAltTest.php
  • tests/Provider/Element/UsemapProvider.php
  • tests/Provider/Element/AltProvider.php
  • tests/Provider/Element/LoadingProvider.php
  • src/Element/HasHref.php
  • tests/Provider/Element/HeightProvider.php
🧬 Code graph analysis (10)
tests/Element/HasReferrerpolicyTest.php (1)
tests/Provider/Element/ReferrerpolicyProvider.php (1)
  • ReferrerpolicyProvider (20-86)
tests/Element/HasSrcsetTest.php (1)
tests/Provider/Element/SrcsetProvider.php (1)
  • SrcsetProvider (19-102)
tests/Element/HasHrefTest.php (1)
tests/Provider/Element/HrefProvider.php (1)
  • HrefProvider (19-109)
tests/Element/HasHeightTest.php (1)
tests/Provider/Element/HeightProvider.php (1)
  • HeightProvider (19-95)
tests/Element/HasDecodingTest.php (1)
tests/Provider/Element/DecodingProvider.php (1)
  • DecodingProvider (20-86)
tests/Element/HasUsemapTest.php (1)
tests/Provider/Element/UsemapProvider.php (1)
  • UsemapProvider (19-95)
tests/Element/HasLoadingTest.php (1)
tests/Provider/Element/LoadingProvider.php (1)
  • LoadingProvider (20-86)
tests/Element/HasWidthTest.php (1)
tests/Provider/Element/WidthProvider.php (1)
  • WidthProvider (19-95)
tests/Element/HasSrcTest.php (1)
tests/Provider/Element/SrcProvider.php (1)
  • SrcProvider (19-95)
tests/Element/HasAltTest.php (1)
tests/Provider/Element/AltProvider.php (1)
  • AltProvider (19-95)
⏰ 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). (12)
  • GitHub Check: phpunit / PHP 8.5-windows-2022
  • GitHub Check: phpunit / PHP 8.1-windows-2022
  • GitHub Check: phpunit / PHP 8.2-windows-2022
  • GitHub Check: phpunit / PHP 8.3-windows-2022
  • GitHub Check: phpunit / PHP 8.4-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.3-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.2-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.4-windows-2022
  • GitHub Check: phpunit / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.1-ubuntu-latest
  • GitHub Check: linter / Super Linter
  • GitHub Check: linter / Super Linter
🔇 Additional comments (39)
CHANGELOG.md (1)

45-45: LGTM!

The changelog entry follows the established format and accurately describes the documentation updates for HTML attribute elements in the Element namespace.

tests/Element/HasAltTest.php (1)

11-11: LGTM!

The import path update correctly reflects the namespace reorganization from Tests\Support\Provider\Element to Tests\Provider\Element, which aligns with the provider's actual location shown in the relevant code snippets.

src/Element/HasSrc.php (1)

16-19: LGTM!

Documentation updates are consistent with the other trait files in this PR. The same "tags elements" terminology pattern is used (see previous comment on HasUsemap.php regarding potential grammatical improvement).

tests/Element/HasSrcTest.php (1)

11-11: LGTM!

The import path update correctly reflects the namespace reorganization, consistent with the changes in other test files. The SrcProvider class exists at the new location as confirmed by the relevant code snippets.

src/Element/HasWidth.php (1)

16-19: LGTM!

Documentation updates are consistent with the pattern across other trait files. The width attribute correctly references both <img> and <svg> elements as applicable use cases.

src/Element/HasDecoding.php (2)

18-21: LGTM!

Documentation updates are consistent with the pattern across other trait files in this PR.


56-56: Good addition!

The {@see Decoding} reference improves discoverability by directing developers to the predefined enum values for the decoding attribute.

src/Element/HasLoading.php (1)

18-21: LGTM!

The documentation updates appropriately clarify that this trait is intended for tag elements (<img> and <iframe>) that support the loading attribute. The addition of the @see Loading reference in the method docblock (lines 55-56) improves discoverability of the predefined enum values.

src/Element/HasSrcset.php (1)

15-18: LGTM!

The documentation correctly identifies the supported tag elements (<img>, <picture>, <source>) and maintains appropriate MDN reference links. The expanded description with bullet points (lines 42-46) improves clarity for developers.

src/Element/HasAlt.php (1)

16-19: LGTM!

The documentation updates are consistent with the other trait files in this PR. The copyright year (2025) is correctly preserved per the repository convention.

tests/Provider/Element/LoadingProvider.php (1)

5-5: LGTM!

The namespace reorganization from Tests\Support\Provider\Element to Tests\Provider\Element is consistent with the broader test structure refactoring in this PR. The variable rename from $staticCase to $staticCases (line 39) correctly reflects that it holds multiple test cases.

tests/Element/HasLoadingTest.php (1)

12-12: LGTM!

The import path update correctly reflects the namespace reorganization of LoadingProvider from Tests\Support\Provider\Element to Tests\Provider\Element.

src/Element/HasHeight.php (1)

16-19: LGTM!

The documentation updates correctly specify that this trait is designed for tag elements (<img> and <svg>) that support the height attribute. The copyright year (2025) is appropriately preserved.

tests/Provider/Element/WidthProvider.php (2)

5-7: LGTM!

The namespace reorganization and the switch to using PHPForge\Support\Stub\{BackedString, Unit} instead of internal stubs is consistent with the broader test infrastructure refactoring in this PR. The copyright year (2025) is correctly preserved.


44-50: Test case key renamed for clarity.

The rename from 'enum backed' to 'enum backed string' is more descriptive and aligns with the pattern used in other provider files in this PR.

tests/Element/HasWidthTest.php (1)

11-11: LGTM!

The import path update correctly reflects the provider namespace reorganization from Support\Provider\Element to Provider\Element. The WidthProvider class exists at the new location and the test functionality remains unchanged.

tests/Provider/Element/SrcsetProvider.php (2)

5-7: LGTM!

The namespace reorganization and import migration from internal stubs to PHPForge\Support\Stub\{BackedString, Unit} are correctly applied. This aligns with the project-wide test provider refactoring.


44-47: LGTM!

The test case key rename from 'enum backed' to 'enum backed string' appropriately reflects the switch to BackedString::VALUE, maintaining consistency with the type semantics.

tests/Element/HasSrcsetTest.php (1)

11-11: LGTM!

The import path update correctly aligns with the SrcsetProvider namespace migration.

tests/Provider/Element/AltProvider.php (1)

5-7: LGTM!

The namespace reorganization, import migration to PHPForge\Support\Stub\{BackedString, Unit}, and test case key rename are correctly applied, consistent with the pattern across all provider files in this refactor.

Also applies to: 44-47

src/Element/HasReferrerpolicy.php (2)

18-21: LGTM!

The documentation clarifications appropriately narrow the scope from generic "tags and components" to specifically "tags elements" with an accurate enumeration of HTML elements that support referrerpolicy (<a>, <area>, <iframe>, <img>, <link>, and <script>).


60-60: LGTM!

Replacing the external spec link with {@see Referrerpolicy} improves developer experience by enabling IDE navigation to the enum definition with predefined values.

src/Element/HasHref.php (1)

16-19: LGTM!

The documentation update correctly specifies the intended usage for "tags elements" with <a> and <svg> as the target elements. This is consistent with the documentation pattern applied across other Has* traits in this PR.

tests/Provider/Element/HrefProvider.php (1)

5-7: LGTM!

The namespace reorganization, import migration to PHPForge\Support\Stub\{BackedString, Unit}, and test case key rename are correctly applied, following the consistent pattern established across all provider files in this refactor.

Also applies to: 44-47

tests/Element/HasHrefTest.php (1)

11-11: Import path update looks consistent. The provider namespace switch aligns with the test-provider reorg.

tests/Provider/Element/HeightProvider.php (2)

5-8: Namespace/import update is consistent with provider relocation.


44-48: Enum-backed case label/value now matches the string-backed scenario. Good clarity improvement for the test data.

tests/Element/HasHeightTest.php (1)

11-11: Import path update looks consistent.

tests/Provider/Element/DecodingProvider.php (2)

5-5: Namespace update aligns with provider relocation.


39-84: $staticCases rename and spread keep behavior unchanged while improving clarity.

tests/Element/HasDecodingTest.php (1)

12-12: Import path update is consistent with provider namespace move.

tests/Provider/Element/ReferrerpolicyProvider.php (2)

5-5: Namespace update aligns with provider relocation.


39-84: $staticCases rename and spread keep behavior unchanged while improving clarity.

tests/Element/HasReferrerpolicyTest.php (1)

12-12: Import path update looks consistent.

tests/Provider/Element/SrcProvider.php (2)

5-7: LGTM! Namespace and import migration looks correct.

The namespace change from Tests\Support\Provider\Element to Tests\Provider\Element and the import migration to PHPForge\Support\Stub\{BackedString, Unit} are consistent with the broader refactoring observed across other provider files in this PR.


44-50: LGTM! Test data updated correctly.

The key rename from 'enum backed' to 'enum backed string' is more descriptive and accurately reflects the test case purpose. The value constant change from Backed::VALUE to BackedString::VALUE correctly aligns with the new import.

tests/Element/HasUsemapTest.php (1)

11-11: LGTM! Import path updated correctly.

The import path for UsemapProvider correctly reflects the namespace migration from Tests\Support\Provider\Element to Tests\Provider\Element, consistent with the provider file's updated namespace.

tests/Provider/Element/UsemapProvider.php (2)

5-7: LGTM! Namespace and import migration consistent with PR refactoring.

The namespace change to Tests\Provider\Element and import migration to PHPForge\Support\Stub\{BackedString, Unit} follow the same pattern applied across other provider files in this PR.


44-47: LGTM! Test data updated consistently.

The key rename to 'enum backed string' and value constant change to BackedString::VALUE mirror the updates in SrcProvider.php and other providers, maintaining consistency across the test infrastructure.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread src/Element/HasUsemap.php Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant