1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Remove some now superfluous casts

This commit is contained in:
ralila 2021-11-30 05:08:56 +01:00
parent 9a7d0809d2
commit 98b0b052ce
2 changed files with 4 additions and 4 deletions

View File

@ -259,14 +259,14 @@ class CodeLocation
}
if (preg_match($regex, $preview_snippet, $matches, PREG_OFFSET_CAPTURE)) {
if (!isset($matches[1]) || (int)$matches[1][1] === -1) {
if (!isset($matches[1]) || $matches[1][1] === -1) {
throw new \LogicException(
"Failed to match anything to 1st capturing group, "
. "or regex doesn't contain 1st capturing group, regex type " . $this->regex_type
);
}
$this->selection_start = $this->selection_start + (int)$matches[1][1];
$this->selection_end = $this->selection_start + strlen((string)$matches[1][0]);
$this->selection_start = $this->selection_start + $matches[1][1];
$this->selection_end = $this->selection_start + strlen($matches[1][0]);
}
}

View File

@ -325,7 +325,7 @@ class ClassLikeDocblockParser
$end_of_method_regex = '/(?<!array\()\) ?(\: ?(\??[\\\\a-zA-Z0-9_]+))?/';
if (preg_match($end_of_method_regex, $method_entry, $matches, PREG_OFFSET_CAPTURE)) {
$method_entry = substr($method_entry, 0, (int) $matches[0][1] + strlen((string) $matches[0][0]));
$method_entry = substr($method_entry, 0, $matches[0][1] + strlen($matches[0][0]));
}
$method_entry = str_replace([', ', '( '], [',', '('], $method_entry);