Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-worman committed Dec 31, 2022
1 parent ef1264b commit 94ceef6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 2 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

- [BC] The `TDependentListKey` type was removed and replaced with an optional property of the `TIntRange` type.

- [BC] Configuration: `findUnusedCode`'s default value changed from `false` to `true`.

# Upgrading from Psalm 4 to Psalm 5
## Changed

Expand Down
1 change: 1 addition & 0 deletions config.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<xs:attribute name="checkForThrowsInGlobalScope" type="xs:boolean" default="false" />
<xs:attribute name="ensureArrayIntOffsetsExist" type="xs:boolean" default="false" />
<xs:attribute name="ensureArrayStringOffsetsExist" type="xs:boolean" default="false" />
<!-- TODO: Psalm 6 - change default to true -->
<xs:attribute name="findUnusedCode" type="xs:boolean" default="false" />
<xs:attribute name="findUnusedVariablesAndParams" type="xs:boolean" default="false" />
<xs:attribute name="findUnusedPsalmSuppress" type="xs:boolean" default="false" />
Expand Down
9 changes: 1 addition & 8 deletions src/Psalm/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
use function class_exists;
use function clearstatcache;
use function count;
use function defined;
use function dirname;
use function explode;
use function extension_loaded;
Expand All @@ -70,7 +69,6 @@
use function filetype;
use function flock;
use function fopen;
use function fwrite;
use function get_class;
use function get_defined_constants;
use function get_defined_functions;
Expand Down Expand Up @@ -124,7 +122,6 @@
use const PHP_VERSION_ID;
use const PSALM_VERSION;
use const SCANDIR_SORT_NONE;
use const STDERR;

/**
* @psalm-suppress PropertyNotSetInConstructor
Expand Down Expand Up @@ -444,7 +441,7 @@ class Config
public $forbidden_functions = [];

/**
* TODO: Psalm 6: Update default to be true and remove warning.
* TODO: Psalm 6: Update default to be true
*
* @var bool
*/
Expand Down Expand Up @@ -1090,14 +1087,10 @@ private static function fromXmlAndPaths(
$config->use_igbinary = version_compare($igbinary_version, '2.0.5') >= 0;
}


if (isset($config_xml['findUnusedCode'])) {
$attribute_text = (string) $config_xml['findUnusedCode'];
$config->find_unused_code = $attribute_text === 'true' || $attribute_text === '1';
$config->find_unused_variables = $config->find_unused_code;
} elseif (!defined('__IS_TEST_ENV__')) {
fwrite(STDERR, 'Warning: "findUnusedCode" will be defaulted to "true" in Psalm 6. You should explicitly'
. ' enable or disable this setting.' . PHP_EOL);
}

if (isset($config_xml['findUnusedVariablesAndParams'])) {
Expand Down

0 comments on commit 94ceef6

Please sign in to comment.