fix: correct phpstan config error - #296
Conversation
The ignoreErrors entry: message: "#^Left side of || is always false.$#" Is actually matching lots of reported problems, masking them. Remove that ignoreErrors entry, and adjust code or add phpstan-ignore lines to resolve or document the individual issues detected. Signed-off-by: Phillip Davis <phil@jankaritech.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #296 +/- ##
=========================================
Coverage 94.82% 94.82%
Complexity 260 260
=========================================
Files 15 15
Lines 851 851
=========================================
Hits 807 807
Misses 44 44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| // If retry was still set to false, it means no event handler | ||
| // dealt with the problem. In this case we just re-throw the | ||
| // exception. | ||
| // @phpstan-ignore booleanNot.alwaysTrue |
There was a problem hiding this comment.
For most of these, phpstan is noticing "defensive" code.
In this case $retry has been passed to emit in a way that is potentially writeable.
So maybe it could have value either true or false here?
There was a problem hiding this comment.
Yeah. Pass-by-ref is hard to properly analyze. Needs a new phpstan issue with a small reproducer.
There was a problem hiding this comment.
| * These settings will be included in every HTTP request. | ||
| */ | ||
| public function addCurlSetting(int $name, $value): void | ||
| public function addCurlSetting(int $name, mixed $value): void |
There was a problem hiding this comment.
phpstan complained that the type of $value was not declared.
These days we can directly declare the mixed type. So that is good.
| if (null === $this->curlHandle) { | ||
| $this->curlHandle = curl_init(); | ||
| } else { | ||
| if (isset($this->curlHandle)) { |
There was a problem hiding this comment.
curlHandle is either uninitialized or a proper CurlHandle type.
So check for uninitialized by using isset() rather than trying to compare to null
Fixes #295
The ignoreErrors entry:
message: "#^Left side of || is always false.$#"
Is actually matching lots of reported problems, masking them.
Remove that ignoreErrors entry, and adjust code or add phpstan-ignore lines to resolve or document the individual issues detected.