saylornotes

The Blog of Chris Saylor

Search Results

    Interop in PHP Should Not Be Exceptional

    December 22, 2020 engineering Chris Saylor
    In many ways, PHP has come a long way to becoming a competent, typed language. With the newly minted PHP 8, strong types have eliminated a whole host of problems when dealing with class and function parameter input. However, it isn’t all just a bed of roses. Thrown exceptions (or Throwables these days) are notoriously absent from any sort of concrete specification within interfaces, classes, and functions. This is particularly troubling if one of our goals is for interchangeable implementations for a business process. Continue reading

    Why Use Generators in PHP

    January 2, 2017 engineering
    I’ve heard many co-workers, friends, and colleagues at meetups acknowledge the existence of generators in PHP, but not understand why they would use them or give them much thought when planning out implementations. In this article, I’m going to explain with concrete examples of when it is a good idea to use a generator. In case you don’t know what a generator is, you can check PHP’s documentation on the subject for a good synopsis. Continue reading
    PHP

    Enforce code standards with composer, git hooks, and phpcs

    April 14, 2014 engineering
    Maintaining code quality on projects where there are many developers contributing is a tough assignment. How many times have you tried to contribute to an open-source project only to find the maintainer rejecting your pull request on the grounds of some invisible coding standard? How many times as a maintainer of an open-source project (or internal) have you had a hard time reading code because there were careless tabs/spaces mixed, if statements with no brackets, and other such things. Continue reading