-
-
Notifications
You must be signed in to change notification settings - Fork 928
Closed
Labels
Milestone
Description
Bug report
Given the following code:
<?php declare(strict_types = 1);
/**
* @template TSuccess
* @template TError
* @phpstan-consistent-constructor
*/
class Result
{
public function __construct(){}
/**
* @param TError $error
* @return static
*/
public static function err(mixed $error): static
{
return new static();
}
}
/**
* @extends Result<void, SomeResult::*>
*/
class SomeResult extends Result{
}
SomeResult::err('This should be an error');
class Constants {
// No constants here defined (yet)
}
/**
* @param Constants::* $f
*/
function f(mixed $f): void {}
I get the error message PHPDoc tag @param for parameter $f contains unresolvable type.
.
Code snippet that reproduces the problem
https://phpstan.org/r/943a8f8a-29e1-47f6-93be-b3b8030bb49b
Expected output
I would expect there to have some consistency. In line 29 I would also expect to get a message that the param is not resolvable. Especially because it displays an error for line 29 if a constant on SomeResult is defined.
Did PHPStan help you today? Did it make you happy in any way?
This tool makes PHP development so much easier imo, great work!