Parse the line number from an unmatched-ignore error message. PHPStan format: `"No error with identifier is reported on line ."` Returns a 0-based LSP line number.
(message: &str)
| 548 | /// PHPStan format: `"No error with identifier <id> is reported on line <N>."` |
| 549 | /// Returns a 0-based LSP line number. |
| 550 | fn parse_unmatched_line(message: &str) -> Option<u32> { |
| 551 | let prefix = "is reported on line "; |
| 552 | let start = message.find(prefix)?; |
| 553 | let after = &message[start + prefix.len()..]; |
| 554 | let end = after.find('.')?; |
| 555 | let line_1based: u32 = after[..end].parse().ok()?; |
| 556 | Some(line_1based.saturating_sub(1)) |
| 557 | } |
| 558 | |
| 559 | /// Check whether a PHPStan diagnostic is ignorable. |
| 560 | /// |
no test coverage detected