Skip to content

extract() flags argument is not actually considered to be flags #118

@xPaw

Description

@xPaw

I think that happens because it's defined here:
https://github.com/phpstan/phpstan-src/blob/1f150cc9ae1fcab992aca658f317b91d0757107f/resources/functionMap.php#L2640

I don't know if functionMap allows specifying that such an argument should be considered actual bitflags.

Using another function as an example (ftp_set_option) doesn't report an issue because the argument type is specified as an int:
https://github.com/phpstan/phpstan-src/blob/1f150cc9ae1fcab992aca658f317b91d0757107f/resources/functionMap.php#L3043

Demo: https://phpstan.org/r/1356266d-ef73-43ea-a7d9-ea0cb95c1075

As far I understand it, phpstan also uses the phpstorm-stubs, and it has correct arguments specified for both using ExpectedValues(flags) attribute, if phpstan supports this attribute then maybe such functions just need to be removed from the functionMap? But a quick search in the codebase shows no matches for ExpectedValues,

https://github.com/JetBrains/phpstorm-stubs/blob/6c034ae018ed7ac2cacf2474f824aede73658afa/standard/standard_8.php#L850-L863
https://github.com/JetBrains/phpstorm-stubs/blob/6c034ae018ed7ac2cacf2474f824aede73658afa/ftp/ftp.php#L511

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