Skip to content
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

Merged
merged 1 commit into from Apr 28, 2021
Merged

DX: code grooming #5664

merged 1 commit into from Apr 28, 2021

Conversation

keradus
Copy link
Member

@keradus keradus commented Apr 28, 2021

No description provided.

@keradus keradus added this to the 2.18.7 milestone Apr 28, 2021
@@ -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)
Copy link
Contributor

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+.

@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\get_class($token)
\is_object($token) ? \get_class($token) : \gettype($token) // @phpstan-ignore-line this is not unreachable

@coveralls
Copy link

coveralls commented Apr 28, 2021

Coverage Status

Coverage remained the same at 91.902% when pulling 7329d6a on keradus:2.18_foo into 0e5b740 on FriendsOfPHP:2.18.

@keradus keradus merged commit 7e0f3fb into PHP-CS-Fixer:2.18 Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants