Skip to content

Should detect value after conditional check #11870

@pereorga

Description

@pereorga

Feature request

This may be duplicate already, but not sure how to find it.

PHPStan should complain second assert will always evaluate to true in this code:

<?php

assert(isset($v) && is_array($v) && isset($v['LANGUAGE']));

$language = $v['LANGUAGE'] !== 1 ? 'en' : '';
if ($language !== '') {
	assert($v['LANGUAGE'] !== 1);
}

https://phpstan.org/r/db5fa558-fa4c-45b1-ade1-ac72d6e29d47

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions