diff --git a/src/guide/mutators.md b/src/guide/mutators.md index a116f46f..774e0acc 100644 --- a/src/guide/mutators.md +++ b/src/guide/mutators.md @@ -212,9 +212,40 @@ infection.json: | Name | Original | Mutated | | :------: | :------: |:-------:| +| ArrayItemRemoval | `[1, $a, '3']` | `[$a, '3']` *depending on configuration* | FunctionCallRemoval | foo_bar($a) | - | MethodCallRemoval | $this->method($var) | - +#### `ArrayItemRemoval` + +Configuration options: + +* `remove: first`: defines the way the mutator operates. Could be: + - `first` - remove only first element from each array + - `last` - remove only last element from each array + - `all` - remove every element one by one from each array resulting in as many mutations as total number of items in arrays. +* `limit: PHP_INT_MAX`: when `remove = all` specifies maximum number of elements that will be removed form array. Only elements at the beginning will be mutated. + +> When using `all` option we advise to set the limit as well + +> You should remember to exclude files containing large arrays (like configuration) +> when using `ArrayItemRemoval` mutator in `all` mode + +infection.json: + +```json +{ + "mutators": { + "ArrayItemRemoval": { + "settings": { + "remove": "all", + "limit": 15 + } + } + } +} +``` + ### Loop | Name | Original | Mutated | diff --git a/src/guide/profiles.md b/src/guide/profiles.md index 6357cf94..8dda909d 100644 --- a/src/guide/profiles.md +++ b/src/guide/profiles.md @@ -170,6 +170,7 @@ Contains the following mutators: Contains the following mutators: +* [ArrayItemRemoval](/guide/mutators.html#Removal) * [FunctionCallRemoval](/guide/mutators.html#Removal) * [MethodCallRemoval](/guide/mutators.html#Removal)