logoalt Hacker News

origini • today at 9:18 AM • 5 replies • view on HN

Ah boy o boy, PHP was the first lanuage I teached myself but man it still needs PHPDoc comment on return types?

Come on PHP has so many shitty things, but even something basic like this is still not in the lanuage itself?


Replies

pkkm • today at 1:39 PM

PHP does have return type annotations. The reason the PHPDoc comments are needed here is that it lacks generics. Unfortunately, adding generics has proven problematic, but I still hope that we'll see them in the next few years.

monster_truck • today at 9:20 AM

It's had return type declarations since 7. There's even intersection and literal types now. You could have typed this into google and it would have told you

➕ show 2 replies
Y-bar • today at 9:28 AM

TFA even shows examples of native return types. How could you not see that?

➕ show 1 reply
throw1234567891 • today at 10:29 AM

"Taught", not "teached".

spiderfarmer • today at 10:09 AM

"Cool! A PHP article on HN, let's rehash some of my comments that got lots of upvotes 11 years ago!"

➕ show 1 reply