Skip to content
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

Fix merging casts with dates for PHP 8.0 #43308

Closed
wants to merge 1 commit into from

Conversation

sebdesign
Copy link
Contributor

When running php artisan model:show in PHP 8.0, the following error is thrown:

Cannot unpack Traversable with string keys

  at vendor/laravel/framework/src/Illuminate/Foundation/Console/ShowModelCommand.php:349
    345▕      */
    346▕     protected function getCastsWithDates($model)
    347▕     {
    348▕         return collect([
  ➜ 349▕             ...collect($model->getDates())->flip()->map(fn () => 'datetime'),
    350▕             ...$model->getCasts(),
    351▕         ]);
    352▕     }
    353▕

That is because array unpacking with string keys was implemented in PHP 8.1.
A simple merge will fix this BC break.

@nunomaduro
Copy link
Member

There is already a pull request that addresses this issue: #43301.

@nunomaduro nunomaduro closed this Jul 20, 2022
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.

2 participants