Skip to content

Comment on PHP is the new JavaScript?parent

Comments

...I envy TypeScript, though. I wish PHPDoc was more powerful... I just want ADTs.

You can get a lot of the way there with static analyzers like Psalm (psalm.dev). Annotate your functions/classes with detailed types in PHPDoc, and it'll verify that your code behaves consistently with those types.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.