Skip to content

Rule visits nullsafe method call twice (once with MethodCall, once with NullsafeMethodCall) #9830

@janedbal

Description

@janedbal

Bug report

When a rule is hooked on parent of those nodes, e.g. like this:

public function getNodeType(): string
{
    return Node::class; // or CallLike or any other common parent
}

and analyses this simple code

<?php
$var?->call();

The rule is called twice:

  1. Once with MethodCall node from here
  2. Once with NullsafeMethodCall node from here

Code snippet that reproduces the problem

https://phpstan.org/r/2aa36241-7795-4561-bf14-5c8d641f89fb

Expected output

Visit node only once.

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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions