diff --git a/src/Psalm/Internal/Analyzer/TaintNodeData.php b/src/Psalm/Internal/Analyzer/ControlFlowNodeData.php similarity index 100% rename from src/Psalm/Internal/Analyzer/TaintNodeData.php rename to src/Psalm/Internal/Analyzer/ControlFlowNodeData.php diff --git a/tests/EndToEnd/PsalmEndToEndTest.php b/tests/EndToEnd/PsalmEndToEndTest.php index 93345f514..a4faba44b 100644 --- a/tests/EndToEnd/PsalmEndToEndTest.php +++ b/tests/EndToEnd/PsalmEndToEndTest.php @@ -1,23 +1,26 @@ assertStringStartsWith('Calculating best config level based on project files', $this->runPsalmInit()['STDOUT']); + $this->assertStringStartsWith( + 'Calculating best config level based on project files', + $this->runPsalmInit()['STDOUT'] + ); $this->assertFileExists(self::$tmpDir . '/psalm.xml'); } @@ -146,6 +155,16 @@ class PsalmEndToEndTest extends TestCase @unlink(self::$tmpDir . '/composer.lock'); } + public function testTainting(): void + { + $this->runPsalmInit(1); + $result = $this->runPsalm(['--taint-analysis'], self::$tmpDir, true); + + $this->assertStringContainsString('TaintedInput', $result['STDOUT']); + $this->assertStringContainsString('1 errors', $result['STDOUT']); + $this->assertSame(1, $result['CODE']); + } + public function testLegacyConfigWithoutresolveFromConfigFile(): void { $this->runPsalmInit(1); diff --git a/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php b/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php index 26ab105d1..a5c5c11c8 100644 --- a/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php +++ b/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php @@ -21,3 +21,8 @@ function bat(string $s) : string { function bang(string $s) : string { return $s; } + +function boom(): void +{ + echo (string) ($_GET['abc'] ?? 'z'); +}