Skip to content

Commit

Permalink
Merge pull request #9915 from kkmuffme/fix-psalm-6-warning-findUnused…
Browse files Browse the repository at this point in the history
…Code

fix CI warnings for findUnusedCode in psalm 6
  • Loading branch information
orklah committed Jun 13, 2023
2 parents 2c50745 + 51fd63c commit 49c6f31
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Psalm/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ private static function fromXmlAndPaths(
}

if (!isset($config_xml['findUnusedBaselineEntry'])) {
$config->config_warnings[] = '"findUnusedBaselineEntry" will be defaulted to "true" in Psalm 6.'
$config->config_warnings[] = '"findUnusedBaselineEntry" will default to "true" in Psalm 6.'
. ' You should explicitly enable or disable this setting.';
}

Expand All @@ -1210,7 +1210,7 @@ private static function fromXmlAndPaths(
$config->find_unused_code = $attribute_text === 'true' || $attribute_text === '1';
$config->find_unused_variables = $config->find_unused_code;
} else {
$config->config_warnings[] = '"findUnusedCode" will be defaulted to "true" in Psalm 6.'
$config->config_warnings[] = '"findUnusedCode" will default to "true" in Psalm 6.'
. ' You should explicitly enable or disable this setting.';
}

Expand Down
2 changes: 1 addition & 1 deletion tests/EndToEnd/PsalmEndToEndTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function testPsalmWithNoProgressDoesNotProduceOutputOnStderr(): void
$this->runPsalmInit();

$psalmXml = file_get_contents(self::$tmpDir . '/psalm.xml');
$psalmXml = preg_replace('/findUnusedCode="(true|false)"/', '', $psalmXml);
$psalmXml = preg_replace('/findUnusedCode="(true|false)"/', '', $psalmXml, 1);
file_put_contents(self::$tmpDir . '/psalm.xml', $psalmXml);

$result = $this->runPsalm(['--no-progress'], self::$tmpDir);
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/DestructiveAutoloader/psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<psalm
autoloader="autoloader.php"
resolveFromConfigFile="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/DummyProject/psalm.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<psalm
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/ModularConfig/psalm.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<psalm
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/SuicidalAutoloader/psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<psalm
autoloader="autoloader.php"
resolveFromConfigFile="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down

0 comments on commit 49c6f31

Please sign in to comment.