Use null default types for determining argument type in PHP

Authored by mtijink on Jul 26 2017, 5:27 PM.

Description

Use null default types for determining argument type in PHP

Summary:
PHP allows default values for function arguments, even with typehints set. This does not affect the type given to the function because PHP converts it to declared type.

There is one exception: when the default value is null, PHP changes the allowed types to be passed to typehint|null. In fact, before PHP 7.1, this was the only way to allow passing null instead of an object when a typehint was used.

This diff implements this: when a null default type is passed, the argument type will be typehint|null.

Reviewers: KDevelop

Subscribers: kdevelop-devel, KDevelop

Tags: KDevelop

Differential Revision: https://phabricator.kde.org/D6915