What's new in Infection 0.14.0
Sep 20, 2019
Infection now requires PHP 7.2.9+. If you can’t for some reason upgrade, don’t worry, you can still use previous versions.
Most of the work in
0.14.0 was done to improve stability, performance and DX. However, there are a couple of new features and enhancements.
We made an update to dramatically reduce memory usage by using classes instead of object-like arrays. For example, running Infection for Psalm now takes 58% less memory (
5G instead of
Read this blog post to understand why you should prefer classes.
You can now use whatever precision you want in
--covered-min-msi options without rounding.
The minimum required MSI percentage should be 71.43%, but actual is 71.428571428571%. Improve your tests!
Infection already mutates some of the new operators from PHP 7.4, and we added a couple of new mutators for this new syntax.
- $array = [...$collection, 4];
Basically, it removes all elements from
$collection except the first one to ensure your code uses everything from the
$collection and spread operator is really needed here.
- return $collection;
It is similar to the previous one, but works without spread operator. It leaves only one element in the returned array.
0.13.0, we’ve added a new mutator that converts
mb_* functions to usual ones. PHP 7.4 adds new function -
mb_str_split which will be also mutated to
We have removed self-update command and recommend using PHIVE.
phive install infection
When you want to upgrade infection, run
phive update infection
0.14.0, all mutators are validated by our JSON schema. No more incorrect configuration.
Did you know you can significantly speed up code coverage collecting by using xdebug-filter?— Infection PHP (@infection_php) September 10, 2019
With this simple diff, our PHPUnit run is now 30% faster (from 6 to 4 minutes).
Read the blog post by @s_bergmann and @belanur that explains it in details https://t.co/4PWeQrEdIQ pic.twitter.com/8ny2ojLaJT
Our builds are faster now which is a good thing when providing PRs and developing Infection locally.
We recommend you read the mentioned blog post and apply the same approach for your project, or use
pcov for collecting code coverage data.
We have reworked the main entry point of Infection application -
This is how the mutation testing algorithm looks like:
And this is how
InfectionCommand now looks like:
protected function execute(InputInterface $input, OutputInterface $output)
This should help new contributors with understanding the processes inside Infection.
All other enhancements and bugfixes are listed in the changelog: https://github.com/infection/infection/blob/0.14/CHANGELOG.md
We are working really hard to integrate Codeception into Infection. There were major blocker issues and we had to patch Codeception as well to fix them. We really hope to complete the work by
0.15.0 release in the next couple of months.
Currently, Infection is a quite a big project with all the code placed inside one repository. We will definitely split it to several ones.
- First of all, we want to extract all Mutators to a separate package. Read the reasoning here.
- We need to extract Test Framework adapters to separate packages because now it’s not convenient to maintain the code, set package requirements for test framework adapters and update the code (e.g. we can’t say that Infection requires
codeception/codeception: ^3.1.1because not all the users will use Codeception, so it must be a separate package)
Have another great idea? Let us know!