You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ All options do the same, the only difference is that the static class and trait
48
48
49
49
The [`AssociativeArray` constraint](https://github.com/PhrozenByte/phpunit-array-asserts/blob/master/src/Constraint/AssociativeArray.php) asserts that a value is an associative array matching a given structure and that the array's items pass other constraints.
50
50
51
-
Any native array and `ArrayAccess` object is considered an associative array, no matter which keys they use. However, the array's items are applied to the matching constraint (parameter `$consotraints`). By default, missing items will fail the constraint (parameter `$allowMissing`, defaults to `false`). Additional items will be ignored by default (parameter `$allowAdditional`, defaults to `true`). If you want the constraint to fail when additional items exist, set this option to `true`, however, please note that this works for native arrays only. The expected keys and constraints to apply, as well as whether missing and/or additional items should fail the constraint, are passed in the constructor.
51
+
Any native array and `ArrayAccess` object is considered an associative array, no matter which keys they use. However, the array's items are applied to the matching constraint (parameter `$consotraints`). By default, missing items will fail the constraint (parameter `$allowMissing`, defaults to `false`). Additional items will be ignored by default (parameter `$allowAdditional`, defaults to `true`). If you want the constraint to fail when additional items exist, set this option to `true`, however, please note that this works for native arrays only. The expected keys and constraints to apply, as well as whether missing and/or additional items should fail the constraint, are passed in the constructor. Constraints can either be arbitrary `Constraint` instances (e.g. `PHPUnit\Framework\Constraint\StringContains`), or any static value, requiring exact matches of the values.
52
52
53
53
The `ArrayAssertsTrait` trait exposes two public methods for the `AssociativeArray` constraint: Use `ArrayAssertsTrait::assertAssociativeArray()` to perform an assertion, and `ArrayAssertsTrait::associativeArray()` to create a new instance of the `AssociativeArray` constraint.
54
54
@@ -57,10 +57,10 @@ The `ArrayAssertsTrait` trait exposes two public methods for the `AssociativeArr
57
57
```php
58
58
// using `\PhrozenByte\PHPUnitArrayAsserts\ArrayAssertsTrait` trait
59
59
ArrayAssertsTrait::assertAssociativeArray(
60
-
array $constraints, // an associative array with the expected keys and constraints to apply
60
+
array $constraints, // an array with the expected keys and constraints to apply
61
61
array|ArrayAccess $array, // the associative array to check
62
-
bool $allowMissing = false, // whether missing items should fail the constraint
63
-
bool $allowAdditional = true, // whether additional items should fail the constraint
0 commit comments