Skip to content

Type Hints and Return Types

Compare
Choose a tag to compare
@devosc devosc released this 09 Sep 16:41
· 231 commits to master since this release

PHP 7.0 type hints and return types have been added. This strengthens the logic of the system and makes it easier to follow. Additionally, the null coalescing operator is used to complement nullable return types so it is possible to determine whether a value has been set and to cause an error when an uninitialized value is passed to a variable with a specific type hint, e.g. a string.

The service call method now only passes the arguments of a chained method call to the last function, e.g call('request.uri.with', ['path', '/']) will only pass the arguments to the "with" function; previously they would be passed to every function in the chain.

The service builder can now create classes with variadic constructors using named arguments.

A cookie expire time now accepts a string date format for the strtotime function, e.g '+1 day'.

A shared layout class has been added to help provide a layout that can be modified by a template.