PHP 8 changes – my first impressions

PHP 8 in out since 26 Nov 2020.
I took a look at the change log and here is what I like and don’t like. Most of them are great changes.

1. Named arguments

This is nice. I think I’ve seen this in Kotlin before.

2. Annotations

This is excellent.
The fact that PHP didn’t have native annotation was one of the main reasons I preferred java.
Remains to be seen if it’s just as useful as it is in java or if it has some drawbacks.
I preferred the @ notation but I guess there were some constrains that prevented that.
Maybe the error suppression in PHP suing the same symbol.

3. Constructor helper

This looks useful. I think I’ve seen it in Typescript before.

4. Union types

I think I prefer just one type per variable.

5. Match expression

I hate this. From what I understand it’s also in Rust.

6. Nullsafe operator

I love this one.

7. Saner string to number comparison

Haha, about time.

8. Trailing comma in parameter lists

Very nice. It will improve PHP developers mental sanity. I hate errors about that comma.

Leave a Reply

Your email address will not be published. Required fields are marked *