Everything on immutability.
3 articles tagged immutability, sorted newest first.
Switch Laravel to Immutable Dates with CarbonImmutable
Carbon extends DateTime, so every modifier rewrites the object you called it on. Here is how to move a Laravel app onto CarbonImmutable end to end.
PHP 8.5 #[\NoDiscard]: Stop Silently Ignoring Return Values That Matter
PHP 8.5 ships a new #[\NoDiscard] attribute that warns when you forget to use a function's return value. Here is how to apply it to your own immutable builders — and why (void) is the only safe way to suppress it.
PHP 8.5 clone with: Updating Readonly Objects Without Boilerplate
PHP 8.5 lets you pass an array to clone() to update properties in one expression. Here's how it replaces wither method boilerplate: and the gotchas you need to know first.