php-parser icon indicating copy to clipboard operation
php-parser copied to clipboard

Wrong start loc when using nullsafeoperator `?->`

Open abdul-alhasany opened this issue 2 years ago • 0 comments

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.

abdul-alhasany avatar Jul 25 '23 19:07 abdul-alhasany