ovr / phpsa

Smart/Static Analyzer(sis) for PHP :bowtie::neckbeard:
Other
637 stars 77 forks source link

Fixed false positive [missing_break_statement] with mixed comments #312

Closed algo13 closed 7 years ago

algo13 commented 7 years ago

It was detecting case 1, case 2, case 3, case 4.

function testValidSwitchWithComments()
{
    switch (30) {
        case 1: //< 001 comment
        case 2:
            $value = 'bar';
            break;
        // 002 comment
        case 3:
            {
                $value = 'baz';
                break;
            }

        /**
         * 003 comment
         */

        case 4:
        /*
         * 004 comment
         */
        case 5:
            $value = 'foo';
    }

    return $value;
}
ovr commented 7 years ago

Thanks @algo13 🍰 🍕