mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
Merge pull request #6716 from orklah/fatal
fix Uncaught ValueError: strrpos()
This commit is contained in:
commit
1b9f84970d
@ -297,8 +297,12 @@ class CodeLocation
|
||||
$this->text = mb_strcut($file_contents, $this->selection_start, $this->selection_end - $this->selection_start);
|
||||
|
||||
// reset preview start to beginning of line
|
||||
$this->column_from = $this->selection_start -
|
||||
(int)strrpos($file_contents, "\n", $this->selection_start - strlen($file_contents));
|
||||
if ($file_contents !== '') {
|
||||
$this->column_from = $this->selection_start -
|
||||
(int)strrpos($file_contents, "\n", $this->selection_start - strlen($file_contents));
|
||||
} else {
|
||||
$this->column_from = $this->selection_start;
|
||||
}
|
||||
|
||||
$newlines = substr_count($this->text, "\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user