Php-cs-fixer: Remove return `null` type hint from PHPDoc if not possible

Created on 29 Mar 2018  路  2Comments  路  Source: FriendsOfPHP/PHP-CS-Fixer

When a method signature defines a return type, than that type must be the only one in the PHPDoc return annotation (if any of course)

For example:

/**
 * @return Foo|null
 */
function A(): Foo
{
}

null must be removed by the fixer

kinfeature request

Most helpful comment

IMO this should be covered by a more general fixer that removes useless PHPDocs. In your example, beside being wrong, the annotation does not add any information so it can be removed altogether.

All 2 comments

IMO this should be covered by a more general fixer that removes useless PHPDocs. In your example, beside being wrong, the annotation does not add any information so it can be removed altogether.

yep, I would expect to drop whole annotation as well

Was this page helpful?
0 / 5 - 0 ratings