-
Notifications
You must be signed in to change notification settings - Fork 53
Static analysis fixes #203
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
Conversation
*/ | ||
public static function setFactory(callable $factory) | ||
public static function setFactory(callable $factory): void |
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.
Not a BC break: the class is final.
*/ | ||
private function createValueKey(string $part): array | ||
{ | ||
$parts = explode('=', $part, 2); | ||
$key = trim($parts[0]); | ||
$value = isset($parts[1]) ? trim($parts[1]) : true; | ||
$value = isset($parts[1]) ? trim($parts[1]) : null; |
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.
Not a BC break: the Cookie class only accepts string or null as a value. This is a bug fix.
@@ -25,13 +25,14 @@ abstract class HttpClientPool implements HttpClientPoolInterface | |||
/** | |||
* Add a client to the pool. | |||
* | |||
* @param ClientInterface|HttpAsyncClient|HttpClientPoolItem $client |
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.
Not a BC break. A HttpClientPoolItem
is a ClientInterface
. It's incorrect to specify it again.
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.
I've left some comments to help reviewers. :)
It looks like that dead was code intentionally in there, even though it was not needed... |
- src | ||
ignoreErrors: | ||
- | ||
message: "#^Strict comparison using \\!\\=\\= between null and null will always evaluate to false\\.$#" |
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.
This is a false positive, and should be reported to phpstan as a bug.
path: src/HttpMethodsClient.php | ||
|
||
- | ||
message: "#^Method Http\\\\Client\\\\Common\\\\Plugin\\\\Journal\\:\\:addSuccess\\(\\) has no return typehint specified\\.$#" |
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.
This is a no-fix. Changing it would break BC. Maybe we should consider adding void return to the interface in the next major version.
path: src/Plugin/Journal.php | ||
|
||
- | ||
message: "#^Method Http\\\\Client\\\\Common\\\\Plugin\\\\Journal\\:\\:addFailure\\(\\) has no return typehint specified\\.$#" |
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.
This is a no-fix. Changing it would break BC. Maybe we should consider adding void return to the interface in the next major version.
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.
Ready for review now @dbu. :)
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.
awesome, thanks!
are we missing some tests with that code? |
No, there are tests, and that's what made me put the code back. |
Maybe unreachable was the wrong word. It's more that the code was duplicated, however that seems to have been intentional. |
PHPStan has detected 3 more bugs for us,
and some unreachable code in the plugin client.Removed unreachable plugin client code