|
40 | 40 | * @method static bool allEmail(mixed $value, string|callable $message = null, string $propertyPath = null) Assert that value is an email address (using input_filter/FILTER_VALIDATE_EMAIL) for all values.
|
41 | 41 | * @method static bool allEndsWith(mixed $string, string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string ends with a sequence of chars for all values.
|
42 | 42 | * @method static bool allEq(mixed $value, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are equal (using ==) for all values.
|
| 43 | + * @method static bool allEqArraySubset(mixed $value, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that the array contains the subset for all values. |
43 | 44 | * @method static bool allExtensionLoaded(mixed $value, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded for all values.
|
44 | 45 | * @method static bool allExtensionVersion(string $extension, string $operator, mixed $version, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded and a specific version is installed for all values.
|
45 | 46 | * @method static bool allFalse(mixed $value, string|callable $message = null, string $propertyPath = null) Assert that the value is boolean False for all values.
|
|
127 | 128 | * @method static bool nullOrEmail(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is an email address (using input_filter/FILTER_VALIDATE_EMAIL) or that the value is null.
|
128 | 129 | * @method static bool nullOrEndsWith(mixed|null $string, string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string ends with a sequence of chars or that the value is null.
|
129 | 130 | * @method static bool nullOrEq(mixed|null $value, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are equal (using ==) or that the value is null.
|
| 131 | + * @method static bool nullOrEqArraySubset(mixed|null $value, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that the array contains the subset or that the value is null. |
130 | 132 | * @method static bool nullOrExtensionLoaded(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded or that the value is null.
|
131 | 133 | * @method static bool nullOrExtensionVersion(string|null $extension, string $operator, mixed $version, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded and a specific version is installed or that the value is null.
|
132 | 134 | * @method static bool nullOrFalse(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that the value is boolean False or that the value is null.
|
@@ -309,6 +311,27 @@ public static function eq($value, $value2, $message = null, $propertyPath = null
|
309 | 311 | return true;
|
310 | 312 | }
|
311 | 313 |
|
| 314 | + /** |
| 315 | + * Assert that the array contains the subset. |
| 316 | + * |
| 317 | + * @param mixed $value |
| 318 | + * @param mixed $value2 |
| 319 | + * @param string|callable|null $message |
| 320 | + * @param string|null $propertyPath |
| 321 | + * |
| 322 | + * @return bool |
| 323 | + */ |
| 324 | + public static function eqArraySubset($value, $value2, $message = null, $propertyPath = null) |
| 325 | + { |
| 326 | + static::isArray($value, $message, $propertyPath); |
| 327 | + static::isArray($value2, $message, $propertyPath); |
| 328 | + |
| 329 | + $patched = \array_replace_recursive($value, $value2); |
| 330 | + static::eq($patched, $value, $message, $propertyPath); |
| 331 | + |
| 332 | + return true; |
| 333 | + } |
| 334 | + |
312 | 335 | /**
|
313 | 336 | * Assert that two values are the same (using ===).
|
314 | 337 | *
|
|
0 commit comments