logoalt Hacker News

bel8 • today at 11:25 AM • 2 replies • view on HN

PHP type system is lacking but I wouldn't call it minimal.

PHP even has union types, just like TypeScript.

The major issue is the lack of array types and it's 90% of the reason I see projects using extra linting tools.

[1] https://php.watch/versions/8.0/union-types


Replies

Timon3 • today at 12:53 PM

> PHP type system is lacking but I wouldn't call it minimal.

PHP still doesn't have generics, right? IMO any type system without higher-order types is definitely on the minimal side.

➕ show 1 reply
wesammikhail • today at 11:29 AM

That's exactly it but PHP Core refuses to address the typed array issue in wait for a consensus on Generics even though those two things serve different audiences.

I haven't actually run into a single issue with PHP's type system in the last few years. Literally the only thing that remains is typed arrays but that seems to be ways off due to fragmentation in how the core devs want it handled.

➕ show 1 reply