Skip to content

Commit

Permalink
Suppress BC issues
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Dec 3, 2022
1 parent 3b306f2 commit a530027
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Hooks/TestCaseHandler.php
Expand Up @@ -169,10 +169,15 @@ public static function afterStatementAnalysis(AfterClassLikeAnalysisEvent $event

foreach ($specials['dataProvider'] as $line => $provider) {
try {
// for older Psalm versions
/**
* @psalm-suppress InvalidClone
* @var CodeLocation
*/
$provider_docblock_location = clone $method_storage->location;
/** @psalm-suppress UnusedMethodCall */
$provider_docblock_location->setCommentLine($line);
} catch (Error $e) {
/** @var CodeLocation */
$provider_docblock_location = $method_storage->location->setCommentLine($line);
}

Expand Down Expand Up @@ -338,11 +343,18 @@ static function (
$provider_docblock_location
): void {
if ($is_optional) {
/** @psalm-suppress RedundantCondition */
if (method_exists($param_type, 'setPossiblyUndefined')) {
/** @var Union */
$param_type = $param_type->setPossiblyUndefined(true);
} else {
// for older Psalm versions
/**
* @psalm-suppress InvalidClone
* @var Union
*/
$param_type = clone $param_type;
/** @psalm-suppress InaccessibleProperty */
$param_type->possibly_undefined = true;
}
}
Expand Down

0 comments on commit a530027

Please sign in to comment.