To make a difference

Dariusz Rumiński
4 min readJun 2, 2018

Few days ago, Andreas Möller made a tweet about me and my work on PHP CS Fixer. Very fast it was retweeted by Sebastian Bergmann. During that one evening, I got about 200 tweets, retweets, likes… all kind of different support. And to all of you, I want to say THANK YOU for that! I’m working on PHP CS Fixer for 4 years (ha, first commit 2014–06–19…), I had put my heart into it, I’m spending a lot of time each week to make it better, but there are also times when one is starting to think about purpose of it, or simply want to get a break. Mixing 40 hours of regular job with 10, 20 hours working on PHP CS Fixer each week can be overwhelming. But then, receiving such support from the community makes a difference. It gives great boost! In this place, I would like to thanks to the contributors as well, without you PHP CS Fixer would be way smaller!

I must admit that I had been struggling for few days shall I try to put some background of recent changes in PHP CS Fixer, I took a challenge, this is the outcome. I don’t think that I was ever good at writing, so be understanding ;)

End of v2.2

Usually, when I release v2.Y, then v2.X is loosing bugfix support (eg, after release of v2.12, no new v2.11 releases will be created). By average, this means that for each feature release I additionally release 4 bugfix releases before next feature release is out. But over a year ago (exactly 2017–03–31) version v2.2.0 has been released. That version was quite unique. It was the very first line with extended support. Reason was simple — v2.3 release bumped required PHP version, and we simply wanted to provide support for those, who can not easily upgrade. That was heavy life for v2.2, and today, with release of v2.2.20 (with 48 PRs merged!), I am finishing support of it.

Next version line with extended support is new, shiny v2.12. But don’t worry, v2.13 won’t bump requirements.

Men in the middle

As always before new feature release, a bonch of bugfixes are released for current stable. This time it was another 25 PRs.

Born of v2.12

Finally, v2.12.0 has just been released with 32 PRs merged. That means, in total, new versions released today brought over 100 changes! Sometimes, creating new rule is simple and pretty straightforward, and can be made from scratch to merge even in single day. Sometimes, a discussion itself what we want to achieve, what community wants, how it could be provided can be long. And after that, one still need to provide logic for it, which can be not that trivial. With v2.12, we managed to finish few rules that were discussed for long time. And by that I mean really long time, like even half year.

native_function_invocation was basically rewritten. Now, you can not only define list of included or excluded functions, but also use one of the preset - to change usage of all global functions, only native functions or only functions that are optimized on compiler level. Depends on your application, it can boost performance a bit, especially changes that enabling compiler-level optimizations.

Also, native_constant_invocation was added to provide similar functionality, but for constants.

error_suppression rule is filling the gap we had about triggering errors. So far, there was only a rule that was adding supression for triggering the errors, but nothing to remove supression. Now, this new rule can handle both! No more consent for silenting the errors.

In PHPUnit, methods of TestCase can be called both, in static context or instance context (http://phpunit.readthedocs.io/en/latest/assertions.html#static-vs-non-static-usage-of-assertion-methods). While both ways are good, it's great to normalize which way is taken in single project! Use php_unit_test_case_static_method_calls to normalize all cals with $this, self or static!

Sounds nice? Want more? Check out the changelog! https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/tag/v2.12.0

New distirubion channel

Recently I have published PHP Coveralls (php-coveralls/php-coveralls) at PHIVE (https://phar.io). PHIVE is a great way of managing your dev tools. Personaly, I believe that there is no one decent tool to do everything, even in topic of Static Code Analysis I advocate to use multiple tools at the same time - there are plenty of great tools there, each focusing on something different, so it's great to take benefits from all of them. But sadly, sometimes their dependencies are conflicting one another, making it impossible to install all together. PHIVE solves that by giving friendly interface to manage those tool as phar files. Now, it's time for PHP CS Fixer - I have just published it to PHIVE! It affects v2.2.20, v2.12.0 and any release in future.

Post Scriptum

Do you find this note useful? Want to see more notes like that? Or it was totally waste of your time? Don’t hesitate to share your thoughts!

Also, if you want to show your support even more, become my patron on Patreon: https://patreon.com/keradus !

--

--