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
Namespace
Composer\Pcre\PHPStanCode
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);
});
}