The year 2023 comes to an end and I want to have a look back at my open source contributions.

To be honest: The main motivation for this post is getting awareness for all the open source work happening in my free time. I am spending 20-40 hours per month and would love 💕 to even reduce hours on my primary job to support the open source community even more.

This will only be possible when more people support my open source work by becoming a sponsor.

Intro

At first, lets have a look back at 2022: I was able create 967 pull requests, of which 831 got merged. In comparison, at the time of writing I created ~900 pull requests to 70 open-source repositories in 2023, of which 753 got merged.

As you can see the numbers in 2022, are a bit lower than in 2023. I think this is due to the fact that last year the focus was on working through low-hanging fruits in PHPStan and Rector. With the experience and knowledge gained while working on these projects, I was able to contribute more advanced features and fixes this year.

The following table shows the distribution of contributions across the different projects I am working on.

project merged pull requests addressed issues
phpstan/phpstan* ~116 (~188 in 2022) 33 (83 in 2022)
rector/rector* ~178 13
FriendsOfREDAXO/rexstan 88 24
FriendsOfREDAXO/rexfactor 55 6
staabm/phpstandba 44 (~300 in 2022) 8
staabm/phpstan-todo-by 33 (~300 in 2022) 7
redaxo/redaxo 27 (70 in 2022) 5
TomasVotruba/unused-public 28 1
staabm/phpstan-baseline-analysis 22  
OskarStark/doctor-rst 12 -
easy-coding-standard/easy-coding-standard 9 1
staabm/annotate-pull-request-from-checkstyle 8 -
PHP-CS-Fixer/PHP-CS-Fixer 4 -
Roave/BetterReflection 4 -
symfony/symfony 3 -
qossmic/deptrac 3 -
TomasVotruba/bladestan 3 -
composer/composer 2 (7 in 2022) -
sebastianbergmann/diff 2 -
TomasVotruba/type-coverage 2 -
vimeo/psalm 1 (4 in 2022) -
mautic/mautic 1 -
TomasVotruba/cognitive-complexity 1 -
matomo-org/matomo 1 -
nette/utils 1 -
nikic/PHP-Parser 1 -
briannesbitt/Carbon 1 -
doctrine/orm 1 -
… a lot more - -

numbers crunched with staabm/oss-contribs

Additionally, to sourcecode contributions I also took the to time to blog about my work. In these 8 posts, I try to explain what I did, how problems have been approached and what I have learned along the way. That way I hope to inspire others to contribute to open source as well and share their journey.

If you don’t want to miss my articles, consider subscribing to my RSS feed, follow me on Twitter or mastodon.

Highlights 2023

Lets have a closer look at my personal highlights of 2023.

PHPStan Highlight: Improved developer experience for the result cache

The PHPStan result cache is a key piece for a fast feedback loop. Why, how it works and how to debug problems with it was described in this blog post. I have dumbed everything I know about it into this article.

Highlight: rexstan & rexfactor

In june 2022 the first version of rexstan, a PHPStan backed REDAXO CMS Addon was released. Its open source from day 1 and supports developers working with REDAXO every day.

Since then I was able to publish 147 releases - what a ride.

Similar to rexstan, rexfactor is a new REDAXO CMS Addon. It’s backed by Rector and helps developers to migrate their codebase to newer REDAXO versions. Its open source from day 1 and was first released in March 2023.

The Addon allows using Rector with a simple web UI. Pick your rule/rule-set, define the target source code and get a nice preview of the changes. Push the “Apply” button and the changes are applied to your codebase.

Highlight Podcast: “Könnte kaputt sein – Statische Code-Analyse mit Markus Staab”

Got interviewed by the Super Duper Developers Club about my open source work (German).

Rector Highlight: “Implement a max jobs per worker budget”

Running Rector on huge projects in a single run was not possible in the past. After implementing process and memory managment this is a fixed problem. Even huge projects like the Mautic codebase can be refactored with Rector now without out-of-memory issues.

grafik

Highlight: phpstan-dba

phpstan-dba is one of my PHPStan extensions which got a bit of traction in 2023. It’s a PHPStan based SQL static analysis and type inference for the database access layer.

I was even keen enough to talk about it at the PHPUGFFM usergroup and the unKonf Barcamp. See the slides of said talk if you are curious.

Highlight: Performance improvements

As a regular reader of my blog you already know, that I have spent a few months across different well known projects to improve their performance. This includes PHPStan, PHPUnit, Symfony, Rector and more. All the details can be found in separate posts of my performance series.

Highlight: “Crafting a more performant Open Source landscape with Blackfire”

A summary of my performance work and my vita was published on the blackfire.io Blog.

PHPStan Highlight: Support for array shape covariance

One of the craziest contributions this year. After days of in-depth analysis finally a one line fix resulted in fixing 5 bugs.

PHPStan Highlight: “Fix !isset() with Variable”

As highlighted in various tweets I was working on falsey-context type inference improvements in PHPStan. This was my most time-consuming and most rewarding contribution this year. It took me several tries to finally get it into a mergable state - this very first iteration closed 7 bugs, the oldest of them dating back to July 2020.

The main problem this contribution solves is, that PHPStan gets aware when/if variables are defined after a !isset($variable) check. To get this right, one needs to check whether the involved variables can get null and whether they are defined in the current scope. Most interesting is the case where we figured out that a variable which can never be null, also means that it can never be defined in the falsey-context.

<?php declare(strict_types = 1);

class HelloWorld
{
	public function sayHello(): void
	{
		$x = 'hello';
		if (rand(0,1)) {
			$x = 'world';
		}

		if (isset($x)) {
			echo $x;
		} else {
			echo $x; // Undefined variable: $x
		}
	}
}

Getting this right additionally means that PHPStan gets smarter for the !empty($variable)-case and the null coallescing operator ??.

I have plans to work on !isset($array['offset']) and !isset($object->property) improvements in 2024.

2024 here we come

I wish you all the best for the upcoming year. I am looking forward to continue my open source work and I hope you will support me in doing so.

If one of those open source projects is critical for your business, please consider supporting my work with your sponsoring 💕

Found a bug? Please help improve this article.


<
Previous Post
Phpstan Filter Baseline
>
Next Post
Published: phpstan-todo-by