-
Notifications
You must be signed in to change notification settings - Fork 59
chore: update to phpstan major version 2 #255
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| parameters: | ||
| level: 6 | ||
| phpVersion: 70430 # PHP 7.4.30 | ||
| ignoreErrors: | ||
| - | ||
| message: "#^Negated boolean expression is always true.$#" | ||
|
|
@@ -12,12 +11,8 @@ parameters: | |
| path: lib/Client.php | ||
| - | ||
| message: "#^Left side of || is always false.$#" | ||
| count: 6 | ||
| count: 19 | ||
| path: lib/Client.php | ||
| - | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should drop the phpVersion from this config file. Since phpstan 2.x it will lookup the composer.json see https://staabm.github.io/2024/11/14/phpstan-php-version-narrowing.html
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That made it fail on PHP 8.4 https://github.com/sabre-io/http/actions/runs/12631715455/job/35193980626?pr=255 I suppose that I should have a look at the reported things?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would ignore
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed the count for But it causes a fail running on PHP 7.4, because the count of that error is only 6 when phpstan runs on PHP 7.4 Is there a way to specify a different count for each PHP version?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. by php-version errors are usually separated into separate baselines like in if this sounds like too much work, we can revert to adding the lowest supported php version into phpstan.neon and wait until I am able to improve the phpstan multi phpversion story with https://staabm.github.io/2024/11/28/phpstan-php-version-in-scope.html |
||
| message: "#^Else branch is unreachable because ternary operator condition is always true.$#" | ||
| count: 1 | ||
| path: lib/Auth/Digest.php | ||
| - | ||
| message: "#^Strict comparison using !== between '' and non-empty-string will always evaluate to true.$#" | ||
| count: 1 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,7 +200,7 @@ public function test401(): void | |
| { | ||
| $this->auth->requireLogin(); | ||
| $test = preg_match('/^AWS$/', $this->response->getHeader('WWW-Authenticate'), $matches); | ||
| self::assertTrue(true == $test, 'The WWW-Authenticate response didn\'t match our pattern'); | ||
| self::assertTrue(1 === $test, 'The WWW-Authenticate response didn\'t match our pattern'); | ||
|
Comment on lines
202
to
+203
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,7 +166,7 @@ private function getServerTokens(int $qop = Digest::QOP_AUTH): array | |
| $test = preg_match('/Digest realm="'.self::REALM.'",qop="'.$qopstr.'",nonce="([0-9a-f]*)",opaque="([0-9a-f]*)"/', | ||
| $this->response->getHeader('WWW-Authenticate'), $matches); | ||
|
|
||
| self::assertTrue(true == $test, 'The WWW-Authenticate response didn\'t match our pattern. We received: '.$this->response->getHeader('WWW-Authenticate')); | ||
| self::assertTrue(1 === $test, 'The WWW-Authenticate response didn\'t match our pattern. We received: '.$this->response->getHeader('WWW-Authenticate')); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| $nonce = $matches[1]; | ||
| $opaque = $matches[2]; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,7 @@ public function testGetQueryParametersNoData(): void | |
| } | ||
|
|
||
| /** | ||
| * @backupGlobals | ||
| * @backupGlobals enabled | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. backupGlobals should explicitly have the keyword "enabled"
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did this annotation work as expected in phpunit without the suffix? |
||
| */ | ||
| public function testCreateFromPHPRequest(): 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.
getHeadercan only return string or null. Sois_int()is useless code.