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

Report invalid number of arguments for psalm-taint-* #10699

Merged
merged 3 commits into from
Feb 13, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ public static function parse(

if (count($param_parts) >= 2) {
$info->taint_sink_params[] = ['name' => $param_parts[1], 'taint' => $param_parts[0]];
} else {
IssueBuffer::maybeAdd(
new InvalidDocblock(
'@psalm-taint-sink expects 2 arguments',
$code_location,
),
);
}
}
}
Expand Down Expand Up @@ -279,6 +286,13 @@ public static function parse(

if ($param_parts[0]) {
$info->taint_source_types[] = $param_parts[0];
} else {
IssueBuffer::maybeAdd(
new InvalidDocblock(
'@psalm-taint-source expects 1 argument',
$code_location,
),
);
}
}
} elseif (isset($parsed_docblock->tags['return-taint'])) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Template/ConditionalReturnTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ private function getBody() : string {
* @template TSource as self::SOURCE_*
* @param TSource $source
* @return (TSource is "BODY" ? object|list : array)
* @psalm-taint-source
* @psalm-taint-source input
*/
public function getParams(
string $source = self::SOURCE_GET
Expand Down