Closed
Description
Bug report
<?php declare(strict_types = 1);
$data = [
'c1' => 12,
'rasd' => 13,
'c34' => 15,
];
foreach ($data as $key => $value) {
$match = [];
if (false === preg_match('/^c(\d+)$/', $key, $match) || empty($match)) {
continue;
}
var_dump($key);
var_dump($value);
}
https://phpstan.org/r/68e9cca9-06c3-48ad-8f3c-4e395f9da991
Expected output
Expected no errors
If preg_match is done outside of if works as expected