Back to Validation

Subset

docs/validators/Subset.md

3.1.11.4 KB
Original Source
<!-- SPDX-License-Identifier: MIT SPDX-FileCopyrightText: (c) Respect Project Contributors SPDX-FileContributor: Alexandre Gomes Gaigalas <[email protected]> SPDX-FileContributor: Henrique Moody <[email protected]> SPDX-FileContributor: Singwai Chan <[email protected]> -->

Subset

  • Subset(mixed[] $superset)

Validates whether the input is a subset of a given value.

php
v::subset([1, 2, 3])->assert([1, 2]);
// Validation passes successfully

v::subset([1, 2])->assert([1, 2, 3]);
// → `[1, 2, 3]` must be subset of `[1, 2]`

Templates

Subset::TEMPLATE_STANDARD

ModeTemplate
default{{subject}} must be subset of {{superset}}
inverted{{subject}} must not be subset of {{superset}}

Template placeholders

PlaceholderDescription
subjectThe validated input or the custom validator name (if specified).
superset

Categorization

  • Arrays

Changelog

VersionDescription
2.0.0Created

See Also