1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Use IssueBuffer::maybeAdd() instead of throwing

This commit is contained in:
Markus Staab 2024-02-13 09:11:11 +01:00
parent c3526b4463
commit f5fb9498de
2 changed files with 13 additions and 3 deletions

View File

@ -239,7 +239,12 @@ final class FunctionLikeDocblockParser
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,
),
);
}
}
}
@ -282,7 +287,12 @@ final class FunctionLikeDocblockParser
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'])) {

View File

@ -759,7 +759,7 @@ class ConditionalReturnTypeTest extends TestCase
* @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