-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
Bug report
What do you think about this? /cc @staabm
public function getDuration(string $path): void {
preg_match('~^([a-z]+)\\:\\/\\/(.+)~', $path, $matches);
$scheme = null;
if ($matches !== []) {
[, $scheme, $path] = $matches;
}
}I think if the array is non-empty then the keys will exist, right? But PHPStan reports:
Offset 1 might not exist on non-empty-list{0?: string, 1?: non-empty-string, 2?: non-empty-string}.
Offset 2 might not exist on non-empty-list{0?: string, 1?: non-empty-string, 2?: non-empty-string}.
Code snippet that reproduces the problem
https://phpstan.org/r/9344ca07-6178-44d2-844b-b2b3903d2a2b
Expected output
No errors
Did PHPStan help you today? Did it make you happy in any way?
No response
Reactions are currently unavailable