Skip to content

fix: cast TextInput state to an integer when using integer() - #20365

Open
lazerg wants to merge 1 commit into
filamentphp:4.xfrom
lazerg:fix/issue-20364-integer-state-cast
Open

fix: cast TextInput state to an integer when using integer()#20365
lazerg wants to merge 1 commit into
filamentphp:4.xfrom
lazerg:fix/issue-20364-integer-state-cast

Conversation

@lazerg

@lazerg lazerg commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #20364

TextInput::make('quantity')->integer() used the same state cast as numeric(), which runs floatval(). So getState() gave back 1234.0 instead of 1234. Saving to a model hid this, since the model cast corrected the type, but data read straight out of a schema (an action's $data, for example) kept the float.

integer() now tells NumberStateCast to use intval() instead.

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@danharrin danharrin added bug Something isn't working pending review labels Aug 14, 2026
@danharrin danharrin added this to the v4 milestone Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextInputs with ->integer() return values as numeric

2 participants