PHP

PHP

Made by DeepSource

Invalid return typehint for function PHP-T1002

Bug risk
Critical

The return typehint provided for the function is either invalid or not present in the current namespace.

The issue is also raised when native union types are used for PHP < 8.0. Native union types can only be used with PHP >= 8.0.

Bad Practice

class SomeTypehints {}

function foo(SomeTypehints $foo, $bar, array $lorem): DNE  // invalid type DNE
{

}

Recommended

class SomeTypehints {}

class DNE {}

function foo(SomeTypehints $foo, $bar, array $lorem): DNE
{

}