-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[11.x] Add Illuminate\Support\enum_value
to resolve BackedEnum
or UnitEnum
to scalar
#53096
Conversation
`UnitEnum` to scalar. Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Illuminate\Support\mutate
to resolve BackedEnum
or UnitEnum
to scalar.Illuminate\Support\mutate
to resolve Arrayable
, BackedEnum
or UnitEnum
to scalar
Illuminate\Support\mutate
to resolve Arrayable
, BackedEnum
or UnitEnum
to scalarIlluminate\Support\mutate
to resolve JsonSerializable
, Stringable
, BackedEnum
or UnitEnum
to scalar
Not a fan of the name, maybe Suggestion comes from my old Java days: https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html |
Even something super explicit like "enum_value" would be fine with me since this will mainly be used internally and not really be user facing. |
What about |
Illuminate\Support\mutate
to resolve JsonSerializable
, Stringable
, BackedEnum
or UnitEnum
to scalarIlluminate\Support\enum_value
to resolve BackedEnum
or UnitEnum
to scalar
… `UnitEnum` to scalar (laravel#53096) * [11.x] Add `Illuminate\Support\mutate` to resolve `BackedEnum` or `UnitEnum` to scalar. Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * Apply fixes from StyleCI * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * Apply fixes from StyleCI * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * Apply fixes from StyleCI * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip * Apply fixes from StyleCI * rename to scalar value * rename again --------- Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> Co-authored-by: StyleCI Bot <bot@styleci.io> Co-authored-by: Taylor Otwell <taylor@laravel.com>
Just updated to Laravel 11.28. After running some tests in my application I noticed that this PR introduces an issue where empty arrays use Illuminate\Testing\Fluent\AssertableJson;
->assertJson(fn (AssertableJson $json) => $json->whereType('id', 'string')
->where('object', 'menu')
->where('name', 'Primary')
->where('handle', 'primary')
->has('items', 2)
->has('items.0', fn (AssertableJson $json) => $json->whereType('id', 'string')
->where('object', 'menu_item')
->where('label', 'Home')
->where('url', '/')
->where('active', true)
->where('opens_new_tab', false)
->where('items', []) // Issue occurs here
->where('order', 0)
->etc()
)
->has('items.1.items.0', fn (AssertableJson $json) => $json->whereType('id', 'string')
->where('object', 'menu_item')
->where('label', 'Payments')
->where('url', '/payments')
->where('active', true)
->where('opens_new_tab', false)
->where('items', []) // Issue occurs here
->where('order', 0)
->etc()
)
->etc()
); This check will return the following error:
|
Any reason why it won't be added as a general helper? I find this really clever and useful to implement similar functionality in projects (similar to |
We want to limit it's usecase only to what's needed for the Framework. |
Couldn't the same could be said about any helper? Seems odd that this one is isolated as internal. It's a good function, let it have its moment 😆 . Thanks anyway... |
Not exactly, as internal function we can create breaking change at any time and it's fine as long as it met Framework requirements. We also wouldn't need to consider any additional use-case by community other than use-case required by the Framework. |
That's fair. Given its simplicity, hopefully one day you'll reconsider 👍 For now it's copy + paste for me! Thanks again @crynobone |
No description provided.