-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[11.x] Update PHPStan to 2.x #53716
base: 11.x
Are you sure you want to change the base?
[11.x] Update PHPStan to 2.x #53716
Changes from all commits
3b89c49
4905a79
f207f71
07b8b0d
f5a7a9c
7ce889a
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 | ||||
---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ | |||||
|
||||||
use function PHPStan\Testing\assertType; | ||||||
|
||||||
new class implements ValidationRule | ||||||
$class = new class implements ValidationRule | ||||||
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.
Suggested change
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. The instance must be assigned to some variable to avoid the following error...
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. The error is valid, but the real problem is something else Looking at the entire file, it doesn't seem like it's testing anything. The class is being instantiated, but the assertion call is inside a method that isn't being called. I'd rather see the test being reworked so there's a point in even having it. |
||||||
{ | ||||||
public function validate(string $attribute, mixed $value, Closure $fail): 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.
I would assume that a callback with
int
return type would result in a type calledint
and not36
. There seems to be a problem elsewhere.All these type assertions should remain unchanged.
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 think that since PHPStan 2.0, types are inferred more narrowly, in this case as
36
literal type.https://phpstan.org/writing-php-code/phpdoc-types#literals-and-constants
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 hope that's something that can be configured somewhere, since the returned type is a string with the number, so the "literal" part is misleading.