Skip to content

[11.x] Set HasAttributes@casts() array generics#53024

Merged
taylorotwell merged 1 commit intolaravel:11.xfrom
cosmastech:casts-generic
Oct 3, 2024
Merged

[11.x] Set HasAttributes@casts() array generics#53024
taylorotwell merged 1 commit intolaravel:11.xfrom
cosmastech:casts-generic

Conversation

@cosmastech
Copy link
Copy Markdown
Contributor

@cosmastech cosmastech commented Oct 3, 2024

I keep having to add this type-hint to my models on a project. Figured I would help myself (and others) out.

Copy link
Copy Markdown
Contributor

@Jubeki Jubeki left a comment

Choose a reason for hiding this comment

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

As the array does not only contain strings, but could also contain a custom cast like https://laravel.com/docs/11.x/eloquent-mutators#custom-casts, this would be better in my opinion.

Sorry my bad, it will still be referenced as a class string.

@taylorotwell taylorotwell merged commit 2880c30 into laravel:11.x Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants