Laravel 10.6, weekly updates, and 🔥 tip
Laravel 10.6
This week brings us to Laravel 10.6.0. Here are the highlights:
- Add
caseSensitive
flag to Stringablereplace
in #46578 - Add
selectResultsets
to database Connection in #46592 - Support contextual binding on first class callables in de8d515f
- Ability to set a custom class for the
AsCollection
andAsEncryptedCollection
casts in #46619
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
I hijacked last week's live stream to kick off a project I've wanted to build for a while. It was an April Fools' Shift. It's effectively the Laravel Fixer, but the tone of the Shift bot is more sarcastic. Something to give you that kick-in-the-butt to follow Laravel conventions.
Again this aimed at being fun. So I've made it free for everyone to try and see if their project is zonda or nonda. I'll make it available for the rest of the week, or potentially, the whole month of April.
I also spent time going through recent feedback emails. Lots of boundary cases and comment tweaks to improve the experience. In the process, I updated the Laravel 10.x Shift, Tailwind Converter, PHPUnit 10 Shift, Pest Converter, and Vite Converter.
The most notable change was adding support for PHPStan types. Technically, these are outside the standard DocBlock types. However, with the growing popularity of these tools, more projects may use these types. So the Laravel 10.x Shift and Workbench task now properly add the underlying PHP type hints for DocBlock types such as positive-int
, non-empty-list<Type>
, class-string
, etc.
I also got a lot of feedback around the adoption of type hints. I knew from the beginning this would be the biggest change in the Laravel 10.x Shift. That's one of the reasons Shift makes atomic commits. But what I learned from feedback is it's not the addition of the types for Laravel, but the addition of the types from existing DocBlocks.
So to emphasize the difference I have returned to separating these two commits. This hopefully makes it a little more clear where the types are added from, and as such, demonstrates that it's not Shift, but the common situation where a comment is wrong.
🔥 Tip
Here's another PHP flag to the rescue. Want to append contents to a file? You can still use file_put_contents
. Just pass it the FILE_APPEND
flag. 🔥
file_put_contents('shift.log', $contents, FILE_APPEND);