Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate FunctionLikeStorage::$unused_docblock_params #9312

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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