Skip to content
Permalink
Browse files

add psalm config attribute re: #1804 (#1936)

* add psalm config attribute for controlling the default inclusion of php & php extension version info in the error baseline

* using method recommended by @bdsl in #1936 (comment)
  • Loading branch information...
SignpostMarv authored and muglug committed Jul 12, 2019
1 parent 12eeb8b commit 9ac78b5d10a346fc844fcd1f0943dea3d52da1eb
Showing with 9 additions and 2 deletions.
  1. +1 −0 config.xsd
  2. +6 −0 src/Psalm/Config.php
  3. +2 −2 src/psalm.php
@@ -53,6 +53,7 @@
<xs:attribute name="parseSql" type="xs:string" />
<xs:attribute name="maxStringLength" type="xs:string" />
<xs:attribute name="resolveFromConfigFile" type="xs:string" />
<xs:attribute name="includePhpVersionsInErrorBaseline" type="xs:string" />
</xs:complexType>

<xs:complexType name="ProjectFilesType">
@@ -446,6 +446,11 @@ class Config
/** @var string|null */
public $error_baseline = null;
/**
* @var bool
*/
public $include_php_versions_in_error_baseline = false;
/** @var string */
public $shepherd_host = 'shepherd.dev';
@@ -673,6 +678,7 @@ private static function fromXmlAndPaths(string $base_dir, string $file_contents,
'forbidEcho' => 'forbid_echo',
'ignoreInternalFunctionFalseReturn' => 'ignore_internal_falsable_issues',
'ignoreInternalFunctionNullReturn' => 'ignore_internal_nullable_issues',
'includePhpVersionsInErrorBaseline' => 'include_php_versions_in_error_baseline',
];
foreach ($booleanAttributes as $xmlName => $internalName) {
@@ -533,7 +533,7 @@ function ($arg) {
new \Psalm\Internal\Provider\FileProvider,
$options['set-baseline'],
IssueBuffer::getIssuesData(),
isset($options['include-php-versions'])
$config->include_php_versions_in_error_baseline || isset($options['include-php-versions'])
);
fwrite(STDERR, "Baseline saved to {$options['set-baseline']}.");
@@ -599,7 +599,7 @@ function ($arg) {
new \Psalm\Internal\Provider\FileProvider,
$baselineFile,
IssueBuffer::getIssuesData(),
isset($options['include-php-versions'])
$config->include_php_versions_in_error_baseline || isset($options['include-php-versions'])
);
$total_issues_updated_baseline = ErrorBaseline::countTotalIssues($issue_baseline);

0 comments on commit 9ac78b5

Please sign in to comment.
You can’t perform that action at this time.