Laravel 9.14, weekly updates, and 🔥 tip

Laravel 9.14

Couple new features and fixes in today's release of Laravel 9.14. Here are some highlights:

  • Attach a concise error message to SES exceptions in #42426
  • Fix route parameter not explicity specified in custom binding in in #42425
  • Add dynamic trashed factory state in #42414
  • Add Arr::prependKeysWith() in #42448
  • Support passing Eloquent collections to assertViewHas in #42428
  • Add bootable traits to TestCase in #42394
  • Use route parameters in view in #42461
  • Support passing callback to Eloquent::whereRelation() in #42491

You may review the full branch diff on GitHub for a complete list of changes.

This version bump and update is automated for subscribers to a Shifty Plan. If you don't have one of those, be sure to bump your constraint and run composer update to get the latest features.

Weekly Journal

Last week I had a little more Human Shifts. I ended up helping with deployment and shaking out some of the inevitable bugs during a multi-version upgrade.

As you may have seen in the release highlights, I also opened some PR's for Laravel. These were for long-standing paper cuts which finally annoyed me enough to resolve.

I was reminded of these while TDDing device management for Shift Workbench licenses. This is something we called YAGNI on for the initial release. But with renewals coming up, we need it.

I also had to quickly patch a change within the GitLab API. Apparently their access tokens now expire after 2 hours. I'm still resolving some issues related to this.

This week I hope to continue on some of the Workbench issues as Jess and I work towards releasing v1.0 of the desktop app in late June.

🔥 Tip

While coding I also ran into a bit of a "gotcha" with PHP's null safe operator (?->) - the variable has to be defined.

I, mistakenly, assumed I could use it for both potentially null values as well as undefined variables.

However, the following throws an error due to the variable being undefined.

$tmp = $undefined?->property;

Laravel's optional() helper also throws an error for undefined variables.

Digging a bit deeper, the null coalesce operator (??) does work if you're attempting to access a property. But not if you're invoking a method.

// works for properties
$tmp = $undefined->property ?? null;
 
// throws an error for methods
$tmp = $undefined->method() ?? null;