Skip to content

Virtual nodes created by Psalm sent to plugins #5215

@orklah

Description

@orklah

I'm currently implementing AfterExpressionAnalysisInterface in order to detect and change == into === when safe.

It seemed pretty easy but I'm stuck with an issue I don't know how to solve.

In SwitchCaseAnalyzer (and probably elsewhere), Psalm is creating a new Expr\BinaryOp\Equal in order to analyse operations. This Equal Expression is then sent to the plugin as if it was in the original code as a real "==" node.

Unfortunately, When I try to replace with a === it just breaks the code. I couldn't find a way to differentiate between those virtual nodes and real one.

Is there a way to do that I'm missing or could we maybe flag those node somehow to exclude them in plugin analysis?

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