Category: statically typed

Creating Strictly Typed Arrays and Collections in PHP

One of the language features announced back in PHP 5.6 was the addition of the ... token to denote that a function or method accepts a variable length of arguments. Something I rarely see mentioned is that it’s possible to combine this feature with type hints to essentially create typed arrays. For example, we could ...