refactoring

  • Laravel 5.5 and the packages that install themselves

    The first release where installing a package is one command. Auto-discovery removes two config edits per package, and hides the fact that they happened.

  • Parameter type widening in 7.2

    A child class could never remove a parameter type from a method it overrides, even though accepting more than the parent is safe by the same rule that…

  • Blade components before they were components

    @include passes variables and shares the parent scope, which means a partial silently depends on whatever happened to be defined where it was included. @component takes a slot…

  • Read a JSON config file with a fallback in PHP

  • The each() deprecation is a whole class of loop

    each() is deprecated in 7.2 and the notice appears once per call, which on a loop means once per iteration and a log file measured in megabytes. The…

  • iterable accepts an array or a Traversable

    Type-hinting array rejects a generator, and hinting Traversable rejects an array — so a function meant to consume a sequence either had no hint or forced the caller…

  • Closure::fromCallable turns a string into a closure

    PHP has several callable syntaxes — a string, an array of object and method, an invokable — and functions accepting callable have to tolerate all of them. Converting…

  • WooCommerce 3.0 turned products into objects

    Every plugin reading _price from post meta is now reading a private field. The mechanical half, the half that is not, and the compatibility layer for code you…

  • Object.entries and Object.values, finally

    Iterating an object has meant Object.keys() and an index lookup, which names the key twice and reads badly next to the array methods it sits beside. Both return…

  • CSS Grid arrived, and the layout hacks can go

    Chrome 57 and Firefox 52 shipped it a fortnight apart in March. Replacing a grid system of nested rows, negative margins and a clearfix with fourteen lines.