Author Archives: Mark Baker

ReadOnly Gotchas – A few more limitations with PHP 8.1 ReadOnly Properties

Last month I wrote about the new readonly properties in PHP 8.1, and the difficulties if you want to clone an object that uses them (together with a couple of potential solutions to that problem). The inability to clone an … Continue reading

Posted in PHP | Tagged , , | 2 Comments

Constant Constants. Finally! (On the inconstancy of constants)

One of the many new features of PHP 8.1 is the ability to declare class constants as final, so that they can no longer be overridden in child classes. The same applies when constants are defined as final in an … Continue reading

Posted in PHP | Tagged , , , , | 1 Comment

The Tears of a Clone

On the face of it, the new readonly properties in PHP 8.1 seem really useful for Value Objects and Data Transfer Objects: both should be immutable; setting property values should always be handled in the constructor, so no setters; and … Continue reading

Posted in PHP | Tagged , , , | 2 Comments

Closure Binding for Unit testing of Private and Protected Methods

Some years ago, I wrote about using closure binding to access protected and private properties when unit testing an object, to verify internal state; and I created the SpyMaster library to simplify that task. One feature that I didn’t include … Continue reading

Posted in PHP | Tagged , , , , | Leave a comment

Spreading the News – An Exploration of PHP’s Spread Operator

A few days ago, I wrote about array unpacking and variadic arguments in PHP8. I’m a big fan of these features, and use them extensively, and the changes in PHP8 make them even more useful.

Posted in PHP | Tagged , , , | 1 Comment

Named Arguments and Variadics in PHP 8

One of the new features of PHP 8 is named arguments. It’s one of those features that I love as an end user developer; although it can be a nightmare for library and framework developers, because argument names are now … Continue reading

Posted in PHP | Tagged , , , , | 2 Comments

Loving you wasn’t easy.

Loving you wasn’t easy.

Posted in Personal | Tagged | Leave a comment

Confronting our Demons

Confronting our own inner demons is the hardest battle we ever have to face, especially when they’re so deep-rooted after so many years: filling in the holes that each leaves behind with hope, because that’s all that I have at … Continue reading

Posted in Personal | Tagged | Leave a comment

A Reverse-Retrospective: Places that I’m looking forward to visiting in 2021

With all the closures and travel restrictions in place during last year, there are so many places that I wanted to visit, but wasn’t able to. So rather than a look back at last year (with so much trauma and negativity), I’m going to look forward (and positively) to where I’ll be able to go this year as lockdown eases, and travel becomes possible again. There are so many places in Europe and across the world that I want to go, but I’m going to limit myself to the Netherlands at the moment, places just a few hours drive or train journey from where I live. Continue reading

Posted in Uncategorized | Tagged , | 1 Comment

Under the Radar? A Backwards-Compatible Break for SPLFixedArray in PHP 8

The official release date for PHP 8 is 26th November, just 9 days away, so we’re almost into the last week; and I’ve just discovered a change to SPLFixedArray that I wasn’t previously aware about. While not many developers use … Continue reading

Posted in PHP | Tagged , , , , , | Leave a comment