Laravel 8.12, weekly updates, and 🔥 tip

Laravel 8.12

Slight delay this week as the Laravel team wanted to finishing their support for PHP 8, which will be released November 26. We also got some new goodies in this week's release. So we get a minor version bump to 8.12.0.

  • Add lazy method to Eloquent factory in #34923
  • Ability to make:cast with custom stub file in #34930
  • Add encrypted string Eloquent cast in #34937
  • Add additional types for casting encrypted strings to objects in #34948
  • Add explain() to Query Builder in #34969
  • Make multiple_of validation rule handle non-integers in #34971
  • Allow passing an array to assertSee test methods in #34982
  • Add withColumn to support SQL aggregation in #34965
  • Full PHP 8.0 Support in #33388

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

This minor 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 finished up the Human Shifts. I upgraded multiple Laravel 5.x applications all the way to Laravel 8.x. Another thing I like about these is seeing the excitement from the developer or team once their application is on the latest version.

I also made some small tweaks the Shift site itself. Mostly deploying work Jess has done. But also some minor server maintenance like bumping to Composer 2 and tiny content tweaks based on user feedback.

I had a little free time last week, so I did a few live streams to add the encrypted casts highlighted in this release. I was pretty happy these were merged as it was something I was doing for multiple projects. It's also something that had been tried numerous times before. So glad it got in there.

There was one more PR I opened for adding the expects method to Facades. However, it was indeed a breaking change, so we'll have to wait until Laravel 9.

Finally, we added the ability for subscribers to set custom wehbooks for their Shifty Plans. These can be built using the Shift Workbench. You can create builds to review, style, refactor, and modernize code. And I'm adding more tasks to the Workbench all the time. Honestly, this is a service onto itself.

To that point, this week I'm adding 3 new tasks to the Workbench for converting the deprecated $date property, streamlining orderBy clauses, and refactoring to short closures.

In addition, I'll be making a few tweaks to the recent Shifts based on user feedback. I'm keeping the tasks small as we're at week 39 for baby Izzy, so her and mommy will be getting all my attention for a few days.

🔥 Tip

To the point of my additional PR earlier, without a count modifier (e.g. once, twice, never), the shouldReceive expectation is likely giving you some false confidence.

For example, the following test case passes:

1$mock = \Mockery::mock();
2$mock->shouldReceive('foo')
3 ->with('bar')
4 ->andReturn('baz');
5 
6$this->assertTrue(true);

However, we obviously never called foo with bar. Remember, just because something should receive a call, doesn't mean it did receive the call.

Using expects not only avoid the footgun above, but is a more expressive shorthand for shouldReceive()->once().