whateverthing.com

October 10, 2020

Many years ago, I wrote a joke library called Kaboom. Its purpose was to detect if error reporting was improperly configured in Development environments, and if so, go Kaboom! by throwing an exception.

Yesterday, I was writing some code for Sculpin (an open source static site generator that I contribute to) and I wanted to make sure that a particular bit of code that could contain path traversal vulnerabilities wouldn't be forgotten about when I wandered away to other priorities.

To accomplish that, I added a unix timestamp check of "today plus one day" hard-coded as magic numbers. That way, when I came back to the PR, it would stop working in a very obvious way, letting me know that the issue had not been solved.

Then, I tweeted about it. And some people were intrigued by it. They had concerns, of course, but the response inspired me to rewrite my Kaboom project and release it to Packagist.

Introducing Kaboom v1.0

May 16, 2020

PHP has had type hints and type declarations for several versions, but they haven't really been available in all contexts. Class-based type hints on method parameters arrived in PHP 5.x, and PHP 7.0 added Scalar type declarations. You can set a type on a method parameter, or specify a return type, but in PHP 7.4 we got something really fun: Now you can declare a type on a class property.

May 3, 2020

Arrow Functions are a new syntax for short anonymous functions introduced in PHP 7.4.

Anonymous functions, if you're not familiar with them, are special functions written inside other sections of your code that you can pass around kind of like variables.

Usually these functions are very short and purpose-built. They're not supposed to contain a huge amount of logic.

Where arrow functions stand out is that they allow you to write concise single-operation anonymous functions like you might use when doing sorting or map/reduce operations.