1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

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 https://github.com/vimeo/psalm/pull/1936#discussion_r302727993
This commit is contained in:
SignpostMarv 2019-07-12 15:31:12 +01:00 committed by Matthew Brown
parent 12eeb8b320
commit 9ac78b5d10
3 changed files with 9 additions and 2 deletions

View File

@ -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">

View File

@ -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 @@ class Config
'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) {

View File

@ -533,7 +533,7 @@ if (isset($options['set-baseline']) && is_string($options['set-baseline'])) {
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 @@ if (isset($options['update-baseline'])) {
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);