Skip to content

False positive "Else branch is unreachable because previous condition is always true" #3090

@bobdenotter

Description

@bobdenotter

Hi Folks,

This issue popped up after updating from 0.12.14 to 0.12.15

Snippet to reproduce

    /**
     * @param string|int $bar
     */
    public function foo($bar)
    {
        if (is_numeric($bar)) {
            // something
        } else {
            // otherwise
        }
    }

Output:

 ------ -----------------------------------------------------------------------
  Line   Foo/Bar.php
 ------ -----------------------------------------------------------------------
  xx     Else branch is unreachable because previous condition is always true.
 ------ -----------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions