Skip to content

[feature request] type check match clause #200

Description

@Disservin

Description

<?php

function foo(string $str)
{
    return match ($str) {
        'foo' => 'bar',
        321 => 'x'
    };
}

The type of $str is known to be string which means 321 in the match clause can never be reached, since match uses identity checks (===).

Maybe issue a warning ?

Use case

better intellisense

Proposed solution

No response

Alternatives considered

No response

Code example

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions