Closed
Description
PHPStan has some Very Special Magic which allows the matches variable to be usefully-typed, but the magic isn't triggered by \Safe\preg_match
<?php
require_once "vendor/autoload.php";
// Dumped type: array{0?: string, 1?: non-empty-string}
preg_match("/te(.)ting/", "testing patterns", $matches);
\PHPStan\dumpType($matches);
// Dumped type: array<string>|null
\Safe\preg_match("/te(.)ting/", "testing patterns", $matches);
\PHPStan\dumpType($matches);
Metadata
Metadata
Assignees
Labels
No labels