glayzzle / php-parser

:herb: NodeJS PHP Parser - extract AST or tokens
https://php-parser.glayzzle.com/
BSD 3-Clause "New" or "Revised" License
537 stars 71 forks source link

`uniontype` has wrong start loc #1129

Open abdul-alhasany opened 1 year ago

abdul-alhasany commented 1 year ago

Hi When using uniontype the parser is providing the wrong loc data.

Example:

function functionWithMultipleTypes(int $arg1, $arg2): string|int {
    return 'foo';
}

The union type string|int provides this loc:

start: {
line: 3, 
column: 65, <-- This is wrong
offset: 72 <-- This is wrong
}
end: {
line: 3,
column: 64,
offset: 71
}

end location data is correct.