TypeHintSniff.php is (also) used to check for functions that
declare a return type, but don't return anything
return something, but don't declare return type
The problem is that there's a false positive when a void function returns nothing as expected, but has an early return like:
function i_return_nothing( bool $condition ) {
if ( $condition ) {
return;
}
do_something();
}
In the case above, the code style raises an error for missing return type, but void return type is only something possible from PHP 7.1. If Neutron Standard targets 7.0 as well, the TypeHintSniff.php should better handle such cases.
TypeHintSniff.php
is (also) used to check for functions thatThe problem is that there's a false positive when a void function returns nothing as expected, but has an early return like:
In the case above, the code style raises an error for missing return type, but
void
return type is only something possible from PHP 7.1. If Neutron Standard targets 7.0 as well, theTypeHintSniff.php
should better handle such cases.