News for hackers. Stuff that matters.
Re:Go with PHP by muglug on Thursday May 11, 2023 @01:14AM (#35897849)
> To note, you'll need strict mode for type hints to be useful

This is not really true — those type hints can be read by static analysis tools, preventing you from many of the issues that would also be caught in strict mode at runtime.

Re:Go with PHP by jwdunne on Thursday May 11, 2023 @02:15AM (#35898337)
You’re right. Psalm has been a god send on the project I’m working on.

Unfortunately, it’s taking far too long for Laravel to catch up so parts of its API are a black hole for types.

Especially things like request input, which returns a union of string and array as opposed to using a conditional return type.

You end up with assertion soup every time you touch Laravel so over time the project uses less and less of it.

A well-typed framework and set of libraries would be very nice.

Re:Go with PHP by muglug on Thursday May 11, 2023 @08:40AM (#35901225)
> Psalm has been a god send on the project I’m working on.

Thanks!

Re:Go with PHP by dgb23 on Thursday May 11, 2023 @07:17AM (#35900597)
The type system isn’t expressive enough for these tools to catch anything but the most basic errors.

In PHP, typing is for function signature documentation.