Skip to main content

Posts

Showing posts from 2015

My PHP Wishlist

PHP Wishlist These are things that I think would help developers build better programs with far fewer lines of code. Simple enough? Let's get to it. Scalar Type Hints and a Strict Mode Currently one of the hottest RFCs in PHP history perhaps, Scalar Type Hints. This is a feature that allows developers to specify any type a given parameter should be. Currently PHP only supports object types and arrays for type hinting. This allows for string, integer, boolean, and the like.  However, nothing is simple in PHP. With this, some developers want conversion to happen if the wrong type is given (string to integer for example if '3' is passed in) while others want strict enforcing of types. The RFC has a middle-ground of loose typing by default like everything else in PHP, but the option to turn on a strict mode. My issue with the RFC is... The syntax is horrible for declaring strict mode. I was actually entirely for it up until a few days ago. I read a comment on