Updated on July 31, 2018
PHP 7.1 is awesome
PHP 7.1 has been released, bringing some features I was eagerly anticipating and some surprises that had gone under my radar.
New iterable pseudo-type
This is the feature I’m most exited about, perhaps because I had no clue it was in the works. In short, iterable allows for type hinting in functions that just loop though their parameters value without restricting the type to either array or Traversable, or not having any type hint at all. This partially solves one of the points I raised in my Missing in PHP 7 series post Collections.
This feature I also already addressed in Missing in PHP 7 Nullable return types. What somehow escaped my attention is that PHP 7.1 comes not just with nullable return types, but also new syntax for nullable parameters.
Other new features that I’m excited about are the Void Return Type and Class Constant Visibility Modifiers. Both of these help with revealing the authors intent, reduce the need for comments and make it easier to catch bugs.
A big thank you to the PHP contributors that made these things possible and keep pushing the language forwards.
For a full list of new features, see the PHP 7.1 release announcement.