Skip to content

Commit

Permalink
Merge pull request #125 from Nicelocal/master
Browse files Browse the repository at this point in the history
Dumb version detection
  • Loading branch information
orklah committed Nov 3, 2022
2 parents 6d93259 + 1b62fa7 commit b7aabc4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Hooks/TestCaseHandler.php
Expand Up @@ -4,6 +4,7 @@

namespace Psalm\PhpUnitPlugin\Hooks;

use Error;
use PhpParser\Comment\Doc;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\ClassMethod;
Expand Down Expand Up @@ -167,10 +168,10 @@ public static function afterStatementAnalysis(AfterClassLikeAnalysisEvent $event
}

foreach ($specials['dataProvider'] as $line => $provider) {
if (VersionUtils::packageVersionIs('vimeo/psalm', '<=', '4.99')) {
try {
$provider_docblock_location = clone $method_storage->location;
$provider_docblock_location->setCommentLine($line);
} else {
} catch (Error $_) {
/** @var CodeLocation */
$provider_docblock_location = $method_storage->location->setCommentLine($line);
}
Expand Down Expand Up @@ -337,12 +338,12 @@ static function (
$provider_docblock_location
): void {
if ($is_optional) {
if (VersionUtils::packageVersionIs('vimeo/psalm', '<=', '4.99')) {
$param_type = clone $param_type;
$param_type->possibly_undefined = true;
} else {
if (method_exists($param_type, 'setPossiblyUndefined')) {
/** @var Union */
$param_type = $param_type->setPossiblyUndefined(true);
} else {
$param_type = clone $param_type;
$param_type->possibly_undefined = true;
}
}
if ($codebase->isTypeContainedByType($potential_argument_type, $param_type)) {
Expand Down

0 comments on commit b7aabc4

Please sign in to comment.