1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 13:51:54 +01:00

Deprecate FunctionLikeStorage::$unused_docblock_params

Refs vimeo/psalm#3166
This commit is contained in:
Bruce Weirdan 2023-02-15 21:29:20 -04:00
parent 166e678768
commit 01911a06b7
No known key found for this signature in database
GPG Key ID: CFC3AAB181751B0D
3 changed files with 15 additions and 2 deletions

View File

@ -361,8 +361,8 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer
$context->external_mutation_free = true; $context->external_mutation_free = true;
} }
if ($storage->unused_docblock_params) { if ($storage->has_undertyped_native_parameters) {
foreach ($storage->unused_docblock_params as $param_name => $param_location) { foreach ($storage->unused_docblock_parameters as $param_name => $param_location) {
IssueBuffer::maybeAdd( IssueBuffer::maybeAdd(
new InvalidDocblockParamName( new InvalidDocblockParamName(
'Incorrect param name $' . $param_name . ' in docblock for ' . $cased_method_id, 'Incorrect param name $' . $param_name . ' in docblock for ' . $cased_method_id,

View File

@ -908,8 +908,12 @@ class FunctionLikeDocblockScanner
); );
if ($params_without_docblock_type) { if ($params_without_docblock_type) {
/** @psalm-suppress DeprecatedProperty remove in Psalm 6 */
$storage->unused_docblock_params = $unused_docblock_params; $storage->unused_docblock_params = $unused_docblock_params;
} }
$storage->has_undertyped_native_parameters = $params_without_docblock_type !== [];
$storage->unused_docblock_parameters = $unused_docblock_params;
} }
/** /**

View File

@ -172,10 +172,19 @@ abstract class FunctionLikeStorage implements HasAttributesInterface
public $return_type_description; public $return_type_description;
/** /**
* @psalm-suppress PossiblyUnusedProperty
* @var array<string, CodeLocation>|null * @var array<string, CodeLocation>|null
* @deprecated will be removed in Psalm 6. use {@see FunctionLikeStorage::$unused_docblock_parameters} instead
*/ */
public $unused_docblock_params; public $unused_docblock_params;
/**
* @var array<string, CodeLocation>
*/
public array $unused_docblock_parameters = [];
public bool $has_undertyped_native_parameters = false;
/** /**
* @var bool * @var bool
*/ */