Skip to content

PHP8 shows Variable $data in empty() always exists and is not falsy. #7424

@Khez

Description

@Khez

Bug report

Using phpstan@1.7.11 (the bug exists as since 1.7.0 at least)

With the following composer.json

{
    "require": {
        "php": ">=8.0"
    }
}

The error shows up even if manually updating phpstan.neon.dist or phpstan.neon

parameters:
    phpVersion: 80000 # 8.0

The array_push function was updated in PHP 7.3:

This function can now be called with only one parameter. Formerly, at least two parameters have been required.

Code snippet that reproduces the problem

https://phpstan.org/r/68d9ad8d-cc02-4262-af12-bc5086ed4be4

Expected output

No error output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions