Tag Archives: PHP

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

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

Filtering and Mapping with SPL Iterators

Four or five years ago, the most popular talk that I gave at conferences was entitled “A Functional Guide to Cat Herding with PHP Generators” (the cats proved a very enjoyable talking point at every event where I gave it, … Continue reading

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

Parallel Looping in PHP with SPL’s MultipleIterator

There was a time, back when I was working with PHP 5, when I found the Standard PHP Library (SPL) an extremely powerful and useful toolbox; and I particularly enjoyed working with SPL’s Iterators and Datastructures. Sadly, SPL was always … Continue reading

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

Withdrawal from Speaking at PHPCE 2019

I’m always nervous when I speak at a conference or in front of a user group; but I also enjoy sharing my passion and excitement for things that I’ve learned, or new tools that I’ve discovered. That makes it particularly … Continue reading

Posted in PHP | Tagged , , , , | 27 Comments

Using PHP Anonymous Classes as Package Private Classes

I’ve written before about the benefits of using PHP’s Anonymous Classes for test doubles; but Anonymous Classes also have potential usecases within production code as well. In this article I’m going to describe one such usecase that can be particularly … Continue reading

Posted in PHP | Tagged , , , , | 6 Comments

Discharging Static #2

In the first article in this series, I wrote about the problems with testing static methods in classes, and showed a few approaches that allow us to write mocks for statics. Testing classes where we have static properties is a … Continue reading

Posted in PHP | Tagged , , | 7 Comments

Aspects of Love — How deep does the rabbit hole go?

If you’ve read my previous post (Discharging Static #1), then you’ll know that recently I’ve been exploring different approaches to creating test doubles for statically called methods, and other testing problems, and had begun to look at Michael Bodnarchuk’s AspectMock library … Continue reading

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

Discharging Static #1

It’s been seven years since Kore Nordmann first published “static considered harmful” on his blog, explaining the problems with using static method calls in classes, and the difficulties that they cause when trying to test that class. Seven years on, … Continue reading

Posted in PHP | Tagged , , | 5 Comments