Property Hooks in PHP 8.4: Game Changer or Hidden Trap?

PHP 8.4 finally kills getters and setters – except property hooks bring their own gotchas with arrays, references, and the fact that you can't tell from the signature whether a property is even writable. I break down where they shine and where the traps lurk that the documentation won't serve up for you.

The Hidden Surprises of PHP Readonly Properties

Readonly properties are like a lock on a door – they lock the reference, but what's happening inside the object is beyond their watch. I dig into the pitfalls of initialization, constructor myths, tricks with references in arrays, and PHP 8.4 features that finally loosen the most annoying restrictions.

Two Words That Kill Open Source

“I don't have time,” someone writes in an issue, essentially saying: your free time has no value, drop everything and solve MY problem. 99% of such issues remain forever unresolved – digital monuments to human laziness. So how to do it differently?

Why GPT is the SQL of our century?

SQL promised in the '70s that it would make databases accessible to everyone. It took half a century for someone to deliver on that promise — and it's not SQL. Just feed your database structure into GPT, ask in plain English, and let it generate queries that would otherwise require an expert.

How to Handle Getters When They Have Nothing to Return?

What to do when a getter has nothing to return? Nullable parameter, a hasFoo/getFoo pair, or getFooOrNull? I break down three strategies with everything that comes with them – including where each one will bite you in the hand.

Can Regular Expressions Be Used to Parse HTML?

I built one monumental regular expression that can actually parse an entire HTML 5 document – entities, tags, comments, doctype, everything. It works. And it's absolutely useless. But the journey there is worth every backreference.

When Copilot Loses Direction: A Celebration of Shoddy Workmanship

Microsoft released an official video where Copilot helps write a regular expression for matching HTML tags. The result matches all sorts of nonsense and fails on trivial cases. A tragicomic demonstration of how professional negligence spreads under the banner of progress.

First Steps in OOP in PHP: Essentials You Need to Know

I wrote a concise guide to OOP in PHP that walks you through classes and objects, inheritance, interfaces, all the way to exceptions. No philosophizing – just a factually correct foundation you can build on. For instance, right away in Nette.

Compilation errors in PHP: why are they still a problem?

PHP 7 tamed fatal errors into exceptions, but two hundred compile-time errors act as if it's still 2004. There's no way to catch them, php_check_syntax() was taken away from us after four minor versions, and the only option left is to call an external linter. I show how to do it – and what PHP 8.3 promises.

Why is the operator ?? sheer misfortune?

The ?? operator took 12 years to be born, arriving at the exact moment PHP stopped needing it. Instead of simplifying life, it now reliably conceals typos and bugs. I would have preferred if we had waited even longer for it.

That's all. More articles are on the way.

phpFashion © 2004, 2026 David Grudl | o blogu

Ukázky zdrojových kódů smíte používat s uvedením autora a URL tohoto webu bez dalších omezení.