Archive
PHP
Language releases, migrations, and the bills that come with them.
-
The pipe operator, five months in
PHP 8.5 shipped the pipe operator in November. After five months of using it on real import code, here is the chain it improved, the two steps it made worse, and the rule I settled on.
-
Property hooks, and the three places they earn their keep
PHP 8.4 shipped in November. Three weeks of converting getter and setter pairs to property hooks got me to nine, and Doctrine ORM throws if you put one on an entity. Notes on where the feature actually pays.
-
json_validate and typed class constants, four months in
Measured numbers from validating a 24.7 MiB partner payload with json_validate instead of decoding and discarding it, the one case where it saves nothing, and what typed class constants caught in our code.
-
Readonly classes, and the DTOs we rewrote twice
PHP 8.2 turned nine readonly properties into one readonly class, which is less typing and one broken method. Notes on the clone that cannot work, and on 1,240 dynamic property deprecations.
-
Enums replaced forty class constants
PHP 8.1 shipped on 25 November. A status class holding 41 constants, a static validator and a switch with a throwing default became one backed enum, and Doctrine still needed thirty lines of custom type to store it.
-
PHP 8, three months in: the JIT was the least of it
We moved twelve app servers from PHP 7.4 to 8.0 in January. The JIT did nothing measurable and is switched off. The comparison semantics and internal TypeErrors are what actually cost us a night.
-
Typed properties, six weeks in
Six weeks on PHP 7.4 across twelve boxes. Typed properties shortened our classes and introduced a silent failure mode in the serializer, preloading gave back six milliseconds, and the deprecation sweep found two real bugs.
-
JSON_THROW_ON_ERROR earned its keep
A truncated partner payload decoded to null for nineteen days and nobody noticed, because json_decode reports failure with the same value it returns on success. One PHP 7.3 flag fixed that.