Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Rules/PHPUnit/AssertSameBooleanExpectedRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use PhpParser\Node;
use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\NodeAbstract;
use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleErrorBuilder;
Expand Down Expand Up @@ -77,8 +78,9 @@ public function processNode(Node $node, Scope $scope): array
}

/**
* @param array<Node\Arg|Node\VariadicPlaceholder> $args
* @return list<Node\Arg|Node\VariadicPlaceholder>
* @template T of NodeAbstract

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using a fixed union of types (which depends on PHPParser version) use a more generic base class

PHPParser v5.9.0+: Node\Arg|Node\ArgPlaceholder|Node\VariadicPlaceholder
PHPParser <v5.9.0: Node\Arg|Node\VariadicPlaceholder

* @param array<T> $args
* @return list<T>
*/
private static function rewriteArgs(array $args): array
{
Expand Down
6 changes: 4 additions & 2 deletions src/Rules/PHPUnit/AssertSameNullExpectedRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use PhpParser\Node;
use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\NodeAbstract;
use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleErrorBuilder;
Expand Down Expand Up @@ -63,8 +64,9 @@ public function processNode(Node $node, Scope $scope): array
}

/**
* @param array<Node\Arg|Node\VariadicPlaceholder> $args
* @return list<Node\Arg|Node\VariadicPlaceholder>
* @template T of NodeAbstract
* @param array<T> $args
* @return list<T>
*/
private static function rewriteArgs(array $args): array
{
Expand Down
Loading