Skip to content

fix(attribute): Move HTML attribute traits to Form namespace and update related imports accordingly.#71

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

fix(attribute): Move HTML attribute traits to Form namespace and update related imports accordingly.#71
terabytesoftw merged 2 commits into
mainfrom
fix_mini_20

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 4, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of form attributes and broadened accepted value types (now supports enum-backed values and Stringable where applicable), reducing validation false-positives.
  • Documentation

    • Clarified form-control applicability and guidance for various attributes (placeholder, autocomplete, minlength/maxlength, min/max, step, size, etc.) with clearer examples.
  • Tests

    • Expanded test coverage to include enum-backed and Stringable inputs for form attributes.

Walkthrough

Relocates many form-related attribute traits from UIAwesome\Html\Attribute into UIAwesome\Html\Attribute\Form, updates imports/tests/providers accordingly, and extends several attribute setter signatures/tests to accept Stringable and UnitEnum (with runtime normalization where applicable).

Changes

Cohort / File(s) Summary
Form Attribute Traits
src/Form/HasAccept.php, src/Form/HasAutocomplete.php, src/Form/HasChecked.php, src/Form/HasDirname.php, src/Form/HasDisabled.php, src/Form/HasForm.php, src/Form/HasList.php, src/Form/HasMultiple.php, src/Form/HasPattern.php, src/Form/HasPlaceholder.php, src/Form/HasReadonly.php, src/Form/HasRequired.php, src/Form/HasSize.php, src/Form/HasStep.php
Namespace changed from UIAwesome\Html\AttributeUIAwesome\Html\Attribute\Form; docblocks revised to explicitly reference form control elements. No signature logic changes.
Form Attribute Traits with Type Extensions
src/Form/HasMax.php, src/Form/HasMaxlength.php, src/Form/HasMin.php, src/Form/HasMinlength.php
Namespace moved to ...\Form; method parameter unions extended to include UnitEnum and/or Stringable where applicable; added runtime normalization via Enum::normalizeValue() for UnitEnum inputs in maxlength/minlength handling.
Root Attribute Trait
src/HasName.php
Expanded parameter type to `string
Form Attribute Tests (namespaces/refs)
tests/Form/HasAcceptTest.php, tests/Form/HasAutocompleteTest.php, tests/Form/HasCheckedTest.php, tests/Form/HasDirnameTest.php, tests/Form/HasDisabledTest.php, tests/Form/HasFormTest.php, tests/Form/HasListTest.php, tests/Form/HasMultipleTest.php, tests/Form/HasPatternTest.php, tests/Form/HasPlaceholderTest.php, tests/Form/HasReadonlyTest.php, tests/Form/HasRequiredTest.php, tests/Form/HasSizeTest.php
Test namespaces changed to UIAwesome\Html\Attribute\Tests\Form; imports updated to point at UIAwesome\Html\Attribute\Form\* and corresponding provider paths.
Form Attribute Tests with Type Extensions
tests/Form/HasMaxTest.php, tests/Form/HasMaxlengthTest.php, tests/Form/HasMinTest.php, tests/Form/HasMinlengthTest.php, tests/Form/HasStepTest.php
Test namespaces/imports updated; test method parameter types widened to accept Stringable/UnitEnum; tests add Enum::normalizeValue() handling for enum-backed inputs.
Root Attribute Test
tests/HasNameTest.php
Test parameter types updated to include Stringable; removed the invalid-name exception test; provider/imports adjusted.
Form Test Data Providers (namespaces/refs)
tests/Provider/Form/AcceptProvider.php, tests/Provider/Form/AutocompleteProvider.php, tests/Provider/Form/CheckedProvider.php, tests/Provider/Form/DirnameProvider.php, tests/Provider/Form/DisabledProvider.php, tests/Provider/Form/FormProvider.php, tests/Provider/Form/ListProvider.php, tests/Provider/Form/MultipleProvider.php, tests/Provider/Form/PatternProvider.php, tests/Provider/Form/PlaceholderProvider.php, tests/Provider/Form/ReadonlyProvider.php, tests/Provider/Form/RequiredProvider.php, tests/Provider/Form/SizeProvider.php
Provider namespaces moved from UIAwesome\Html\Attribute\Tests\Support\ProviderUIAwesome\Html\Attribute\Tests\Provider\Form; docblock @see references and minor data/import adjustments applied.
Form Test Data Providers with Type Extensions
tests/Provider/Form/MaxProvider.php, tests/Provider/Form/MaxlengthProvider.php, tests/Provider/Form/MinProvider.php, tests/Provider/Form/MinlengthProvider.php, tests/Provider/Form/StepProvider.php
Provider namespaces updated; imports added for BackedString/BackedInteger/Unit, Stringable, UnitEnum; phpdoc return types broadened; new test cases for enum-backed/UnitEnum and Stringable scenarios added.
Root Test Data Provider
tests/Provider/NameProvider.php
Namespace moved to UIAwesome\Html\Attribute\Tests\Provider; Stringable support added in data and phpdoc; test data simplified to include Stringable case.
Changelog
CHANGELOG.md
Added entry documenting Bug #71: relocation of HTML attribute traits into UIAwesome\Html\Attribute\Form and related import/test updates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I hopped through traits and moved each one,
Into a Form-nest tidy and fun.
Enums and Stringables join the parade,
Namespaces settled in the shade.
A little burrow where attributes run.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly describes the main change: moving HTML attribute traits to Form namespace and updating imports, which aligns with the changeset of relocating 15+ form-related trait files.
Description check ✅ Passed The PR description is related to the changeset, confirming it's a bugfix that moves HTML attribute traits to Form namespace without breaking changes.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.

✏️ 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_20

📜 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 61af491 and 585be80.

📒 Files selected for processing (2)
  • src/Form/HasMinlength.php
  • tests/HasNameTest.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/HasNameTest.php
  • src/Form/HasMinlength.php
🧬 Code graph analysis (1)
tests/HasNameTest.php (2)
tests/Provider/NameProvider.php (1)
  • NameProvider (20-86)
src/HasName.php (1)
  • name (54-57)
🪛 PHPMD (2.15.0)
src/Form/HasMinlength.php

[error] 67-67: Avoid using static access to class '\UIAwesome\Html\Helper\Enum' in method 'minlength'. (undefined)

(StaticAccess)

⏰ 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: linter / Super Linter
  • GitHub Check: phpunit / PHP 8.5-windows-2022
  • GitHub Check: phpunit / PHP 8.1-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.2-windows-2022
  • GitHub Check: phpunit / PHP 8.4-windows-2022
  • GitHub Check: phpunit / PHP 8.1-windows-2022
  • GitHub Check: phpunit / PHP 8.3-windows-2022
  • GitHub Check: phpunit / PHP 8.4-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.5-ubuntu-latest
  • GitHub Check: easy-coding-standard / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.4-ubuntu-latest
  • GitHub Check: linter / Super Linter
🔇 Additional comments (6)
tests/HasNameTest.php (2)

9-13: Imports align with updated namespaces and Stringable support.
Looks good—imports now match the updated provider/attribute locations and the new Stringable usage.


66-70: Signature matches trait/provider types.
The union types align with the HasName trait and NameProvider expectations.

src/Form/HasMinlength.php (4)

5-12: LGTM!

Namespace move to Form and the new imports for Enum helper and UnitEnum are correctly added to support the expanded parameter types.


21-27: Docblock correctly updated.

The documentation now accurately reflects the expanded parameter types (int, string, Stringable, UnitEnum, null) and the @method annotation includes UnitEnum for the key type. The previous review concern has been addressed.


50-64: LGTM!

Method signature and @param annotation are consistent, properly documenting the expanded type support for UnitEnum.


66-80: LGTM!

The UnitEnum normalization flow is correctly implemented: values are normalized via Enum::normalizeValue() before the intLike validation check. The static access flagged by PHPMD is a standard pattern for utility/helper classes in PHP and can be safely ignored.

✏️ 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.

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

Caution

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

⚠️ Outside diff range comments (3)
src/Form/HasSize.php (1)

67-79: ⚠️ Potential issue | 🟠 Major

Add validation to reject negative size values matching the error message 'value >= 0'.

The validation currently only checks Validator::intLike(), which accepts negative values. However, the error message claims 'value >= 0'. Similar attributes maxlength and minlength explicitly validate against negative values in their test suites (rejecting -1 and '-1'), but size does not. This inconsistency allows negative values to pass validation, contradicting the documented constraint.

Suggested fix
     if ($value !== null && Validator::intLike($value) === false) {
         throw new InvalidArgumentException(
             Message::ATTRIBUTE_INVALID_VALUE->getMessage(
                 (string) $value,
                 Attribute::SIZE->value,
                 'value >= 0',
             ),
         );
     }
+
+    if ($value !== null && (int) (string) $value < 0) {
+        throw new InvalidArgumentException(
+            Message::ATTRIBUTE_INVALID_VALUE->getMessage(
+                (string) $value,
+                Attribute::SIZE->value,
+                'value >= 0',
+            ),
+        );
+    }
tests/Form/HasMinlengthTest.php (1)

69-105: 🛠️ Refactor suggestion | 🟠 Major

Pass unnormalized enum to the trait to test its UnitEnum handling path.

The current test normalizes $minlength before calling the trait's minlength() method, which bypasses the trait's own UnitEnum normalization at line 66 of HasMinlength.php. This skips code coverage for the enum branch in the method under test. Pass the unnormalized enum to minlength() to exercise the trait's handling, and use a normalized copy only for the exception message assertion.

♻️ Suggested adjustment
        if ($minlength instanceof UnitEnum) {
            $minlength = Enum::normalizeValue($minlength);
        }
+        $normalized = $minlength instanceof UnitEnum
+            ? Enum::normalizeValue($minlength)
+            : $minlength;
+
+        $this->expectException(InvalidArgumentException::class);
+        $this->expectExceptionMessage(
+            Message::ATTRIBUTE_INVALID_VALUE->getMessage(
+                (string) $normalized,
tests/Form/HasMaxlengthTest.php (1)

103-116: ⚠️ Potential issue | 🟡 Minor

Test normalizes UnitEnum before passing to the method under test, which alters what is actually being tested.

The normalization at lines 103-105 converts the UnitEnum to a string before calling maxlength(). This means the test no longer verifies that HasMaxlength::maxlength() correctly handles UnitEnum inputs for invalid values—it only tests string handling.

If the trait is supposed to handle UnitEnum normalization internally (as indicated by the expanded type signature accepting UnitEnum), the test should pass the UnitEnum directly and let the trait normalize it.

🔧 Proposed fix to test UnitEnum handling directly
-        if ($maxlength instanceof UnitEnum) {
-            $maxlength = Enum::normalizeValue($maxlength);
-        }
-
         $this->expectException(InvalidArgumentException::class);
         $this->expectExceptionMessage(
             Message::ATTRIBUTE_INVALID_VALUE->getMessage(
-                (string) $maxlength,
+                $maxlength instanceof UnitEnum ? Enum::normalizeValue($maxlength) : (string) $maxlength,
                 Attribute::MAXLENGTH->value,
                 'value >= 0',
             ),
         );

         $instance->maxlength($maxlength);
🤖 Fix all issues with AI agents
In `@src/Form/HasMinlength.php`:
- Around line 21-26: Update the docblock for the HasMinlength trait/method to
reflect the expanded parameter types: document that the minlength setter accepts
int|string|\Stringable|\UnitEnum|null (not just int|null), keep notes that it is
designed for form controls (<input>, <textarea>), is immutable, and handles the
HTML minlength attribute; reference the method/trait name HasMinlength and the
minlength setter (e.g., setMinlength or withMinlength) so the doc matches the
actual signature.

In `@tests/HasNameTest.php`:
- Around line 66-72: The union type order on the testSetNameAttributeValue
method's first parameter should match the source trait for readability; update
the parameter type from string|UnitEnum|Stringable|null to
string|Stringable|UnitEnum|null in the testSetNameAttributeValue function
signature so it aligns with the source trait's ordering.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d0f0337 and 61af491.

📒 Files selected for processing (58)
  • CHANGELOG.md
  • src/Form/HasAccept.php
  • src/Form/HasAutocomplete.php
  • src/Form/HasChecked.php
  • src/Form/HasDirname.php
  • src/Form/HasDisabled.php
  • src/Form/HasForm.php
  • src/Form/HasList.php
  • src/Form/HasMax.php
  • src/Form/HasMaxlength.php
  • src/Form/HasMin.php
  • src/Form/HasMinlength.php
  • src/Form/HasMultiple.php
  • src/Form/HasPattern.php
  • src/Form/HasPlaceholder.php
  • src/Form/HasReadonly.php
  • src/Form/HasRequired.php
  • src/Form/HasSize.php
  • src/Form/HasStep.php
  • src/HasName.php
  • tests/Form/HasAcceptTest.php
  • tests/Form/HasAutocompleteTest.php
  • tests/Form/HasCheckedTest.php
  • tests/Form/HasDirnameTest.php
  • tests/Form/HasDisabledTest.php
  • tests/Form/HasFormTest.php
  • tests/Form/HasListTest.php
  • tests/Form/HasMaxTest.php
  • tests/Form/HasMaxlengthTest.php
  • tests/Form/HasMinTest.php
  • tests/Form/HasMinlengthTest.php
  • tests/Form/HasMultipleTest.php
  • tests/Form/HasPatternTest.php
  • tests/Form/HasPlaceholderTest.php
  • tests/Form/HasReadonlyTest.php
  • tests/Form/HasRequiredTest.php
  • tests/Form/HasSizeTest.php
  • tests/Form/HasStepTest.php
  • tests/HasNameTest.php
  • tests/Provider/Form/AcceptProvider.php
  • tests/Provider/Form/AutocompleteProvider.php
  • tests/Provider/Form/CheckedProvider.php
  • tests/Provider/Form/DirnameProvider.php
  • tests/Provider/Form/DisabledProvider.php
  • tests/Provider/Form/FormProvider.php
  • tests/Provider/Form/ListProvider.php
  • tests/Provider/Form/MaxProvider.php
  • tests/Provider/Form/MaxlengthProvider.php
  • tests/Provider/Form/MinProvider.php
  • tests/Provider/Form/MinlengthProvider.php
  • tests/Provider/Form/MultipleProvider.php
  • tests/Provider/Form/PatternProvider.php
  • tests/Provider/Form/PlaceholderProvider.php
  • tests/Provider/Form/ReadonlyProvider.php
  • tests/Provider/Form/RequiredProvider.php
  • tests/Provider/Form/SizeProvider.php
  • tests/Provider/Form/StepProvider.php
  • tests/Provider/NameProvider.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/Form/HasDisabledTest.php
  • src/Form/HasMaxlength.php
  • tests/Form/HasFormTest.php
  • tests/Form/HasRequiredTest.php
  • src/Form/HasChecked.php
  • tests/Form/HasListTest.php
  • src/Form/HasMultiple.php
  • tests/Provider/Form/DirnameProvider.php
  • src/Form/HasDisabled.php
  • tests/Provider/Form/CheckedProvider.php
  • src/Form/HasMin.php
  • tests/Provider/Form/PatternProvider.php
  • tests/Form/HasMaxTest.php
  • tests/Form/HasPatternTest.php
  • tests/Provider/Form/StepProvider.php
  • tests/Form/HasStepTest.php
  • tests/Provider/Form/MultipleProvider.php
  • src/Form/HasDirname.php
  • tests/Form/HasMultipleTest.php
  • src/Form/HasList.php
  • src/Form/HasSize.php
  • src/Form/HasForm.php
  • tests/Form/HasReadonlyTest.php
  • tests/Provider/Form/DisabledProvider.php
  • tests/Form/HasDirnameTest.php
  • src/Form/HasReadonly.php
  • tests/Provider/Form/RequiredProvider.php
  • tests/Provider/Form/PlaceholderProvider.php
  • tests/Form/HasPlaceholderTest.php
  • src/Form/HasStep.php
  • tests/Form/HasAcceptTest.php
  • tests/Provider/Form/SizeProvider.php
  • tests/Form/HasMinlengthTest.php
  • src/Form/HasMinlength.php
  • tests/HasNameTest.php
  • src/Form/HasAutocomplete.php
  • tests/Provider/Form/ReadonlyProvider.php
  • tests/Form/HasCheckedTest.php
  • tests/Form/HasMinTest.php
  • tests/Form/HasSizeTest.php
  • tests/Form/HasAutocompleteTest.php
  • tests/Provider/Form/MinlengthProvider.php
  • src/Form/HasRequired.php
  • tests/Provider/Form/AcceptProvider.php
  • src/Form/HasMax.php
  • tests/Provider/Form/AutocompleteProvider.php
  • src/Form/HasPlaceholder.php
  • tests/Provider/Form/MaxlengthProvider.php
  • tests/Provider/NameProvider.php
  • src/Form/HasAccept.php
  • tests/Provider/Form/ListProvider.php
  • tests/Provider/Form/MaxProvider.php
  • tests/Form/HasMaxlengthTest.php
  • tests/Provider/Form/MinProvider.php
  • src/Form/HasPattern.php
  • src/HasName.php
  • tests/Provider/Form/FormProvider.php
🧬 Code graph analysis (21)
tests/Form/HasDisabledTest.php (1)
tests/Provider/Form/DisabledProvider.php (1)
  • DisabledProvider (15-60)
tests/Form/HasFormTest.php (1)
tests/Provider/Form/FormProvider.php (1)
  • FormProvider (19-95)
tests/Form/HasRequiredTest.php (1)
tests/Provider/Form/RequiredProvider.php (1)
  • RequiredProvider (15-60)
tests/Form/HasListTest.php (1)
tests/Provider/Form/ListProvider.php (1)
  • ListProvider (19-95)
tests/Form/HasMaxTest.php (1)
src/Form/HasMax.php (1)
  • max (62-65)
tests/Form/HasPatternTest.php (1)
tests/Provider/Form/PatternProvider.php (1)
  • PatternProvider (19-95)
tests/Form/HasStepTest.php (1)
src/Form/HasStep.php (1)
  • step (67-70)
tests/Form/HasMultipleTest.php (1)
tests/Provider/Form/MultipleProvider.php (1)
  • MultipleProvider (15-60)
tests/Form/HasReadonlyTest.php (1)
tests/Provider/Form/ReadonlyProvider.php (1)
  • ReadonlyProvider (15-60)
tests/Form/HasAcceptTest.php (1)
tests/Provider/Form/AcceptProvider.php (1)
  • AcceptProvider (19-95)
tests/Form/HasMinlengthTest.php (1)
src/Form/HasMinlength.php (1)
  • minlength (64-81)
tests/HasNameTest.php (2)
tests/Provider/NameProvider.php (1)
  • NameProvider (20-86)
src/HasName.php (1)
  • name (54-57)
tests/Form/HasCheckedTest.php (1)
tests/Provider/Form/CheckedProvider.php (1)
  • CheckedProvider (15-60)
tests/Form/HasMinTest.php (2)
tests/Provider/Form/MinProvider.php (1)
  • MinProvider (19-109)
src/Form/HasMin.php (1)
  • min (68-71)
tests/Form/HasSizeTest.php (1)
tests/Provider/Form/SizeProvider.php (1)
  • SizeProvider (19-88)
tests/Form/HasAutocompleteTest.php (1)
tests/Provider/Form/AutocompleteProvider.php (1)
  • AutocompleteProvider (19-95)
tests/Provider/Form/MinlengthProvider.php (1)
tests/Provider/Form/MaxlengthProvider.php (1)
  • invalidValues (24-51)
tests/Provider/Form/MaxlengthProvider.php (1)
tests/Provider/Form/MinlengthProvider.php (1)
  • invalidValues (24-51)
tests/Provider/NameProvider.php (4)
tests/Provider/Form/FormProvider.php (2)
  • values (27-94)
  • __toString (30-33)
tests/Provider/Form/PatternProvider.php (2)
  • values (27-94)
  • __toString (30-33)
src/Global/HasClass.php (1)
  • class (68-79)
tests/Provider/Form/SizeProvider.php (1)
  • __toString (30-33)
tests/Provider/Form/MinProvider.php (4)
tests/Provider/Form/FormProvider.php (2)
  • values (27-94)
  • __toString (30-33)
tests/Provider/Form/SizeProvider.php (2)
  • values (27-87)
  • __toString (30-33)
tests/Provider/Form/StepProvider.php (1)
  • __toString (30-33)
tests/Provider/NameProvider.php (1)
  • __toString (33-36)
src/HasName.php (1)
src/HasValue.php (1)
  • value (60-63)
🪛 PHPMD (2.15.0)
src/Form/HasMaxlength.php

[error] 68-68: Avoid using static access to class '\UIAwesome\Html\Helper\Enum' in method 'maxlength'. (undefined)

(StaticAccess)

tests/Form/HasMinlengthTest.php

[error] 104-104: Avoid using static access to class '\UIAwesome\Html\Helper\Enum' in method 'testThrowInvalidArgumentExceptionForSettingInvalidMinlengthAttribute'. (undefined)

(StaticAccess)

src/Form/HasMinlength.php

[error] 67-67: Avoid using static access to class '\UIAwesome\Html\Helper\Enum' in method 'minlength'. (undefined)

(StaticAccess)

tests/Provider/NameProvider.php

[error] 30-30: Avoid using static access to class '\PHPForge\Support\EnumDataProvider' in method 'values'. (undefined)

(StaticAccess)

tests/Form/HasMaxlengthTest.php

[error] 104-104: Avoid using static access to class '\UIAwesome\Html\Helper\Enum' in method 'testThrowInvalidArgumentExceptionForSettingInvalidMaxlengthAttribute'. (undefined)

(StaticAccess)

⏰ 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). (7)
  • GitHub Check: phpunit / PHP 8.2-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.5-windows-2022
  • GitHub Check: phpunit / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.4-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.2-windows-2022
  • GitHub Check: linter / Super Linter
  • GitHub Check: linter / Super Linter
🔇 Additional comments (70)
tests/HasNameTest.php (2)

9-14: Imports align with updated trait and provider structure.

The added imports for Stringable, Attribute, and Attributes correctly support the expanded type signatures and attribute rendering verification.


78-89: Test assertions correctly validate both attribute storage and rendering.

The dual assertions verify that the attribute is stored with the expected value and renders correctly, providing comprehensive coverage for the expanded Stringable type support.

src/HasName.php (4)

7-9: Imports are correctly structured for the expanded type support.

Adding Stringable import aligns with the pattern used in HasValue.php and other similar traits in the codebase.


54-57: Method signature expansion follows established codebase patterns.

The addition of Stringable to the union type is consistent with HasValue::value() (which accepts float|int|string|Stringable|UnitEnum|null) and provides flexibility for objects implementing __toString().


11-23: Documentation comprehensively covers the trait's expanded scope.

The docblock accurately describes:

  • All supported HTML elements that use the name attribute
  • The expanded type flexibility with Stringable support
  • Immutability contract

45-45: No action required — MetaName enum reference is valid.

The MetaName enum exists at the documented namespace path UIAwesome\Html\Attribute\Values\MetaName (defined in src/Values/MetaName.php). The @see annotation is accurate and the enum is actively used in the codebase without any namespace issues.

CHANGELOG.md (1)

44-44: Changelog entry aligns with PR scope.

src/Form/HasAccept.php (1)

5-22: Namespace relocation and doc updates look good.

src/Form/HasList.php (1)

5-45: Doc clarifications and namespace move are consistent.

src/Form/HasDisabled.php (1)

5-46: Namespace move and expanded documentation look solid.

tests/Provider/Form/SizeProvider.php (1)

5-12: Provider namespace update matches the new Form structure.

src/Form/HasDirname.php (1)

5-45: Namespace relocation and clarified dirname behavior are fine.

tests/Provider/Form/ReadonlyProvider.php (1)

5-8: No action needed—copyright year is correct.

The file tests/Provider/Form/ReadonlyProvider.php was originally created in this repository in February 2026 (commit 296b742), not moved from ui-awesome/html-core or another package. The 2026 copyright year accurately reflects the original creation year and should remain unchanged. The subsequent namespace move (commit 61af491) within the same repository does not alter the copyright date appropriateness.

Likely an incorrect or invalid review comment.

tests/Provider/Form/MultipleProvider.php (1)

5-14: LGTM!

The namespace relocation to UIAwesome\Html\Attribute\Tests\Provider\Form and the updated docblock reference to Form\HasMultipleTest correctly align with the Form namespace restructuring.

src/Form/HasMultiple.php (1)

5-59: LGTM!

The namespace relocation to UIAwesome\Html\Attribute\Form and the enhanced documentation clarifying usage for form control elements (<input type="email">, <input type="file">, and <select>) are well-executed. The immutable API and method implementation remain correct.

tests/Form/HasMultipleTest.php (1)

5-11: LGTM!

The namespace and import updates correctly align with the Form namespace restructuring. The test class properly imports HasMultiple from UIAwesome\Html\Attribute\Form and MultipleProvider from UIAwesome\Html\Attribute\Tests\Provider\Form.

tests/Provider/Form/StepProvider.php (2)

5-12: LGTM!

The namespace relocation and updated imports correctly align with the Form namespace restructuring. The new imports for BackedInteger, BackedString, and Unit from PHPForge\Support\Stub enable comprehensive enum-backed value testing.


44-64: LGTM!

The new enum test cases comprehensively cover UnitEnum support:

  • BackedInteger::VALUE tests integer-backed enums
  • BackedString::VALUE tests string-backed enums
  • Unit::value tests unit enums

The expected rendered outputs correctly reflect the enum values.

tests/Provider/NameProvider.php (3)

5-10: LGTM!

The namespace update and addition of Stringable import align with the broader type expansion pattern seen across the PR.


22-37: LGTM!

The expanded PHPStan return type correctly includes Stringable in the tuple, and the inline Stringable implementation follows the established pattern used in other providers (e.g., FormProvider, PatternProvider).


61-74: LGTM!

The renamed 'string' test case and new 'stringable' test case properly validate Stringable input handling, consistent with the pattern established in other Form providers.

src/Form/HasChecked.php (1)

5-57: LGTM!

The namespace relocation to UIAwesome\Html\Attribute\Form and enhanced documentation for checkbox/radio elements are well-executed. The clarified behavior description for form control elements improves the trait's documentation quality.

tests/Form/HasListTest.php (1)

5-14: LGTM!

The namespace and import updates correctly align with the Form namespace restructuring. The test class properly imports HasList from UIAwesome\Html\Attribute\Form and ListProvider from UIAwesome\Html\Attribute\Tests\Provider\Form.

tests/Form/HasDisabledTest.php (1)

5-11: Namespace/import updates look consistent with the Form move.

src/Form/HasReadonly.php (1)

5-60: Doc/namespace updates are consistent and safe.

tests/Form/HasReadonlyTest.php (1)

5-11: Namespace/import updates look consistent with the Form move.

src/Form/HasAutocomplete.php (1)

5-64: Doc/namespace updates are consistent and safe.

src/Form/HasMax.php (1)

5-65: Doc/namespace updates are consistent and safe.

src/Form/HasMinlength.php (1)

11-70: Verify Enum/Validator compatibility with external dependency ui-awesome/html-helper.

The minlength() method now accepts UnitEnum and Stringable types, but these rely on external helpers from ui-awesome/html-helper (^0.6). Ensure that:

  • Enum::normalizeValue() properly handles the normalized value type for downstream validation.
  • Validator::intLike() accepts Stringable inputs, or add normalization: if ($value instanceof Stringable) { $value = (string) $value; } before the validation call.

Check the ui-awesome/html-helper package documentation or source code to confirm compatibility.

tests/Provider/Form/DisabledProvider.php (1)

5-13: No changes needed. The copyright year 2026 in the file header is correct and matches the original creation date (January 30, 2026) when the file was first added to the repository.

src/Form/HasMin.php (1)

5-53: LGTM — namespace move and doc refinements are consistent.

Also applies to: 68-70

src/Form/HasPattern.php (1)

5-50: LGTM — Form namespace alignment and doc clarifications read well.

Also applies to: 64-66

tests/Provider/Form/ListProvider.php (1)

5-43: LGTM — provider namespace move and added empty-string case are clear.

tests/Provider/Form/AutocompleteProvider.php (1)

5-47: LGTM — Form provider updates look consistent with enum-backed test data.

Also applies to: 77-77

tests/Form/HasAutocompleteTest.php (1)

5-11: LGTM — test namespace/import updates are coherent.

src/Form/HasSize.php (1)

5-48: LGTM — namespace move and doc refinements are consistent.

Also applies to: 83-84

tests/Form/HasSizeTest.php (1)

5-11: LGTM — Form namespace/import updates are consistent.

src/Form/HasForm.php (2)

5-6: Verify original copyright year preserved after the namespace move.

Since this trait was moved into the Form namespace, please confirm the file header keeps its original creation year rather than being updated to the current year.
Based on learnings: 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.


18-23: Doc updates look good.

The expanded element list and type support clarification are consistent with the move to the Form namespace.

src/Form/HasPlaceholder.php (1)

19-25: Documentation refresh is solid.

The form-control scope and placeholder behavior notes are clearer and consistent.

tests/Provider/Form/PlaceholderProvider.php (1)

5-13: Namespace alignment looks correct.

Provider now matches the Form test namespace and reference.

tests/Form/HasPlaceholderTest.php (1)

5-12: Test imports updated correctly.

The Form trait and provider references are consistent with the new namespaces.

src/Form/HasStep.php (1)

19-52: Doc clarification is helpful.

The step semantics and supported input types are clearer without changing behavior.

src/Form/HasRequired.php (1)

17-46: Documentation updates look good.

The element support and validation rules are clearer and consistent.

src/Form/HasMaxlength.php (1)

11-69: No action required. Enum::normalizeValue() is properly declared in the ui-awesome/html-helper v0.6.x dependency (as per composer.json constraint) and is correctly imported at line 11. The method exists, is static, and is consistently used throughout the codebase (HasMaxlength, HasMinlength, HasSize traits and tests).

tests/Provider/Form/RequiredProvider.php (1)

5-8: Form provider namespace + docblock update is consistent.
Aligns the provider with the Form test namespace without changing behavior.

tests/Form/HasRequiredTest.php (1)

5-10: Form namespace/import alignment looks good.
HasRequired and RequiredProvider now resolve to the Form paths as intended.

tests/Form/HasStepTest.php (2)

5-16: Form namespace + imports are aligned.
The test now targets the Form trait/provider paths.


67-69: The PHP version constraint in composer.json is ^8.1, which fully supports the use of UnitEnum in the method signature. No version compatibility issues exist.

tests/Form/HasMinTest.php (2)

5-16: Form namespace/import updates look consistent.
HasMin and MinProvider now reference the Form namespace as expected.


67-69: PHP version constraint is correctly configured. The composer.json already requires "php": "^8.1", which fully supports UnitEnum in type hints. No changes needed.

tests/Form/HasMinlengthTest.php (1)

5-17: Form namespace/import updates look consistent.
Trait/provider paths and helper imports are aligned with the Form namespace.

tests/Provider/Form/MinlengthProvider.php (1)

5-75: Minlength provider enum coverage looks consistent.

BackedInteger/BackedString from php-forge/support are available in require-dev as ^0.3, so the test suite has the stub enums needed for these test cases.

tests/Provider/Form/MinProvider.php (1)

5-99: Dependency verified and code looks good.

The php-forge/support package is present in require-dev (^0.3), correctly supporting the new BackedString and Unit enum-backed test cases used in this provider.

tests/Form/HasAcceptTest.php (1)

5-11: LGTM!

Namespace and import updates are correctly aligned with the Form sub-namespace relocation. The test structure maintains consistency with the provider's data types and the relocated HasAccept trait.

tests/Provider/Form/PatternProvider.php (1)

5-12: LGTM!

Namespace updated correctly to Provider\Form, and the docblock reference properly points to the relocated Form\HasPatternTest. The data provider structure is well-organized with comprehensive test cases for pattern attribute handling.

tests/Form/HasDirnameTest.php (1)

5-11: LGTM!

Namespace and imports are correctly updated to reference the Form sub-namespace. The test structure is consistent with other Form attribute tests in this PR.

tests/Form/HasFormTest.php (1)

5-11: LGTM!

Namespace and imports correctly relocated to the Form sub-namespace. Test structure maintains consistency with the broader Form attribute test suite.

tests/Provider/Form/CheckedProvider.php (1)

5-8: LGTM!

Namespace and docblock reference correctly updated to the Form sub-namespace. The data provider appropriately handles boolean attribute semantics with proper test coverage for true, false, null, replacement, and unset scenarios.

tests/Form/HasMaxTest.php (2)

5-15: LGTM!

Namespace and imports are correctly updated. The addition of Stringable and UnitEnum imports properly supports the expanded type signatures in the test method parameters, aligning with the HasMax trait's method signature.


66-72: LGTM!

The expanded type hints float|int|string|Stringable|UnitEnum|null correctly match both the HasMax::max() method signature and the MaxProvider::values() return type, ensuring comprehensive test coverage for all supported input types.

tests/Provider/Form/AcceptProvider.php (2)

5-12: LGTM!

Namespace and imports are correctly updated. The switch to PHPForge\Support\Stub\BackedString and the docblock reference to Form\HasAcceptTest properly align with the Form namespace relocation.


44-49: LGTM!

The data key rename from 'enum backed' to 'enum backed string' improves clarity and maintains consistency with other providers in this PR (e.g., PatternProvider). The BackedString::VALUE usage is correct.

tests/Provider/Form/DirnameProvider.php (1)

5-12: LGTM!

Namespace and docblock reference correctly updated to align with the Form namespace migration.

tests/Form/HasPatternTest.php (1)

5-11: LGTM!

Namespace and imports correctly updated to reference the Form namespace. The type signatures in test methods properly align with the expanded PatternProvider return types.

tests/Form/HasCheckedTest.php (1)

5-10: LGTM!

Namespace and imports correctly updated to reference the Form namespace. The test structure and type signatures properly align with the CheckedProvider data structure.

tests/Provider/Form/FormProvider.php (1)

5-7: LGTM!

Namespace correctly updated to Form namespace. The new enum test cases (enum backed string and enum unit) follow the established pattern and provide proper coverage for UnitEnum input handling.

Also applies to: 44-57

tests/Provider/Form/MaxProvider.php (1)

5-9: LGTM!

Namespace correctly updated to Form namespace. The expanded PHPStan type annotations and new test cases (enum backed string, enum unit, stringable) provide comprehensive coverage for Stringable and UnitEnum inputs.

Also applies to: 22-25, 44-99

tests/Form/HasMaxlengthTest.php (1)

5-17: LGTM!

Namespace and imports correctly updated to reference the Form namespace with proper UnitEnum support.

tests/Provider/Form/MaxlengthProvider.php (1)

5-9: LGTM!

Namespace correctly updated to Form namespace. The expanded type annotations and new test cases properly cover UnitEnum handling:

  • invalidValues() correctly includes BackedString::VALUE as an invalid case (non-numeric enum value).
  • values() correctly includes BackedInteger::VALUE as a valid case resolving to integer 1.

This aligns with the parallel MinlengthProvider structure.

Also applies to: 22-29, 53-75

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

Comment thread src/Form/HasMinlength.php
Comment thread tests/HasNameTest.php
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