Do you use PHP_CodeSniffer and PHP CS Fixer PHPStorm Plugin? You are Slow and Expensive

People keep asking me about IDE plugins for Rector and Easy Coding Standard. Do you want it too? Do you use one for PHP_CodeSniffer of PHP CS Fixer? Have you ever thought about the benefits and costs of them?

Benefits of Instant Feedback

When you a PHPStorm plugin that tells you what to do, you have this extra information that you can follow:

That's pretty cool, right? It will:

The last benefit is wired to our brains.

Trap of Instant Gratification

"Everybody is addicted to dopamine."

Slack notification, Instagram likes, underline of typoes and suggestions in your IDE.
This all makes us happy by brain design.


Coding standard tools are in your IDE already, next are static analyzers and instant upgraders:


Live report on Psalm.dev

Everyone writes about the benefits of these plugins, but how much do you pay for it?

"It's free!"

Attention Economy

Well, it's not. If you've never heard about dopamine - notification effect, read Are You Using Social Media or Being Used By It? by Cal Newport. This amazing guy helped me to quit Twitter and go deeper in topics I really care about in my life.

Basically, notifications turn your beautiful and dynamic brain capable of high abstract thinking to the brain of a heroin addict with instant feedback overloop.


Let's get back to our code again.

What Happens When we Type Code in PHPStorm with PHP Code Sniffer plugin?

If we're lucky, it's gone under 15 seconds. If not, we get back to "we try to understand it" step. In time, we get better, faster and we create a small database of "message → solution" in our brains. In a few weeks, we learn how to write perfect code without any underscores.

Then our team extends rule set with PSR-12 and we have to upgrade our brain database. So we start to hate extending of coding standards and prefer less.

Expensive Fun

Now the important question: do you know how expensive this is? If you have a boss who doesn't care about productivity and you can whatever you need without critical business thinking, stop reading, because you're primed to waste money by your work design.

But if you're freelancer, or you pay your programmers or you desire to be effective by lazy, I have a comparison for you:

Without PHPStorm plugins, you have to run the tool manually in your command line once per git push:

What is cheaper in money and brain damage?

Pro-lazy tip: I'm too lazy to type more than 2-3 chars manually, so I use composer scripts and 2-3 chars long bash script shortcuts:

cs
# aliased to vendor/bin/ecs check app packages tests

fs
# aliased to: vendor/bin/ecs check app packages tests --fix

Benefits of Deep Work and Scaled Automation

Rule of the Thumb: If something requires your attention multiple times with same A → B operation, automate the change and delegate it.

PHP_CodeSniffer can actually report what should be changed, without any clear suggestion of how to change it (read-only). But PHP CS Fixer fixes the code by default, so you don't even have to think about the change. So using PHP CS Fixer manually is a pure waste of life and money.


And this just a very limited example of 1 programmer and 1 project. Most companies have multiple programmers and projects. *The waste of time for 10-programmer teams having 20 projects escalates quickly:

In simple words: exponential costs vs constant costs

Scale to Whole PHP World

Now imagine all the PHP projects in the world. Which of those is faster?

Does it ring a bell? Now think about the same way about instant upgrades or refactoring?

If there will be Rector plugin for PHPStorm (I honestly hope it won't), you'd have to find every new pattern there is in your project, again manually and randomly in your PHP files and hit the "refactor" button.

If you're effective, lazy and don't want to produce waste, you'll run:

vendor/bin/rector process src

And save millions of your brain cells :)


Happy coding!




Do you learn from my contents or use open-souce packages like Rector every day?
Consider supporting it on GitHub Sponsors. I'd really appreciate it!