Skip to content

Commit

Permalink
Unable to resolve the template type - tip with a blogpost link
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jan 13, 2021
1 parent 1aa8ebc commit 3c56362
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Rules/FunctionCallParametersCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ static function (Type $type): bool {
continue;
}

$errors[] = RuleErrorBuilder::message(sprintf($messages[9], $name))->line($funcCall->getLine())->build();
$errors[] = RuleErrorBuilder::message(sprintf($messages[9], $name))->line($funcCall->getLine())->tip('See: https://phpstan.org/blog/solving-phpstan-error-unable-to-resolve-template-type')->build();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ public function testGenericFunction(): void
[
'Unable to resolve the template type A in call to function CallGenericFunction\f',
15,
'See: https://phpstan.org/blog/solving-phpstan-error-unable-to-resolve-template-type',
],
[
'Parameter #1 $a of function CallGenericFunction\g expects DateTime, DateTimeImmutable given.',
Expand All @@ -433,6 +434,7 @@ public function testGenericFunction(): void
[
'Unable to resolve the template type A in call to function CallGenericFunction\g',
26,
'See: https://phpstan.org/blog/solving-phpstan-error-unable-to-resolve-template-type',
],
]);
}
Expand Down
3 changes: 3 additions & 0 deletions tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ public function testCallMethods(): void
[
'Unable to resolve the template type T in call to method Test\ClassStringWithUpperBounds::doFoo()',
1490,
'See: https://phpstan.org/blog/solving-phpstan-error-unable-to-resolve-template-type',
],
[
'Parameter #1 $a of method Test\CallableWithMixedArray::doBar() expects callable(array<string>): array<string>, Closure(array): array|null given.',
Expand Down Expand Up @@ -732,6 +733,7 @@ public function testCallMethodsOnThisOnly(): void
[
'Unable to resolve the template type T in call to method Test\ClassStringWithUpperBounds::doFoo()',
1490,
'See: https://phpstan.org/blog/solving-phpstan-error-unable-to-resolve-template-type',
],
[
'Parameter #1 $a of method Test\CallableWithMixedArray::doBar() expects callable(array<string>): array<string>, Closure(array): array|null given.',
Expand Down Expand Up @@ -1759,6 +1761,7 @@ public function testOnlyRelevantUnableToResolveTemplateType(): void
[
'Unable to resolve the template type T in call to method OnlyRelevantUnableToResolve\Foo::doBaz()',
41,
'See: https://phpstan.org/blog/solving-phpstan-error-unable-to-resolve-template-type',
],
]);
}
Expand Down

0 comments on commit 3c56362

Please sign in to comment.