aik099/CodingStandard

Improve comment detection before "return" statement

Opened this issue · 0 comments

Case 1: block comments

else {
    /*if ( is_null($input_type)
        || ($input_type == self::TEXT_INPUT)
        || ($input_type == self::PASSWORD_INPUT)
    ) {*/
    return TextInput::fromNodeElement($node_element);
}

Case 2: multiple single line comments (just use https://github.com/aik099/CodingStandard/blob/master/CodingStandard/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php#L408)

else {
    // line 1
    // line 2
    return TextInput::fromNodeElement($node_element);
}

Case 3: comment belonging to other code (need to ignore such comment and don't combine it with return)

$var_name = new ClassName();
/** @var ClassName $var_name */

return $var_name;