What's new in Infection 0.12.0

Jan 24, 2019

Release: https://github.com/infection/infection/releases/tag/0.12.0

BC Breaks

TrueValue mutator does not mutate the 3rd parameter true in the following functions anymore:

New features and enhancements

Settings for Mutators

We’ve added an ability to configure Mutators in infection.json file. For example, TrueValue Mutator can be explicitly enabled for in_array and array_search functions:

{
"mutators": {
"TrueValue": {
"settings": {
"in_array": true, // default is `false`
"array_search": true // default is `false`
}
}
}
}

symfony/phpunit-bridge support

Previously, Infection didn’t recognize simple-phpunit executable, failing with an error. Now it works as expected when bridge is used separately or as part of symfony/flex installation.

Logging

Running command with --only-covered now logs only covered code mutations, making it easier to analyze results.

New Mutators

array_splice

This mutator takes the first argument of array_splice() function and assigns it to the variable, removing the function call.

- $a = array_splice(['A', 'B', 'C'], 1);
+ $a = ['A', 'B', 'C'];

array_slice

- $a = array_slice(['A', 'B', 'C'], 1);
+ $a = ['A', 'B', 'C'];

array_change_key_case

- $a = array_change_key_case(['foo' => 'bar']);
+ $a = ['foo' => 'bar];

array_column

- $a = array_column([['foo' => 'bar]], 'foo');
+ $a = [['foo' => 'bar]];

array_diff_key

- $a = array_diff_key(['foo' => 'bar'], ['baz' => 'bar]);
+ $a = ['foo' => 'bar];

array_diff_ukey

- $a = array_diff_ukey(['foo' => 'bar'], ['baz' => 'bar], $callable);
+ $a = ['foo' => 'bar];

array_diff_assoc

- $a = array_diff_assoc(['foo' => 'bar'], ['baz' => 'bar]);
+ $a = ['foo' => 'bar];

array_diff_uassoc

- $a = array_diff_assoc(['foo' => 'bar'], ['baz' => 'bar], $callback);
+ $a = ['foo' => 'bar];

array_intersect_ukey

- $a = array_intersect_ukey(['foo' => 'bar'], ['bar' => 'baz']);
+ $a = ['foo' => 'bar'];

array_intersect_key

- $a = array_intersect_key(['foo' => 'bar'], ['bar' => 'baz']);
+ $a = ['foo' => 'bar'];

array_intersect_uassoc

- $a = array_intersect_uassoc(['foo' => 'bar'], ['bar' => 'baz']);
+ $a = ['foo' => 'bar'];

array_merge_recursive

- $a = array_merge_recursive(['A', 'B', 'C'], ['D']);
+ $a = ['A', 'B', 'C'];

array_udiff_assoc

- $a = array_udiff_assoc(['foo' => 'bar'], ['baz' => 'bar], $callback);
+ $a = ['foo' => 'bar'];

Enjoy!

Star