PHPnews.io

Overview for 'matthiasnoback'


What's a simple solution?

Written by Matthias Noback / Original link on Aug. 2, 2022

"As I'm becoming a more experienced programmer, I tend to prefer simple solutions." Or something similar. As is the case with many programming-related quotes, this is somewhat of a blanket statement because who doesn't prefer simple solutions? To make it a powerful statement again, you'd have to ex…


My book-writing workflow

Written by Matthias Noback / Original link on Jul. 29, 2022

By request: what's my workflow for writing books? Steps, tools, etc. Writing with the Leanpub platform A long time ago I noticed that testing-advocate Chris Hartjes published his books on Leanpub. When I had the idea of writing a book about the Symfony framework, I tried this platform and it was a…


When to use a trait?

Written by Matthias Noback / Original link on Jul. 27, 2022

When to use a trait? Never. Well, a trait could be considered to have a few benefits: Benefits If you want to reuse some code between multiple classes, using a trait is an alternative for extending the class. In that case the trait may be the better option because it doesn't become part of the type…



Effective immutability with PHPStan

Written by Matthias Noback / Original link on Jul. 4, 2022

This article is about a topic that didn't make the cut for my latest book, Recipes for Decoupling. It still contains some useful ideas I think, so here it is anyway! DateTimeImmutable is mutable I don't know where I first heard it, but PHP's DateTimeImmutable is not immutable: <?php $dt = new Da…