- Guide
- Playground
- GitHub
-
Ecosystem
Help
Resource Lists
Recent Posts
- What's new in Infection 0.26.0
- What's new in Infection 0.25.0
- What's new in Infection 0.24.0
- What's new in Infection 0.23.0
- What's new in Infection 0.21.0
- What's new in Infection 0.20.0
- What's new in Infection 0.19.0
- What's new in Infection 0.18.0
- What's new in Infection 0.17.0
- What's new in Infection 0.16.0
What's new in Infection 0.20.0
Nov 1, 2020
Release: https://github.com/infection/infection/releases/tag/0.20.0
New features and enhancements
Github Annotations logger π
This logger is supposed to be used only with GitHub Actions. It prints GitHub Annotation warnings for escaped Mutants right in the Pull Request:

Usage (look at the real example how Infection uses it itself):
# this is needed on GitHub Actions to fetch the base branch to make a diff |
Read below why you may need to use
--git-diff-filteroption
Itβs also possible to configure this logger in infection.json file. Results will be printed to stdout:
{ |
--git-diff-filter option
Allows filtering files to mutate by using git diff with --diff-filter option. Sensible values are: AM - added and modified files. A - only added files.
Best to be used during pull request builds on CI, e.g. with GitHub Actions, Travis CI and so on.
Usage:
# this is needed on GitHub Actions to fetch the base branch to make a diff |
This command will mutate only those files, that were added in the Pull Request. The diff is done between the current branch and the base branch.
Itβs possible to configure the base branch, see
--git-diff-baseoption
--git-diff-base option
Supposed to be used only with --git-diff-filter option. Configures the base branch for git diff command.
Usage:
# this is needed on GitHub Actions to fetch the base branch to make a diff |
New Mutators
Ternary mutator
This mutator mutates a ternary operator:
- isset($b) ? 'B' : 'C'; |
$foo = 'foo'; |
Coalesce mutator
Mutates:
$foo = 'foo'; |
Or more complex case with nested values:
$foo = 'foo'; |
UnwrapSubstr mutator
- $x = substr('abcde', 0, -1); |
UnwrapStrRev mutator
- $x = strrev('Hello!'); |
UnwrapLtrim mutator
- $x = ltrim(' Hello!'); |
UnwrapRtrim mutator
- $x = rtrim('Hello! '); |
UnwrapStrIreplace mutator
- $x = str_ireplace('%body%', 'black', '<body text=%BODY%>'); |
UnwrapStrShuffle mutator
- $x = str_shuffle('Hello!'); |
Enjoy!