- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
DX: Increase PHPStan level to 6 #6468
Conversation
phpstan.neon
Outdated
- '#^Method .+ has parameter .+ with no value type specified in iterable type array\.$#' | ||
- '#^Method .+ has parameter .+ with no value type specified in iterable type iterable\.$#' | ||
- '#^Method .+ return type has no value type specified in iterable type array\.$#' | ||
- '#^Method .+ return type has no value type specified in iterable type iterable\.$#' | ||
- '#^Property .+ has no type specified\.$#' | ||
- '#^Property .+ type has no value type specified in iterable type array\.$#' |
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.
Please consider generating phpstan-baseline.neon
instead (or adding count
). It may be huge, but it will ensure that no new errors of these types will be introduced.
If you decide to stick with the current approach, you can use checkMissingIterableValueType: false
parameter.
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.
Letting PHPStan generate the baseline was my first approach when I previously tried to increase PHPStan's level. I think baseline feature is great but it tends to create a burden on contributors that often have to update it, so not very suitable for us here.
I added counts, thanks for the suggestion.
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 believe that baseline would be easier to deal with for contributors, as they get a suitable error message asking them to add type or remove something from baseline. With count, I think they will get something like “expected to get this error x times, but it was reported y times”, with no way to know where the change occurred.
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 propose to see how it goes and if it still makes contributions harder, we'll try something else.
@@ -21,6 +21,8 @@ | |||
* @author Dariusz Rumiński <dariusz.ruminski@gmail.com> | |||
* | |||
* @internal | |||
* | |||
* @extends \IteratorIterator<mixed, \SplFileInfo, \Traversable<\SplFileInfo>> |
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.
what is the first type here, for? maybe we can avoid mixed
here?
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.
It's mandatory. I used mixed
because we don't actually care about the key type, but I might change it if you want.
No description provided.