Uncategorized

  • Return types make a refactor fail at the boundary

    A docblock @return is a comment; the engine never reads it, so a method that starts returning null on a Tuesday fails somewhere else on a Thursday. A…

  • A smoke test is not an integration test

    Both hit a running system, so they get put in the same suite and run at the same time. They answer different questions and should fail at different…

  • PHP 7 halved the memory, which changes the pool size

    The upgrade is usually measured in request latency. The larger operational change is memory: PHP 7 rewrote the internal value representation, and arrays in particular use a fraction…

  • intdiv() says what the floor division meant

    Integer division in PHP has always been (int) ($a / $b) or floor($a / $b), both of which route through a float — so past 253 the answer…

  • Object spread is a proposal, not ES2015

    Array spread is ES2015 and object spread is not — it is a stage 3 proposal, available only through Babel, and the syntactic similarity makes it very easy…

  • A bounded context is a vocabulary boundary

    The word usually gets explained in terms of services and databases, which puts the mechanism before the reason. A bounded context is the region within which a word…

  • WooCommerce 2.6 shipping zones replaced the flat table

    Shipping used to be a global list of methods each carrying its own availability rules, which meant every method had to know about every country. 2.6 inverted it:…

  • SplObjectStorage is the object set PHP does not advertise

    Objects cannot be array keys, so checking whether an object is already in a collection usually turns into in_array($obj, $list, true) — a linear scan that gets slower…

  • Testing time-dependent code means injecting the clock

    Code that calls time() or new DateTime() internally cannot be tested at a chosen moment. The usual workarounds are a sleep() in the test, which makes the suite…

  • monit should restart processes, not paper over crashes

    Pointing monit at a process that keeps dying makes the symptom disappear, and that is precisely the risk: the service comes back within thirty seconds, the graph looks…