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

Breadcrumb

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

function PregMatchFlags::removeNullFromMatches

1 call to PregMatchFlags::removeNullFromMatches()
PregMatchTypeSpecifyingExtension::specifyTypes in vendor/composer/pcre/src/PHPStan/PregMatchTypeSpecifyingExtension.php

File

vendor/composer/pcre/src/PHPStan/PregMatchFlags.php, line 43

Class

PregMatchFlags

Namespace

Composer\Pcre\PHPStan

Code

public static function removeNullFromMatches(Type $matchesType) : Type {
    return TypeTraverser::map($matchesType, static function (Type $type, callable $traverse) : Type {
        if ($type instanceof UnionType || $type instanceof IntersectionType) {
            return $traverse($type);
        }
        if ($type instanceof ConstantArrayType) {
            return new ConstantArrayType($type->getKeyTypes(), array_map(static function (Type $valueType) use ($traverse) : Type {
                return $traverse($valueType);
            }, $type->getValueTypes()), $type->getNextAutoIndexes(), [], $type->isList());
        }
        if ($type instanceof ArrayType) {
            return new ArrayType($type->getKeyType(), $traverse($type->getItemType()));
        }
        return TypeCombinator::removeNull($type);
    });
}
RSS feed
Powered by Drupal