function Preg::enforceNonNullMatches
Parameters
array<int|string, string|null|array{string|null, int}> $matches:
Return value
array<int|string, string>
Throws
2 calls to Preg::enforceNonNullMatches()
- Preg::matchStrictGroups in vendor/
composer/ pcre/ src/ Preg.php - Variant of `match()` which outputs non-null matches (or throws)
- Preg::replaceCallbackStrictGroups in vendor/
composer/ pcre/ src/ Preg.php - Variant of `replaceCallback()` which outputs non-null matches (or throws)
File
-
vendor/
composer/ pcre/ src/ Preg.php, line 398
Class
Namespace
Composer\PcreCode
private static function enforceNonNullMatches(string $pattern, array $matches, string $variantMethod) {
foreach ($matches as $group => $match) {
if (is_string($match) || is_array($match) && is_string($match[0])) {
continue;
}
throw new UnexpectedNullMatchException('Pattern "' . $pattern . '" had an unexpected unmatched group "' . $group . '", make sure the pattern always matches or use ' . $variantMethod . '() instead.');
}
/** @var array<string> */
return $matches;
}