PHPackages                             phpstan/mutant-killer-infection-runner - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. phpstan/mutant-killer-infection-runner

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

phpstan/mutant-killer-infection-runner
======================================

Static analysis on top of mutation testing - prevents escaped mutants from being invalid according to static analysis

1.0.x-dev(11mo ago)13516MITPHPPHP ~8.2.0 || ~8.3.0 || ~8.4.0CI passing

Since May 21Pushed 11mo agoCompare

[ Source](https://github.com/phpstan/mutant-killer-infection-runner)[ Packagist](https://packagist.org/packages/phpstan/mutant-killer-infection-runner)[ RSS](/packages/phpstan-mutant-killer-infection-runner/feed)WikiDiscussions 1.0.x Synced 1mo ago

READMEChangelogDependencies (8)Versions (1)Used By (0)

Infection Static Analysis Plugin
================================

[](#infection-static-analysis-plugin)

This plugin is designed to run static analysis on top of [`infection/infection`](https://github.com/infection/infection)test runs in order to discover if [escaped mutants](https://en.wikipedia.org/wiki/Mutation_testing)are valid mutations, or if they do not respect the type signature of your program. If the mutation would result in a type error, it is "killed".

TL;DR:

- This will improve your mutation score, since mutations which result in type errors become killed.
- This is very hacky, and replaces `vendor/bin/infection` essentially. Please read the `Stability` section below first for details.
- This is currently much slower than running infection by itself. There are ideas/suggestions to improve this in the future.

This plugin is a fork of excellent [Roave/infection-static-analysis-plugin](https://github.com/Roave/infection-static-analysis-plugin) and uses [PHPStan](https://phpstan.org/) instead of [Psalm](https://psalm.dev/).

Usage
-----

[](#usage)

The current design of this tool requires you to run `vendor/bin/phpstan-mutant-killer-infection-runner`instead of running `vendor/bin/infection`:

```
composer require --dev phpstan/mutant-killer-infection-runner

vendor/bin/phpstan-mutant-killer-infection-runner
```

### Configuration

[](#configuration)

The `phpstan-mutant-killer-infection-runner` binary accepts all of `infection` flags and arguments, and an additional `--phpstan-config` argument.

Using `--phpstan-config`, you can specify the [PHPStan configuration file](https://phpstan.org/config-reference) to use when analysing the generated mutations:

```
vendor/bin/roave-infection-static-analysis-plugin --phpstan-config phpstan.neon
```

Background
----------

[](#background)

If you come from a statically typed language with AoT compilers, you may be confused about the scope of this project, but in the PHP ecosystem, producing runnable code that does not respect the type system is very easy, and mutation testing tools do this all the time.

Take for example following snippet:

```
/**
 * @template T
 * @param array $values
 * @return list
 */
function makeAList(array $values): array
{
    return array_values($values);
}
```

Given a valid test as follows:

```
function test_makes_a_list(): void
{
    $list = makeAList(['a' => 'b', 'c' => 'd']);

    assert(count($list) === 2);
    assert(in_array('b', $list, true));
    assert(in_array('d', $list, true));
}
```

The mutation testing framework will produce following mutation, since we failed to verify the output in a more precise way:

```
/**
 * @template T
 * @param array $values
 * @return list
 */
function makeAList(array $values): array
{
-    return array_values($values);
+    return $values;
}
```

The code above is valid PHP, but not valid according to our type declarations. While we can indeed write a test for this, such test would probably be unnecessary, as existing type checkers can detect that our actual return value is no longer a `list`, but a map of `array`, which is in conflict with what we declared.

This plugin detects such mutations, and prevents them from making you write unnecessary tests, leveraging the full power of [PHPStan](https://phpstan.org/).

Stability
---------

[](#stability)

Since [`infection/infection`](https://github.com/infection/infection) is not yet designed to support plugins, this tool uses a very aggressive approach to bootstrap itself, and relies on internal details of the underlying runner.

To prevent compatibility issues, it therefore always pins to a very specific version of `infection/infection`, so please be patient when you wish to use the latest and greatest version of `infection/infection`, as we may still be catching up to it.

Eventually, we will contribute patches to `infection/infection` so that there is a proper way to design and use plugins, without the need for dirty hacks.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance50

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

354d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/258cf2d2422f7e9ac5f7e1bb7a331f3fb717a11e51de7a3de2d6025507bd63cf?d=identicon)[ondrejmirtes](/maintainers/ondrejmirtes)

---

Top Contributors

[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (383 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (267 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (183 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (170 commits)")[![Ocramius](https://avatars.githubusercontent.com/u/154256?v=4)](https://github.com/Ocramius "Ocramius (120 commits)")[![ondrejmirtes](https://avatars.githubusercontent.com/u/104888?v=4)](https://github.com/ondrejmirtes "ondrejmirtes (19 commits)")[![alexander-schranz](https://avatars.githubusercontent.com/u/1698337?v=4)](https://github.com/alexander-schranz "alexander-schranz (7 commits)")[![azjezz](https://avatars.githubusercontent.com/u/29315886?v=4)](https://github.com/azjezz "azjezz (7 commits)")[![kukulich](https://avatars.githubusercontent.com/u/260445?v=4)](https://github.com/kukulich "kukulich (7 commits)")[![fezfez](https://avatars.githubusercontent.com/u/1162307?v=4)](https://github.com/fezfez "fezfez (4 commits)")[![samdark](https://avatars.githubusercontent.com/u/47294?v=4)](https://github.com/samdark "samdark (3 commits)")[![pamil](https://avatars.githubusercontent.com/u/1897953?v=4)](https://github.com/pamil "pamil (3 commits)")[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (1 commits)")[![asgrim](https://avatars.githubusercontent.com/u/496145?v=4)](https://github.com/asgrim "asgrim (1 commits)")[![jdrieghe](https://avatars.githubusercontent.com/u/12606789?v=4)](https://github.com/jdrieghe "jdrieghe (1 commits)")[![simPod](https://avatars.githubusercontent.com/u/327717?v=4)](https://github.com/simPod "simPod (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phpstan-mutant-killer-infection-runner/health.svg)

```
[![Health](https://phpackages.com/badges/phpstan-mutant-killer-infection-runner/health.svg)](https://phpackages.com/packages/phpstan-mutant-killer-infection-runner)
```

###  Alternatives

[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpstan/phpstan-symfony

Symfony Framework extensions and rules for PHPStan

78268.9M1.5k](/packages/phpstan-phpstan-symfony)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
