Skip to content

Commit

Permalink
Merge pull request #9312 from weirdan/deprecate-functionlikestorage-u…
Browse files Browse the repository at this point in the history
…nused_docblock_params
  • Loading branch information
weirdan committed Feb 16, 2023
2 parents 166e678 + 01911a0 commit 33f18e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
Expand Up @@ -361,8 +361,8 @@ public function analyze(
$context->external_mutation_free = true;
}

if ($storage->unused_docblock_params) {
foreach ($storage->unused_docblock_params as $param_name => $param_location) {
if ($storage->has_undertyped_native_parameters) {
foreach ($storage->unused_docblock_parameters as $param_name => $param_location) {
IssueBuffer::maybeAdd(
new InvalidDocblockParamName(
'Incorrect param name $' . $param_name . ' in docblock for ' . $cased_method_id,
Expand Down
Expand Up @@ -908,8 +908,12 @@ private static function improveParamsFromDocblock(
);

if ($params_without_docblock_type) {
/** @psalm-suppress DeprecatedProperty remove in Psalm 6 */
$storage->unused_docblock_params = $unused_docblock_params;
}

$storage->has_undertyped_native_parameters = $params_without_docblock_type !== [];
$storage->unused_docblock_parameters = $unused_docblock_params;
}

/**
Expand Down
9 changes: 9 additions & 0 deletions src/Psalm/Storage/FunctionLikeStorage.php
Expand Up @@ -172,10 +172,19 @@ abstract class FunctionLikeStorage implements HasAttributesInterface
public $return_type_description;

/**
* @psalm-suppress PossiblyUnusedProperty
* @var array<string, CodeLocation>|null
* @deprecated will be removed in Psalm 6. use {@see FunctionLikeStorage::$unused_docblock_parameters} instead
*/
public $unused_docblock_params;

/**
* @var array<string, CodeLocation>
*/
public array $unused_docblock_parameters = [];

public bool $has_undertyped_native_parameters = false;

/**
* @var bool
*/
Expand Down

0 comments on commit 33f18e8

Please sign in to comment.