Skip to content

fix: correct phpstan config error - #296

Merged
phil-davis merged 1 commit into
sabre-io:masterfrom
phil-davis:fix-phpstan-config
Aug 26, 2026
Merged

fix: correct phpstan config error#296
phil-davis merged 1 commit into
sabre-io:masterfrom
phil-davis:fix-phpstan-config

Conversation

@phil-davis

Copy link
Copy Markdown
Contributor

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.

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

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.82%. Comparing base (66f0204) to head (21356ee).
⚠️ Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread lib/Client.php
// 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

@staabm staabm Aug 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah. Pass-by-ref is hard to properly analyze. Needs a new phpstan issue with a small reproducer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread lib/Client.php
* These settings will be included in every HTTP request.
*/
public function addCurlSetting(int $name, $value): void
public function addCurlSetting(int $name, mixed $value): void

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

phpstan complained that the type of $value was not declared.
These days we can directly declare the mixed type. So that is good.

Comment thread lib/Client.php
if (null === $this->curlHandle) {
$this->curlHandle = curl_init();
} else {
if (isset($this->curlHandle)) {

@phil-davis phil-davis Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

curlHandle is either uninitialized or a proper CurlHandle type.
So check for uninitialized by using isset() rather than trying to compare to null

@phil-davis
phil-davis requested a review from staabm August 26, 2026 11:49
@phil-davis
phil-davis merged commit 8846113 into sabre-io:master Aug 26, 2026
6 checks passed
@phil-davis
phil-davis deleted the fix-phpstan-config branch August 26, 2026 13:40
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.

phpstan config entry is hiding messages

2 participants