php

  • A value object with no invariant, deleted

    Eight single-property wrappers over a string, none of which validated anything. A value object with no invariant is a type alias that PHP does not have, and the…

  • The two PHP templates that survived, and the rule

    Two templates that cannot become block templates, and the rule that identifies them. Three years and the rule has held for every template that came up, which is…

  • opcache after a year of property hooks

    Two hundred and eighteen methods became properties, and the question of whether the opcode cache noticed. A hook costs about what a method call costs because it is…

  • A functions.php of forty lines

    A file that was eight hundred lines in 2022, and what is left in it. Everything else moved to a plugin, and the test for each was whether…

  • Writing a PHPUnit extension

    turkerdev/phpunit-json-coverage-report, and a coverage report a machine can read. Coverage as a percentage in a log, and no way to ask which paths changed.

  • A readonly class that survived a requirements change

    A value object made readonly in 2022, and the requirement in 2026 that would have broken a mutable one. The property that mattered was not thread safety or…

  • A trait deleted after its second use appeared

    A trait extracted in 2023 for one class, on the grounds that a second would arrive, and the second one arriving and not fitting. A trait extracted in…

  • private(set) doing the work a hook was written for

    Three hooks reverted, and in every case asymmetric visibility was the whole answer. A get hook that returns a backing property unchanged is asymmetric visibility with extra syntax…

  • A path repository that reached staging

    A local path repository committed by accident, and an install on a machine where the path does not exist. A path repository is the right tool for developing…

  • Ten years of a WordPress site, and what is left of the theme

    A theme that was 61 PHP templates in 2023 and is six block templates and a stylesheet. An audit rather than a problem.