PHP Internals News: Episode 73: Enumerations – Derick Rethans

PHP Internals News: Episode 73: Enumerations

In this episode of “PHP Internals News” I talk with Larry Garfield (Twitter, Website, GitHub) about a new RFC that he is proposing together with Ilija Tovilo: Enumerations.

The RSS feed for this podcast is, you can download this episode’s MP3 file, and it’s available on Spotify and iTunes. There is a dedicated website:


Derick Rethans 0:14

Hi I’m Derick and welcome to PHP internals news that podcast dedicated to explain the latest developments in the PHP language.

Derick Rethans 0:22

This is Episode 73. Today I’m talking with Larry Garfield, who you might recognize from hits such as object ergonomics and short functions. Larry has worked together with Ilija Tovilo on an RFC titled enumerations, and I hope that Larry will explain to me what this is all about. Larry, would you please introduce yourself?

Larry Garfield 0:43

Hello World, I’m Larry Garfield, I am director of developer experience at We’re a continuous deployment cloud hosting company. I’ve been in and around PHP for 20, some odd years now. And mostly as an annoying gadfly and pedant.

Derick Rethans 1:00

Well you say that but in the last few years you’ve been working together with other people on several RFCs right, so you’re not really sitting as a fly on the wall any more, you’re being actively participating now, which is why I end up talking to you now which is quite good isn’t it.

Larry Garfield 1:15

I’m not sure if the causal relationship is in that direction.

Derick Rethans 1:18

In any case we are talking about enumerations or enums today. What are enumerations or enums?

Larry Garfield 1:26

Enumerations or enums are a feature of a lot of programming languages, what they look like varies a lot depending on the language, but the basic concept is creating a type that has a fixed finite set of possible values. The classic example is Boolean; a Boolean is a type that has two and only two possible values: true and false. Enumerations are way to let you define your own types like that to say this type has two values, sort ascending or descending. This type has four values, for the four different card suits in a standard card deck, or a user can be in one of four states: pending, approved, cancelled, or active. And so those are the four possible values that this variable type can have. And what that looks like varies widely depending on the language. In a language like C or c++, it’s just a thin layer on top of integer constants, which means they get compiled away to integers at compile time and they don’t actually do all that much, they’re a little bit to help for reading. At the other end of the spectrum, you have languages like rust or Swift, where enumerations are a robust Advanced Data Type, and data construct of their own. That also supports algebraic data types, we’ll get into that a bit more later. And is a core part of how a lot of the system actually works in practice, and a lot of other languages are somewhere in the middle. Our goal with this RFC, is to give PHP more towards the advanced end of enumerations, because there are perfectly good use cases for it so let’s not cheap out on it.

Derick Rethans 3:14

What is the syntax?

Larry Garfield 3:15

Syntax we’re proposing is tied into the fact that enumerations as we’re implementing them, are a layer on top of objects, they are internally objects with some limitations on them

Truncated by Planet PHP, read more at the original (another 25388 bytes)

It all relates – Liip

“But… it all relates!” A reaction so often heard while facilitating (or participating) to group reflexion processes (brainstorming, agile retrospectives, …).

“You ask us to group things … but everything is connected!”

It often comes with a contrived smile (“things are complex, you know!”). Sometimes also with a counterproposal “let us make a single group around the central thing here which is X, since obviously all things relate to X.”

A very human reaction, which if you’re unprepared as facilitator, can take you aback. Keeping the following arguments in your mind can help.

  1. That it all relates does not mean that it all ought to conflate. It makes sense to distinguish the different aspects of a situation or a problem, the different knots of its web of complexity. Some seem to think that seeing the big picture implies refusing to distinguish the whole from its parts. Yet if we can see the links, the relationships, it is because we have identified the parts.

  2. Although a holistic view provides a definite advantage when facing a complex situation, it is good to remind ourselves that action cannot be holistic. You cannot act on the system as a whole. You may only act on precise points of the system.

Two simple arguments to help us facilitate these “everything is connected” moments and realize that in a (group) reflexion process, taking things apart is the first step towards deciding meaningful action.

Photo: Ruvande fjällripa

Svelte TypeScript Tailwind Setup – Liip


For the very impatient among us:

npx degit munxar/svelte-template my-svelte-project
cd my-svelte-project
npm i
npm run dev



In this article I’ll give you some insights how I set up Svelte with TypeScript and style components with Tailwind. There are plenty of articles around, but I found a lot of them overcomplicate things, or don’t fit my requirements.

So here are my goals for the setup:

  • stay as close to the default template as possible, to make updates easy
  • production build should only generate css that is used
  • use typescript wherever possible

What Do I Need?

You’ll need at least some node version with npm on your machine. At time of writing I have node version 15.6.0 and npm version 7.4.0 installed on my machine.

node -v && npm -v

Install the Svelte Default Template

To setup Svelte I open a terminal and use the command from the official Svelte homepage. TypeScript support has been already added to this template, so nothing special here.

