Uncategorized

  • A macro is how you extend a framework class without extending it

    Adding a method to a collection or a response means subclassing, and subclassing a framework class means every place that constructs one has to know about your subclass.…

  • Cache keys need a version, or you cannot ship a change

    Changing the shape of a cached value means every cached entry is now wrong, and there is no way to clear them selectively without knowing every key that…

  • The Responsable interface removes a controller branch

    A controller returning either a view or JSON depending on the request ends up with the same conditional in every action, and the decision has nothing to do…

  • WooCommerce 3.0 deprecated direct property access

    Reading $product->id or $order->billing_email has worked since the plugin existed, because they were public properties on an object wrapping a post. 3.0 makes them private with a magic…

  • try/catch around await catches a rejection

    A rejected promise inside an async function behaves like a thrown exception, which means error handling stops being a .catch() bolted onto the end of a chain and…

  • The service container resolves callables too

    The container is usually described in terms of constructor injection, so a method needing one dependency for one call ends up either taking it in the constructor or…

  • The REST API cannot be disabled, only restricted

    Plugins offering to “disable the REST API” hook rest_authentication_errors and return an error for unauthenticated requests, which is a restriction rather than a removal — the routes still…

  • The 5.5 exception that renders itself

    Custom exceptions have always had to be translated into a response somewhere in the handler, which turns one file into a growing chain of instanceof checks. 5.5 lets…

  • A circuit breaker before the third-party outage

    A payment provider was slow and the whole site went down with it. A timeout bounds one request; it does nothing about how many are waiting at once.

  • @supports is how grid ships this year

    Grid is in Chrome, Firefox, Safari and Edge and is not in IE11 in any form anyone should target — the 2011 prefixed implementation is a different specification.…