PHIVE: The Phar Installation and Verification Environment
In this post, I would like to give a quick summary of the PHIVE tool, what it allows to do, and invite you all to trial and discuss this. Maybe it will be useful for you to adopt. Manage Local PHP Tooling The idea behind PHIVE is to provide an optimized and streamlined way for […]
WP-CLI Command to Manage Orphan Data and Metadata
Last week, when I was in between projects, I decided to take one day and draft up a WP-CLI command that allows for listing and deleting orphan WordPress entities, as well as metadata. I had the idea for this quite a while ago, and I tried to get it into WP-CLI. That failed, however, as […]
Quickly Display All Diffs in a GitHub PR
So, you have to review a pull request with quite a few files? And several of them are quite large? Or there are several deleted files that you want to review? There are reasons why GitHub does not load a diff, for example, because it’s too large, or because it’s for a file that has […]
What Version of Gutenberg Is in WordPress XYZ?
The WordPress Block Editor, which is a part of Core WordPress, is being built in the form of the Gutenberg (plugin) project, which again is split into various npm packages. Oftentimes, one would like to know “What version of Gutenberg is in a given version of WordPress?”. However, most of the time, the answer is […]
How to (Force) Update Your composer.lock
When using Composer, you might know that you should almost always include the composer.lock file in VCS. Now, the lock file includes a hash, which is generated from the contents of the composer.json file, and more. Therefore, changing something in this file, for example, the description, or something in the extra or config sections, will […]
Proper File Checking in PHP
TL;DR: if you want to read a file, use is_readable, not file_exists. Over the last year or so, I think I reviewed about a dozen PRs—both Human Made and external—with something like this PHP code snippet: While this code works like 99% of the time, it’s not really doing what people thought it did. What […]
Making the Best of PHPUnit Data Providers
When writing unit or integration tests for PHP, occasionally you need to test a specific scenario multiple times, with different input data. To make this easy and less repetitive, PHPUnit provides what is called Data Providers. A data provider is a method in some test case file, providing several sets of input data for one […]
Mapping Data and Behavior
Oftentimes, when writing software, we need to realize processes like this: “If A, then do B, otherwise do C.”, or that: “If A, then set X to B, otherwise set X to C.”. And there are also the more complex ones: “If A is equal to B, do X. If A is equal to C, […]
How WordPress 5.3 Might Break Your Editor Screen
This post comes in three parts. In the first, I present the problem I was facing when upgrading a site that was running on WordPress 5.2.x and no Gutenberg plugin. The second part is about the solution I found, which I think is no more than a workaround fix, actually. In the third part, I […]
Switching Between Branches with Different node_modules Folders
Every once in a while, I find myself in the situation of needing to change quite a few JavaScript dependencies. And oftentimes, this means that I would need to switch between two branches with rather different node_modules folders—which is a hassle. You too? Well, in this post, I will share how to do just that. […]