From tomasvotruba.com
Off the Beaten Path to Upgrade Symfony 2.8 to 7.2
3 3
There are two types of upgrades. One follows only `UPGRADE.md` files on every release, replacing what has been removed with new alternatives. It works, and we could say that the codebase will be "up-to-date." The other upgrade doesn't stop at the required minimum but **makes use of all modern...
15h ago
From tomasvotruba.com
How to flip Doctrine ODM repositories to Services
0 0
While working with legacy projects, I often encountered this anti-pattern of misusing repositories. Instead of easy-to-inject service, projects are locked into a service locator. This makes code hard to upgrade and locks your project heavily to the Doctrine ODM packages. And there are plenty of...
on Nov 19
From tomasvotruba.com
Alice, Nelmio, Hautelook, Faker - How to upgrade Doctrine Fixtures - Part 1
0 0
Upgrading Doctrine Fixtures can be challenging work. It requires the coordination of four different package groups on Github. One cannot be upgraded without the other. <br> <br> We first prepare for the jump, then take the leap with confidence. I'm writing this post as I handle the upgrade, so...
on Nov 11
From tomasvotruba.com
5 Ways to Extract Value from Overmocked Tests
0 0
The legacy projects we work with are often flooded with mocks. I already wrote [How to Remove Dead Mock Calls from PHPUnit Tests](/blog/how-to-remove-dead-mock-calls-from-phpunit-tests), which focuses on dealing with PHPUnit bloated syntax. Today, we look at the next wave of improvements that...
on Nov 7
From tomasvotruba.com
How to Upgrade deprecated PHPUnit withConsecutive()
0 0
The `withConsecutive()` method [was deprecated in PHPUnit 9](https://github.com/sebastianbergmann/phpunit/issues/4255#issuecomment-636422439) and removed in PHPUnit 10. It sparked many...
on Oct 16
From tomasvotruba.com
PHP is the Best Choice for Long‑Term Business
0 0
Recently, I listened to Lex Friedman's [podcast with Pieter Levels](https://open.spotify.com/episode/6KBpL2XfR9VdojbKNpE7cX). Pieter talked about his technology stack for building startups: vanilla PHP, jQuery, and SQLite. Hype is exciting, but there is no better technology proof than long-term...
on Aug 28
From tomasvotruba.com
Scope and Downgrade your PHP Tools for Everyone to Use
0 0
Yesterday, I came across a cool PHP tool. I wanted to try it, but the installation instructions were a bit tricky. The tool required a specific PHP version and a specific version of each dependency. It required Symfony 5.4+, but our project has Symfony 3.3. I was unable to use it. Many PHP...
on Jul 14
From tomasvotruba.com
2 Tricks to get your Symfony configs lines to minimum
0 0
I believe that every Symfony app can fit service config under 5 lines. Configs are among the most underestimated parts of Symfony projects and deserve to be done right. Like a healthy tree trunk, which brings power to the branches and leaves, clear configs keep the design architecture clear and...
on Jun 24
From tomasvotruba.com
Awesome PHP Packages from Japan
0 0
Last month, I spent in Japan to travel and absorb the local culture. I've also pinged a few friends I knew from Rector and AST projects in the past. I was surprised by how productive the PHP community is around here, with tools I'd personally use and ideas that inspire me.
on Jun 24
From tomasvotruba.com
How to add visibility to 338 Class Constants in 25 seconds
0 0
In PHP, we have classes with methods inside them. Would making all your methods `public` be a good idea? No, because some of them should be used only by the class they're in and not anywhere else. What about class constants?
on May 31
From tomasvotruba.com
0 0
When using a Swiss knife, we think of a tool with many practical abilities. They're useful for different situations we might experience in the wild. Opening a box of milk? Here is a knife. Cutting wood to start a fire? Here is a chainsaw. Are the letters on the paint bucket too tiny? Try this...
on May 11
From tomasvotruba.com
Get Quick Error Count for each PHPStan level
0 0
When I come to a new project, I want to make a rough idea of what I'm dealing with in a few minutes. I usually check `composer.json` and [measure the lines](/blog/easy-and-quick-way-to-measure-lines-of-code-in-php). Then, I'd love to run PHPStan and get a rough idea of the current state. But...
on May 7
From tomasvotruba.com
How adding Type Declarations makes Your Code Dangerous
0 0
...and how to avoid it. [Type coverage](/blog/how-to-measure-your-type-coverage) is a way to gradually add type declarations to your PHP project—step by step, one by one. It's a PHPStan package that helps you maintain a specific minimal level from 0 % to 100 %. <br><br> Once we reach high...
on May 3
From tomasvotruba.com
0 0
When we upgrade a new project to the best version possible, the latest PHP and framework versions, it's not only about changing syntax sugar to a more fancy one. It's about the vast focus shift in project management so far. It's a change to master. I want to share the basic rules we apply to...
on Apr 18
From tomasvotruba.com
Finalize Classes - Automated and Safe
0 0
Final classes have [many](https://ocramius.github.io/blog/when-to-declare-classes-final/) [great](https://tomasvotruba.com/blog/2019/01/24/how-to-kill-parents) [benefits](https://matthiasnoback.nl/2018/09/final-classes-by-default-why/) for future human readers of your code. They have even more...
on Mar 19
From tomasvotruba.com
Rector Book 2024 Release with Brand new Chapter
0 0
I'm happy to introduce the latest update to our book - *Rector, the Power of Automated Refactoring*, along with Rector version 0.19.5 from this week. This release includes 2 new commands, brand new configuration with smart IDE autocomplete, brand new chapter and DX improvements to help you...
on Feb 2
From tomasvotruba.com
3 Signs Your Project is Becoming Legacy - Mock Rottening
0 0
In [the first post](/blog/3-signs-your-project-is-becoming-legacy-and-how-to-avoid-them), we looked at the long-term effects of our decisions. Turning a legacy project into a fresh one is a matter of the "just do it" approach. But there are 3 things we should take with care even if our project...
on Jan 30
From tomasvotruba.com
Get Json output for PHPUnit 10
0 0
Early this year, I created a few custom Rector rules for our client. It modified the code based on the PHPUnit error result report. The only problem is that PHPUnit outputs a string. So, I had to parse it manually with regexes. Having a JSON output would make my life easier. I'm used to PHP...
on Jan 27
From tomasvotruba.com
0 0
Easy Coding Standard focuses on easy run, setup, and use. From composer requirement through the automated setup to the config. The config was based on rather cumbersome Symfony closure service configs. But last year, I [switched the DI container to...
on Jan 24
From tomasvotruba.com
3 Signs Your Project is Becoming Legacy - Arrays Creep
0 0
In [the first post](/blog/3-signs-your-project-is-becoming-legacy-and-how-to-avoid-them), we looked at the long-term effects of our decisions. Turning a legacy project into a fresh one is a matter of the "just do it" approach. But there are 3 things we should take with care even if our project...
on Dec 28
From tomasvotruba.com
How to Autowire Multiple Instances of Same Type in Symfony/Laravel
0 0
Do you work with Symfony since 2 through 7? Then you know the main challange in the upgrade path is to trim your YAML configs to minimum. Where we needed 300 lines in YAML configs, we now need 2 lines. How to get there fast and reliable? I'll show 3 trick we use in Symfony project to get there.
on Nov 1, 2023