Symfony 7.3 was released this week. I opened the release notes with a text file next to them. The file is a list of things to delete.
Every project older than three years carries a layer of custom helpers that were reasonable when written. The framework moves, the helpers stay. Nobody reviews them, because they work.
Two examples from one project.
A base console command class with sugar for arguments and options, written around 2021. Symfony 7.3 has invokable commands, arguments come as parameters with attributes:
#[AsCommand('app:prune-sessions')]
final class PruneSessionsCommand
{
public function __invoke(SymfonyStyle $io, #[Option] int $days = 30): int
{
// ...
return Command::SUCCESS;
}
}
Our base class is now a duplicate of the framework, only worse tested. It goes away.
Second, a hand-written mapper from request DTOs to entities. The new ObjectMapper component covers most of it. It is experimental, so production code does not move onto it yet. But the mapper is on notice.
The process is dull, on purpose. List the custom abstractions that smell like framework code. Read the release notes of the framework you actually run, the version in composer.lock, not the one in the blog posts. Where a native replacement exists, estimate migration cost honestly. Migrate the cheap ones now, put the rest in the backlog with a link.
We do this once a year now, as a calendar event. Deleted code is the only code that never needs an upgrade.
The base command class was mine. I was proud of it in 2021. The pull request that removes it is the best thing I ship this month.