Skip to content

Commit

Permalink
Use IssueBuffer::maybeAdd() instead of throwing
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Feb 13, 2024
1 parent c3526b4 commit f5fb949
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,12 @@ public static function parse(
if (count($param_parts) >= 2) {
$info->taint_sink_params[] = ['name' => $param_parts[1], 'taint' => $param_parts[0]];
} else {
throw new IncorrectDocblockException('@psalm-taint-sink expects 2 arguments');
IssueBuffer::maybeAdd(
new InvalidDocblock(
'@psalm-taint-sink expects 2 arguments',
$code_location,
),
);
}
}
}
Expand Down Expand Up @@ -282,7 +287,12 @@ public static function parse(
if ($param_parts[0]) {
$info->taint_source_types[] = $param_parts[0];
} else {
throw new IncorrectDocblockException('@psalm-taint-source expects 1 argument');
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 html
* @psalm-taint-source input
*/
public function getParams(
string $source = self::SOURCE_GET
Expand Down

0 comments on commit f5fb949

Please sign in to comment.