Skip to content

fix(docs) Simplify documentation for HTML element enums and enhance clarity on contract implementations.#11

Merged
terabytesoftw merged 4 commits into
mainfrom
fix_mini_6
Feb 21, 2026
Merged

fix(docs) Simplify documentation for HTML element enums and enhance clarity on contract implementations.#11
terabytesoftw merged 4 commits into
mainfrom
fix_mini_6

Conversation

@terabytesoftw
Copy link
Copy Markdown
Contributor

Pull Request

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 21, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added SELECT and TEXT_AREA HTML element enums for improved support of form-related HTML elements.
  • Documentation

    • Refactored and simplified documentation across HTML element enum definitions. Descriptions now provide a clear, concise overview of what each enum represents and its relationship to the broader HTML element structure, making the implementation clearer and more accessible.

Walkthrough

Adds SELECT and TEXT_AREA cases to the Block enum and shortens PHPDoc blocks across multiple enum and interface files; also adds a CHANGELOG entry. No behavioral or signature changes beyond the two new enum cases.

Changes

Cohort / File(s) Summary
Changelog Entry
CHANGELOG.md
Added entry under 0.3.1 documenting Bug #11: simplified enum documentation and clarified contract implementation notes. No code changes.
Block enum
src/Block.php
Docblock rewritten; added enum cases SELECT ('select') and TEXT_AREA ('textarea'); adjusted FIELDSET/LEGEND doc notes.
Interface docblocks
src/BlockInterface.php, src/InlineInterface.php, src/VoidInterface.php
Replaced long descriptive PHPDoc blocks with concise notes stating each interface is backed by BackedEnum. No signature changes.
Other enum docblocks
src/Inline.php, src/Lists.php, src/MetadataBlock.php, src/MetadataVoid.php, src/Root.php, src/Table.php, src/Voids.php
Condensed multi-paragraph enum PHPDoc blocks to short descriptions indicating they are backed string enums implementing their respective interfaces. No enum case or behavior changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I nibbled through PHPDoc fine,
Added Select and TextArea to the line,
Trimmed the notes to short and neat,
Two small hops and enums complete,
A rabbit applauds this tidy feat.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: simplifying documentation for HTML element enums and enhancing clarity on contract implementations, which aligns with the extensive documentation updates across multiple files.
Description check ✅ Passed The description is related to the changeset, identifying it as a documentation bugfix that simplifies documentation for HTML element enums and improves clarity on contract implementations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_mini_6

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.

@coderabbitai coderabbitai Bot added the bug Something isn't working label Feb 21, 2026
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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/MetadataBlock.php (1)

8-14: ⚠️ Potential issue | 🟡 Minor

Copyright year is inconsistent with the other files modified in this PR.

