nikic / PHP-Parser

A PHP parser written in PHP
BSD 3-Clause "New" or "Revised" License
16.98k stars 1.09k forks source link

Prevent off-by-one errors in line-number related methods #985

Closed staabm closed 6 months ago

staabm commented 6 months ago

when working with line numbers, one could easily do off-by-one errors because of assumptions about whether line numbers start at 0 or 1.

the added phpdocs make sure that static analysis, no matter whether phpstan or psalm, can detect errors like that. psalm will also work with these phpstan-prefixed phpdocs.