Skip to content

Wrong start loc when using nullsafeoperator ?-> #1128

@abdul-alhasany

Description

@abdul-alhasany

Hi
The parser seems to provide wrong start loc when using nullsafeoperator.

Example:

<?php
$test = $object?->property;

The example will give this loc:

start: {
   line: 2,
   column: 15, // should be 8
   offset: 21, // should be 14
},
end: {
   line: 2,
   column: 26,
   offset: 32
}

only start.column and start.offset provide the wrong position, the rest of the details are correct.

When removing the operator ? the position details are correct.

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