src/MetadataBlock.php carries @copyright Copyright (C) 2026 while src/Lists.php, src/Block.php, and src/VoidInterface.php (all touched in the same PR in 2026) still state 2025. If this PR reflects work done in 2026, the copyright year should be updated consistently across all modified files.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/MetadataBlock.php` around lines 8 - 14, The copyright year in the file
header for MetadataBlock.php is inconsistent (shows 2026) with other modified
files (Lists.php, Block.php, VoidInterface.php) which use 2025; update the
header in MetadataBlock.php to match the project's chosen year (change the
Copyright (C) 2026 to Copyright (C) 2025) so all files modified in this PR are
consistent—locate the header comment at the top of MetadataBlock.php around the
MetadataBlock class/block enum declaration and edit the year accordingly.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51508ad and 2b661ba.

📒 Files selected for processing (12)
  • CHANGELOG.md
  • src/Block.php
  • src/BlockInterface.php
  • src/Inline.php
  • src/InlineInterface.php
  • src/Lists.php
  • src/MetadataBlock.php
  • src/MetadataVoid.php
  • src/Root.php
  • src/Table.php
  • src/VoidInterface.php
  • src/Voids.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). (2)
  • GitHub Check: linter / Super Linter
  • GitHub Check: linter / Super Linter
🔇 Additional comments (11)
src/InlineInterface.php (1)

9-16: LGTM!

The simplified docblock is concise and accurately describes the interface contract.

src/BlockInterface.php (1)

9-16: LGTM!

Consistent with the simplified docblock pattern applied across interfaces in this PR.

src/Table.php (1)

7-14: LGTM!

Docblock is clear and consistent with the pattern used across other enum files.

src/MetadataVoid.php (1)

7-14: LGTM!

Docblock is concise and consistent with the broader documentation pattern in this PR.

src/Root.php (1)

7-14: LGTM!

Consistent docblock simplification. No concerns.

src/Voids.php (1)

7-14: LGTM!

Docblock is clear and follows the same pattern as other enum files.

src/Inline.php (1)

7-14: LGTM!

Consistent and clear docblock simplification.

CHANGELOG.md (1)

5-5: Review comment is incorrect — no enum cases were removed.

The PR is a documentation fix ("fix(docs)") that simplifies and clarifies the Block enum documentation, not a breaking change. Block.php never contained H1H6 enum cases (heading elements are semantic content, not block-level elements). The changelog entry correctly labels this as a "Bug" fix for documentation improvement. No version bump or breaking change declarations are needed.

Likely an incorrect or invalid review comment.

src/Lists.php (1)

8-8: LGTM.

The docblock simplification is accurate and clearly describes the enum's nature and implemented contract.

src/VoidInterface.php (1)

10-10: LGTM.

The simplified docblock accurately describes the interface's purpose and its relationship to BackedEnum. The added "(self-closing)" parenthetical improves clarity over the prior description.

src/Block.php (1)

1-300: No H1–H6 removal in this PR — review comment is based on incorrect assumptions.

The reviewed change (version 0.3.1) is solely a documentation simplification of HTML element enums. The codebase contains no H1–H6 cases in the Block enum, no separate Heading enum, and no references to H1–H6 anywhere. The changelog for this PR makes no mention of H1–H6 removal, breaking changes, or enum refactoring. H1–H6 are either not part of this library's scope or were removed in an earlier version unrelated to this PR.

Likely an incorrect or invalid review comment.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Block.php`:
- Around line 141-148: The docblock for the enum case FORM incorrectly lists
"form-associated" — update the documentation for the case FORM = 'form' to
remove "form-associated" and state that the <form> element is categorized as
flow content and palpable content only; edit the block comment above the case
FORM constant in Block.php to reflect this corrected classification and keep the
MDN link intact for reference.
- Around line 188-193: Update the PHPDoc for the LEGEND enum case in Block.php:
remove the incorrect phrase "Categorized as flow, form-associated, and palpable
content" and replace it with a concise note stating that the <legend> element
has no standard content categories (e.g., "Elements without a category" per
MDN). Ensure the comment remains near the case LEGEND = 'legend' so it documents
that enum member accurately.
- Around line 267-290: The Block enum incorrectly contains SELECT and TEXT_AREA
cases (symbols SELECT and TEXT_AREA) which are phrasing/form-associated
elements; move these two enum members out of the Block enum and add them to the
Inline enum (keeping or copying their docblocks/links), remove them from Block,
and update any references/usages/tests that expect Block::SELECT or
Block::TEXT_AREA to instead use Inline::SELECT and Inline::TEXT_AREA so callers
and type checks reflect the new placement.

---

Outside diff comments:
In `@src/MetadataBlock.php`:
- Around line 8-14: The copyright year in the file header for MetadataBlock.php
is inconsistent (shows 2026) with other modified files (Lists.php, Block.php,
VoidInterface.php) which use 2025; update the header in MetadataBlock.php to
match the project's chosen year (change the Copyright (C) 2026 to Copyright (C)
2025) so all files modified in this PR are consistent—locate the header comment
at the top of MetadataBlock.php around the MetadataBlock class/block enum
declaration and edit the year accordingly.

