New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DX: code grooming #5664
DX: code grooming #5664
Conversation
src/Tokenizer/Token.php
Outdated
@@ -87,7 +87,7 @@ public function __construct($token) | |||
} else { | |||
throw new \InvalidArgumentException(sprintf( | |||
'Cannot recognize input value as valid Token prototype, got "%s".', | |||
\is_object($token) ? \get_class($token) : \gettype($token) | |||
\get_class($token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, I've tried the same and got the same results you can see in failed test.
In PHPDoc it is stated $token
is array or string, so PHPStan claims this else
is unreachable, when in fact it is. We will be able typehint this only in PHP 8+.
src/Tokenizer/Token.php
Outdated
@@ -87,7 +87,7 @@ public function __construct($token) | |||
} else { | |||
throw new \InvalidArgumentException(sprintf( | |||
'Cannot recognize input value as valid Token prototype, got "%s".', | |||
\is_object($token) ? \get_class($token) : \gettype($token) | |||
\get_class($token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\get_class($token) | |
\is_object($token) ? \get_class($token) : \gettype($token) // @phpstan-ignore-line this is not unreachable |
No description provided.