Skip to content

Commit c87a4b5

Browse files
committed
Added infection-config script
1 parent 54ac95d commit c87a4b5

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

bin/infection-config.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env php
2+
<?php declare(strict_types = 1);
3+
4+
$opts = getopt('', ['mutator-class:']);
5+
if (!$opts) {
6+
echo "Usage: php ". $argv[0] ." --mutator-class='Infection\Mutator\Removal\MethodCallRemoval'\n";
7+
exit(1);
8+
}
9+
10+
$decoded = json_decode(file_get_contents(__DIR__.'/../resources/infection.json5'));
11+
foreach($opts['mutator-class'] as $mutatorclass) {
12+
$decoded->mutators->$mutatorclass = true;
13+
}
14+
15+
echo json_encode($decoded);
16+
17+
exit(0);

resources/infection.json5

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "vendor/infection/infection/resources/schema.json",
3+
"timeout": 30,
4+
"source": {
5+
"directories": [
6+
"src"
7+
]
8+
},
9+
"staticAnalysisTool": "phpstan",
10+
"logs": {
11+
"text": "tmp/infection.log"
12+
},
13+
"mutators": {
14+
"@default": false
15+
}
16+
}

0 commit comments

Comments
 (0)