Comment thread src/Block.php
Comment thread src/Block.php
Comment thread src/Block.php
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Block.php (1)

15-300: ⚠️ Potential issue | 🟠 Major

H1–H6 removal breaks backward compatibility and contradicts documentation.

The Block enum no longer contains H1–H6 cases, but the README.md file includes a code example that filters Block cases by the heading pattern (str_starts_with($tag->name, 'H')) and explicitly shows the output as h1 through h6. This example is now broken.

Two confirmed issues:

  1. BC break: Removing Block::H1 through Block::H6 will cause fatal "Undefined enum case" errors in any code—application, tests, or downstream packages—that references these cases. The PR description marks "Breaks BC: ❌", which is incorrect.

  2. Inconsistent documentation: The README.md code example (under "Filtering and iterating tags") no longer works with the current Block enum and should be updated to remove the heading filter example or the cases should be restored.

Per the library's own classification rule (Block = elements with distinct opening/closing tags), H1–H6 clearly qualify alongside other block-level elements already in the enum.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Block.php` around lines 15 - 300, The Block enum removed the H1–H6 cases,
breaking backwards compatibility and invalidating the README example that
filters tags by heading names; restore the enum cases Block::H1 through
Block::H6 (values 'h1'..'h6') inside the Block enum definition so existing
references and the README example continue to work, and update the PR metadata
to mark "Breaks BC" as ❌ if it currently states otherwise; alternatively, if
removal was intentional, update README's "Filtering and iterating tags" example
to remove the heading filter and add a migration note, but the recommended fix
is to re-add the H1–H6 enum cases to Block to preserve BC.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2b661ba and f547a1f.

📒 Files selected for processing (1)
  • src/Block.php
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: terabytesoftw
Repo: ui-awesome/html-interop PR: 11
File: src/Block.php:267-290
Timestamp: 2026-02-21T14:17:54.250Z
Learning: In the ui-awesome/html-interop library, the Block enum classification is based on elements that have begin() and end() methods (separate opening and closing tags), while the Inline enum is for elements rendered on the same line (like <span></span>). This is not based on HTML's standard content categories (block-level vs phrasing content), but rather on the library's API pattern for rendering elements. Elements like <select> and <textarea> belong in Block because they use begin/end methods, even though they are technically phrasing content in HTML specifications.
📚 Learning: 2026-02-21T14:17:54.250Z
Learnt from: terabytesoftw
Repo: ui-awesome/html-interop PR: 11
File: src/Block.php:267-290
Timestamp: 2026-02-21T14:17:54.250Z
Learning: In code reviews for ui-awesome/html-interop, classify Block vs Inline based on the library's API pattern, not HTML's block/phrasing categories. Specifically: - Block enum should include elements that use distinct begin() and end() methods (separate opening and closing tags). - Inline enum covers elements rendered on the same line. Do not rely on HTML content-model assumptions. For example, elements like <select> and <textarea> should be categorized as Block because they use begin/end methods, even though they are phrasing content in HTML. Apply this rule consistently to files that define or modify Block/Inline classifications in the codebase.

Applied to files:

  • src/Block.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). (2)
  • GitHub Check: linter / Super Linter
  • GitHub Check: linter / Super Linter
🔇 Additional comments (2)
src/Block.php (2)

188-193: LGTM — LEGEND docblock correctly updated.

Replacing the incorrect content-category annotation with "Permitted as the first child of a {@see self::FIELDSET} element" accurately reflects MDN's description and resolves the previously flagged issue.


267-290: LGTM — SELECT and TEXT_AREA correctly placed in Block per the library's begin/end API convention.

