refactoring

  • Laravel 5.6 and logging you can configure

    Logging moved into a config file, and stacks are why it matters — a different format per destination, decided without touching a service provider.

  • Coverage on a legacy codebase is a direction, not a number

    Setting a minimum coverage threshold on a codebase at eleven percent produces either a permanently red build or a threshold set to eleven percent, and neither changes anything.…

  • Symfony 4 and the bundle that does not exist

    A new project used to arrive with forty megabytes of vendor code and one route. The framework got smaller, and the interesting part is what happens at install…

  • Bootstrap 4 dropped the float grid

    Two and a half years in alpha, and the grid is flexbox now. The class renames are mechanical; the ones that changed meaning rather than name are not.

  • String padStart for formatting without a library

    Zero-padding a number has been a slice of a string of zeros concatenated with the value, which is short enough to write inline and long enough to get…

  • Ubiquitous language is a naming rule with teeth

    The idea is usually explained as “use the same words as the business”, which sounds like a style preference. The version with consequences is that a word meaning…

  • Format bytes as a human readable size in PHP

  • list() with keys unpacks an associative row

    Destructuring only worked positionally, so a row fetched as an associative array had to be unpacked by hand — three assignments and a typo waiting to happen. A…

  • ignoreErrors is how you adopt this on old code

    Four thousand errors on the first run is a number nobody can act on, and the usual outcome is that the tool is removed. Ignoring the existing ones…

  • Signed numeric strings compare differently now

    PHP 7.1 changed how a string with a leading sign is treated in a numeric context, which is a correctness fix and a behaviour change in code that…