Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.

15 St Margarets, NY 10033
(+381) 11 123 4567



Laravel 8.22 Released – Laravel News

The Laravel team released 8.22 yesterday with a new event fake assertion, a collection method to reduce associative arrays to a single value, and the latest changes in the 8.x branch:

Assert Nothing Dispatched

@danilopolani contributed event assertion assertNothingDispatched to the fake event instance:


// Function that should NOT dispatch any event

Reduce with Keys Collection Method

Mo Khosh contributed a reduceWithKeys method to collections (and lazy collections) to reduce an associative collection to a single value.

Similar to map and mapWithKeys, this augments reduce to pass associative arrays’ keys to its callback. We can’t do that currently because PHP’s array_reduce doesn’t pass array keys to its callback.

Here’s an example from the pull request:

$data = collect([
    'name' => 'Mo Khosh',
    'username' => 'mokhosh',

return $data->reduceWithKeys(function($carry, $value, $key) {
    return $carry . $key . ': ' . $value . PHP_EOL;

Release Notes

You can see the full list of new features and updates below and the diff between 8.21.0 and 8.22.0 on GitHub. The following release notes are directly from the changelog:



  • Added new lines to DetectsLostConnections (#35752, #35790)
  • Added FakesEventFake::assertNothingDispatched() (#35835)
  • Added reduce with keys to collections and lazy collections (#35839)


  • Fixed error from missing null check on PHP 8 in ValidationConcernsValidatesAttributes::validateJson() (#35797)
  • Fix bug with RetryCommand (4415b94, #35828)
  • Fixed IlluminateTestingPendingCommand::expectsTable() (#35820)
  • Fixed morphTo() attempting to map an empty string morph type to an instance (#35824)


  • Update IlluminateHttpResourcesCollectsResources::collects() (1fa20dd)
  • “null” constraint prevents aliasing SQLite ROWID (#35792)
  • Allow strings to be passed to the report function (#35803)

Filed in:

Credit: Source link

Previous Next
Test Caption
Test Description goes like this