npx degit sveltejs/template my-svelte-project
# or download and extract
cd my-svelte-project

Enable TypeScript

# enable typescript support
node scripts/setupTypeScript.js

At this point I try out if the setup works by installing all dependencies and start the development server.

# install npm dependencies
npm i
# run dev server
npm run dev

If everything worked so far, pointing my browser at http://localhost:5000 displays a friendly HELLO WORLD. Let’s stop the development server by hitting ctrl-c in the terminal.

Install Tailwind

Back in the Terminal I add Tailwind as described in their documentation.

npm install -D tailwindcss@latest postcss@latest

After this step I generate a default tailwind.config.js file with

npx tailwindcss init

If you prefer a full Tailwind config use the –full argument:
npm tailwindcss init --full
See the Tailwind documentation for more infos about this topic.

Configure Rollup to use Postcss

The default Svelte template uses Rollup as a bundler. When I run the setupTypeScript.js from the first setup step, I get the famous svelte-preprocess plugin already integrated into the rollup setup. The only thing left is that I add the config for postcss as options to the svelte-preprocess plugin. Here are the changes that I make in rollup.config.js:

// rollup.config.js (partial)
export default { ... plugins: [ svelte({ preprocess: sveltePreprocess({ postcss: { plugins: [require("tailwindcss")], }, }), }), ... ], ...

At this point Rollup should trigger postcss and therefore the Tailwind plugin. To enable it in my application, I still need one important step.

Adding a Tailwind Component to the App

Now it’s time to create a Svelte component that contains the postcss to generate all the classes. I call mine Tailwind.svelte but the name doesn’t really matter.

// src/Tailwind.svelte
<style global lang="postcss"> @tailwind base; @tailwind components; @tailwind utilities;

Some things to note here:

  • The component only has a single style element with no markup.
  • The attribute global tells the svelte-preprocess plugin to not scope the css to this component. Remember by default Svelte scopes every css to the component it was declared, in this case I don’t want this.
  • The lang=”postcss” attribute is telling svelte-preprocess to use postcss for the content. As a goody, some IDE extensions now display the content with the correct syntax highlighting for postcss.

Now use the Tailwind component in src/App.svelte

// src/App.svelte
<script lang="ts"> import Tailwind from "./Tailwind.svelte";
</script> <Tailwind />
<div class="bg-gray-200 px-4 py-2 rounded">Hello Tailwind!</div>

Now my browser displays a Tailwind styled div. Very nice!
Let’s clean up the public/i

Truncated by Planet PHP, read more at the original (another 5726 bytes)

Nimble in decision – Liip

The concept of decision entails a sense of finality. Often decisions feel like a Rodin sculpture: once for all perfectly cut. How terrible and scary is that? No wonder that many refrain from taking (major) decisions.

Can’t we remove this sense of fate and rigidity from decisions and turn decision-making into a lighter thing?

Take smaller decisions

Does that decision feel too big? What could be a smaller decision in the same direction that is safe enough to take? Find it and take it. Breaking up a big decision in a series of small decisions often helps to move forward. “One Fear at a Time”, as John Whitmore writes in Coaching for Performance.

Be it fear or decision, breaking it up in smaller pieces also allows you to adapt the course of action.

Embrace the imperfection of a decision

Make explicit the fact that the decision has been taken based on finite knowledge of a situation and thus corresponds to a local optimum. Finish any decision statement, with : ” … until we know better”.

Shouldn’t we wait then, to take better decisions? Sometimes yes. Gathering more info, giving it more thoughts is always an option. There however always comes the time when Pareto’s Law kicks in, a point beyond which an imperfect decision will show greater ROI than a more perfect one.

Make it a pilot

A great question I make use of to ease my clients in taking virtuous yet still uncertain steps: “Is it safe enough to try?” Often it is. Often, this question eases the “fear of final decision”.

So decide to try, before finally deciding– if you still believe that you will have to decide once for all.

Give it a revision date

Since a decision is made at a certain point in time in a certain context and based on finite knowledge, it seems only fair to review it later down the road, doesn’t it? Fair and definitely smart. Even more in the case of a decision declared as a temporary one, like a pilot.

Define a revision date or install the license and/or duty to revise a decision when the need or new knowledge arises.

This works particularly well for any structural or strategic decision. Imagine how fit your organization would be if every agreement in it was due to be revised! Well, the distributed governance scheme of Holacracy makes it possible for anyone to trigger revision of the governance and Sociocracy 3.0 also advocates regularly reviewing agreements.

To go one step further down the road, I dream of an organizational system where decisions that are not revised get dropped, like an expiry date for anything decided, in order to keep organizational mass as low as possible.

Embrace exceptions to the decision

Just as a local optimum will make sense for most cases around, there will be exceptions. Let them be and shine on the light of the decision. No exception should be hidden, for hiding exceptions calls to rigidify the decision even more.

On the contrary, collecting exceptions to any decision seems to me like a good practice— I yet still have to find a domain where this happens. Every exception enriches the understanding of the decision, sharpens the scope and effects of the decision, and brings material for further revision of it.

That’s all (for now) folks!

This list is not exhaustive, it simply exhausts my current thoughts on the topic. I yet decide here and now to share it with you as such. Definitely safe enough. And the digital medium gives me the license to revise it later down the road 😉

I hope this gives you a few concrete ways to take the next decision with a bit more joy and serenity.

Artwork: Stereophotography of the Grindelwald Glacier

Xdebug Update: December 2020 – Derick Rethans

Xdebug Update: December 2020

Another monthly update where I explain what happened with Xdebug development in this past month. These will be published on the first Tuesday after the 5th of each month.

Patreon and GitHub supporters will get it earlier, on the first of each month.

You can become a patron or support me through GitHub Sponsors. I am currently 82% towards my $1,000 per month goal. If you’re already supporting Xdebug’s development, could you do me a favour and tweet this out?

Using @xdebug? Help its developer @derickr to get to 100% on his GitHub sponsors goal: #Xdebug3

If you are leading a team or company, then it is also possible to support Xdebug through a subscription.

In December, I worked on Xdebug for about 46 hours, with funding being around 30 hours. I worked mostly on the following things:


A few bugs were found in Xdebug 3.0.0, which should not come as a surprise, as with any big .0 release, users always find things that go wrong. December saw the 3.0.1 release, and the 3.0.2 released followed in the new year.

Xdebug 3.0.1 fixed several crashes and other bugs that are present in Xdebug 3.0.0. The crash when removing a breakpoint (or run-to-cursor) was the most notable fix in this release.

You’ll have to wait for the January 2021 wrap up to find out about the 3.0.2 release, or you can have a look at the release announcement.

There are also new release of PhpStorm and the VS Code Plugin to address a few Xdebug related issues from their sides. On top of that, the GitHub repository of the VS Code Plugin has been moved to the Xdebug organisation. There is a back log of pull requests and issues that need looking at.


I have started making videos to introduce Xdebug 3 and how to use it. The first one on Xdebug 3’s modes can be watched on YouTube.

I am currently working on a video to explain all the new features in Xdebug that help you find problems with running Xdebug itself.

Xdebug Cloud

I have been continuing to test Xdebug Cloud, and I am working with a few private alpha testers. They’re putting the hosted Cloud service through its paces.

At the same time I am working with a designer to make the look pretty too.

If you want to be kept up to date with Xdebug Cloud, please sign up to the mailinglist, which I will use to send out an update not more than once a month.

Truncated by Planet PHP, read more at the original (another 629 bytes)

Object properties, part 2: Examples –

Object properties, part 2: Examples

In my last post, I went over some of the pros and cons of various proposals for making PHP objects more immutable-ish, and the contexts in which they would be useful. I also posted the link to the PHP Internals list, where it generated some interesting if meandering discussion (as is par for the course on Internals).

One of the requests was for sample code to demonstrate why I felt particular feature proposals were better than others. Fair enough! This post is in response to that request, and I think it will help illuminate the challenges better.

For this exercise, I chose to experiment with a junior version of the PSR-7 request object as a concrete example. The code below is not exactly PSR-7; it’s a representative sample of portions of a naive, slightly reduced scope version of PSR-7 requests only, and using all PHP 8.0 features available. The goal is not a complete working object, but sufficient real-world representative examples of situations that an immutability plan would need to address.

Continue reading this post on PeakD.

9 January 2021 – 6:33pm

Free ticket to The Online PHP Conference! – Rob Allen

I’m very happy to be speaking at The Online PHP Conference this year. As you can guess from the title, this is an online event so is easily accessible right from your desk.

Sebastian, Arne, and Stefan are acknowledged experts in PHP development and so an opportunity to hear their thoughts is always welcome. In this case, they have also invited a number of us to share our thoughts as well, expanding on the topics covered. It should be a good event and I encourage to buy a ticket and attend.

One area where I’ve found in-person events have the edge on virtual ones is the so-called hallway track where speakers and attendees can interact in ad-hoc conversations. I’ve always had really good conversations where I can ask and answer interesting questions and we learn things in a more informal setting. So, I was excited to discover that thePHPCC have thought about this.

From A Happy New Year 2021:

In addition to presenting much more (and more diverse) content than last time, we have made our already famous Hallway Track even better, allowing for more informal exchange between attendees and speakers. This is definitely something to look forward to. After our first edition of The Online PHP Conference, many attendees said that taking part in the Hallway Track almost felt like attending a conference in person.

I’m intrigued!

Free tickets! have very kindly made available a couple of tickets to me that I can give to you! All you need to do is email me with your first name and last name. On Monday 11th January, I’ll pick the winners at random. I’ll delete your email afterwards and of course I’ll only email you if you win.

If you don’t win, get your company to buy a ticket anyway!