Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Preg.php

function Preg::enforceNonNullMatchAll

Parameters

array<int|string, list<string|null>> $matches:

Return value

array<int|string, list<string>>

Throws

UnexpectedNullMatchException

1 call to Preg::enforceNonNullMatchAll()
Preg::matchAllStrictGroups in vendor/composer/pcre/src/Preg.php
Variant of `match()` which outputs non-null matches (or throws)

File

vendor/composer/pcre/src/Preg.php, line 417

Class

Preg

Namespace

Composer\Pcre

Code

private static function enforceNonNullMatchAll(string $pattern, array $matches, string $variantMethod) {
    foreach ($matches as $group => $groupMatches) {
        foreach ($groupMatches as $match) {
            if (null === $match) {
                throw new UnexpectedNullMatchException('Pattern "' . $pattern . '" had an unexpected unmatched group "' . $group . '", make sure the pattern always matches or use ' . $variantMethod . '() instead.');
            }
        }
    }
    
    /** @var array<int|string, list<string>> */
    return $matches;
}
RSS feed
Powered by Drupal