Skip to content
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

Merged
merged 1 commit into from Jul 19, 2022

Conversation

julienfalque
Copy link
Member

No description provided.

@coveralls
Copy link

coveralls commented Jul 10, 2022

Coverage Status

Coverage remained the same at 92.881% when pulling f5c9143 on julienfalque:phpstan into c873618 on FriendsOfPHP:master.

phpstan.neon Outdated
Comment on lines 23 to 28
- '#^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\.$#'
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

src/Fixer/Operator/TernaryToElvisOperatorFixer.php Outdated Show resolved Hide resolved
@@ -21,6 +21,8 @@
* @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* @internal
*
* @extends \IteratorIterator<mixed, \SplFileInfo, \Traversable<\SplFileInfo>>
Copy link
Member

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?

Copy link
Member Author

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.

@julienfalque julienfalque merged commit 8bb4bb2 into PHP-CS-Fixer:master Jul 19, 2022
@julienfalque julienfalque deleted the phpstan branch July 19, 2022 11:54
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.

None yet

5 participants