Skip to content

Analyzer false positive when using is_... php type check functions with array_filter #830

@KorvinSzanto

Description

@KorvinSzanto

Description

Mago infers array_filter($array, is_string(...)) as array<array-key, mixed> rather than array<array-key, string>. Same is true for other built in is_... functions.

You can mitigate by setting it to a variable and declaring the type of that variable, but then lint --fix will remove the redundant variable and reintroduce the issue.

Playground Link

https://mago.carthage.software/playground#019b5400-fa0c-4094-f56e-f97a5dbcfdec

Reproduction

No response

Environment

  • mago 1.0.3
  • OS Linux
  • Installed via composer

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugAn issue causing unintended or problematic behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions