diff --git a/README.md b/README.md
index d289d39..e83e002 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,11 @@ composer require --dev roave/infection-static-analysis-plugin
vendor/bin/roave-infection-static-analysis-plugin
```
+Do not use this tool if your project has a
+[Psalm baseline](https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file) file. In that
+case issues that are ignored due to being present in the baseline will be reported as killed, spuriously inflating your
+mutation score indicator. See [issue #484](https://github.com/Roave/infection-static-analysis-plugin/issues/484).
+
### Configuration
The `roave-infection-static-analysis-plugin` binary accepts all of `infection` flags and arguments, and an additional `--psalm-config` argument.
diff --git a/bin/roave-infection-static-analysis-plugin b/bin/roave-infection-static-analysis-plugin
index 5fda677..ff680e7 100755
--- a/bin/roave-infection-static-analysis-plugin
+++ b/bin/roave-infection-static-analysis-plugin
@@ -49,7 +49,7 @@ use function var_export;
));
})();
- require_once $projectPath . '/vendor/autoload.php';
+ require_once __DIR__ . '/../vendor/autoload.php';
if (! defined('PSALM_VERSION')) {
define('PSALM_VERSION', InstalledVersions::getVersion('vimeo/psalm'));
@@ -65,7 +65,7 @@ use function var_export;
RuntimeCaches::clearAll();
- $configuration = $configuration ?? $projectPath;
+ $configuration ??= $projectPath;
if (is_file($configuration)) {
$config = Config::loadFromXMLFile($configuration, $projectPath);
diff --git a/composer.json b/composer.json
index ca99fbf..6bf2b82 100644
--- a/composer.json
+++ b/composer.json
@@ -31,7 +31,10 @@
"autoload-dev": {
"psr-4": {
"Roave\\InfectionStaticAnalysisTest\\": "test/unit/Roave/InfectionStaticAnalysisTest"
- }
+ },
+ "classmap": [
+ "test/asset/ProjectWithPsalmBaseline/src/HelloWorld.php"
+ ]
},
"config": {
"allow-plugins": {
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index 7d7578d..b4d9cd5 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -13,6 +13,7 @@
src
test
+ test/asset/ProjectWithPsalmBaseline
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index e59d8ed..4d31092 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,7 +1,7 @@
-
+
-
+
+
+
+
-
+
-
+
+
-
+
-
+
diff --git a/src/Roave/InfectionStaticAnalysis/CliUtility.php b/src/Roave/InfectionStaticAnalysis/CliUtility.php
index b6a8b90..c5c041a 100644
--- a/src/Roave/InfectionStaticAnalysis/CliUtility.php
+++ b/src/Roave/InfectionStaticAnalysis/CliUtility.php
@@ -12,12 +12,8 @@
use function substr;
/** @internal */
-final class CliUtility
+abstract class CliUtility
{
- private function __construct()
- {
- }
-
/**
* @param list $arguments
* @param non-empty-string $argument
diff --git a/test/asset/ProjectWithPsalmBaseline/infection.json5 b/test/asset/ProjectWithPsalmBaseline/infection.json5
new file mode 100644
index 0000000..ca97ca2
--- /dev/null
+++ b/test/asset/ProjectWithPsalmBaseline/infection.json5
@@ -0,0 +1,11 @@
+{
+ "$schema": "vendor/infection/infection/resources/schema.json",
+ "source": {
+ "directories": [
+ "src"
+ ]
+ },
+ "mutators": {
+ "@default": true
+ }
+}
\ No newline at end of file
diff --git a/test/asset/ProjectWithPsalmBaseline/phpunit b/test/asset/ProjectWithPsalmBaseline/phpunit
new file mode 100755
index 0000000..67c63c6
--- /dev/null
+++ b/test/asset/ProjectWithPsalmBaseline/phpunit
@@ -0,0 +1,11 @@
+#!/usr/bin/env php
+
+
+
+
+ tests
+
+
+
+
+
diff --git a/test/asset/ProjectWithPsalmBaseline/psalm-baseline.xml b/test/asset/ProjectWithPsalmBaseline/psalm-baseline.xml
new file mode 100644
index 0000000..b73d400
--- /dev/null
+++ b/test/asset/ProjectWithPsalmBaseline/psalm-baseline.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ $mixture
+
+
+ int
+
+
+ $mixture
+
+
+ $mixture + 2
+
+
+
diff --git a/test/asset/ProjectWithPsalmBaseline/psalm.xml b/test/asset/ProjectWithPsalmBaseline/psalm.xml
new file mode 100644
index 0000000..67bae82
--- /dev/null
+++ b/test/asset/ProjectWithPsalmBaseline/psalm.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/test/asset/ProjectWithPsalmBaseline/src/HelloWorld.php b/test/asset/ProjectWithPsalmBaseline/src/HelloWorld.php
new file mode 100644
index 0000000..86a154b
--- /dev/null
+++ b/test/asset/ProjectWithPsalmBaseline/src/HelloWorld.php
@@ -0,0 +1,19 @@
+takesImplictMixedReturnsIntAndIsCoveredByBaseline(3);
+
+ $this->assertSame(4, 2+2);
+ }
+}
\ No newline at end of file
diff --git a/test/unit/Roave/InfectionStaticAnalysisTest/ProjectWithBaselineTest.php b/test/unit/Roave/InfectionStaticAnalysisTest/ProjectWithBaselineTest.php
new file mode 100644
index 0000000..a08dce4
--- /dev/null
+++ b/test/unit/Roave/InfectionStaticAnalysisTest/ProjectWithBaselineTest.php
@@ -0,0 +1,25 @@
+setWorkingDirectory(__DIR__ . '/../../../asset/ProjectWithPsalmBaseline');
+
+ $process->mustRun();
+
+ $output = $process->getOutput();
+
+ $this->assertSame(0, $process->getExitCode());
+ $this->assertStringContainsString('4 mutants were killed', $output);
+ $this->assertStringContainsString('Mutation Score Indicator (MSI): 100%', $output);
+ }
+}