Based on learnings, elements that use distinct begin()/end() rendering methods belong in Block regardless of their HTML content category, and both <select> and <textarea> satisfy that criterion.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Block.php`:
- Line 110: Update the docblock line that currently reads "Categorized as flow,
and palpable content." to remove the spurious comma so it matches other two-item
lines (e.g., ADDRESS, BLOCKQUOTE, FIGURE); locate the line in src/Block.php (the
Block class docblock) and change it to "Categorized as flow and palpable
content." to maintain consistency.
- Around line 8-10: Update the top-level docblock for the Block enum (the backed
string enum implementing BlockInterface) to reflect that it lists elements
treated by the library with distinct begin()/end() rendering calls rather than
literal HTML "block-level content"; remove or replace the existing MDN
"Block-level content" `@link` and change the description text to state the enum's
purpose (elements rendered via separate begin()/end() methods), optionally
linking to an internal docs page or a more appropriate spec that matches this
membership rule.

---

Outside diff comments:
In `@src/Block.php`:
- Around line 15-300: The Block enum removed the H1–H6 cases, breaking backwards
compatibility and invalidating the README example that filters tags by heading
names; restore the enum cases Block::H1 through Block::H6 (values 'h1'..'h6')
inside the Block enum definition so existing references and the README example
continue to work, and update the PR metadata to mark "Breaks BC" as ❌ if it
currently states otherwise; alternatively, if removal was intentional, update
README's "Filtering and iterating tags" example to remove the heading filter and
add a migration note, but the recommended fix is to re-add the H1–H6 enum cases
to Block to preserve BC.

---

Duplicate comments:
In `@src/Block.php`:
- Around line 141-148: The PHPDoc for the enum case FORM incorrectly lists
"form-associated" — update the docblock for the case FORM in src/Block.php to
remove "form-associated" and state only "flow" and "palpable content" (i.e.,
change the descriptive line above case FORM = 'form' to reflect that <form> is
the form owner and belongs only to flow and palpable content per the HTML
standard); ensure the `@link` and other lines remain intact but adjust the short
description to remove the incorrect "form-associated" term.

Comment thread src/Block.php
Comment thread src/Block.php
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.

📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f547a1f and 54aebc1.

📒 Files selected for processing (1)
  • src/Block.php
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-02-21T14:17:54.250Z
Learnt from: terabytesoftw
Repo: ui-awesome/html-interop PR: 11
File: src/Block.php:267-290
Timestamp: 2026-02-21T14:17:54.250Z
Learning: In code reviews for ui-awesome/html-interop, classify Block vs Inline based on the library's API pattern, not HTML's block/phrasing categories. Specifically: - Block enum should include elements that use distinct begin() and end() methods (separate opening and closing tags). - Inline enum covers elements rendered on the same line. Do not rely on HTML content-model assumptions. For example, elements like <select> and <textarea> should be categorized as Block because they use begin/end methods, even though they are phrasing content in HTML. Apply this rule consistently to files that define or modify Block/Inline classifications in the codebase.

Applied to files:

  • src/Block.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). (2)
  • GitHub Check: linter / Super Linter
  • GitHub Check: linter / Super Linter
🔇 Additional comments (3)
src/Block.php (3)

240-247: LGTM — <legend> docblock correctly updated.

The note "Permitted as the first child of a {@see self::FIELDSET} element." is accurate per MDN and addresses the prior review finding.


321-328: LGTM — SELECT correctly added to Block.

The docblock categorization is accurate per MDN, and placement in Block (rather than Inline) is intentional per the library's begin()/end() rendering API pattern. Based on learnings, <select> belongs here because it uses separate opening and closing tag rendering calls.


337-344: LGTM — TEXT_AREA correctly added to Block.

Docblock categorization matches MDN, and begin()/end() API semantics confirm placement in Block. Based on learnings, <textarea> belongs here for the same reason as <select>.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/Block.php`:
- Line 110: Remove the spurious comma in the FIELDSET docblock: find the
docblock that contains the phrase "Categorized as flow, and palpable content."
(the FIELDSET documentation) and edit it to read "Categorized as flow and
palpable content." so it matches the comma-less two-item phrasing used by other
entries like ADDRESS, BLOCKQUOTE, FIGURE, and FOOTER.

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