chore: implement stricter PHPStan config and clean up unnecessary type-guards#3009
Merged
jasonbahl merged 16 commits intowp-graphql:developfrom Jan 23, 2024
Merged
Conversation
Set default value for get_option
jasonbahl
previously approved these changes
Jan 23, 2024
Collaborator
@justlevine IIRC, you said you might have had some more changes you were going to add to #3008? UPDATE: I see that you pushed up a new commit today. will check it 👀 |
…rict-phpstan-fixes - update phpstan.neon.dist
|
Code Climate has analyzed commit 19440ea and detected 3 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this implement/fix? Explain your changes.
This PR takes advantages of the numerous improvements to type-safety over the last several releases to clean up unnecessary code primarily used as type guards. Additionally, the PHPStan config has been improved to prevent future code quality regressions.
More specifically:
true === true,isset( true ), etc).if ($foo === true ) { return (bool) $foo };)$self === $thisinModel::wrap_fields(), since we can use the class instance directly in the closure.This PR contains no changes to internal/external APIs or any expected functionality.
Does this close any currently open issues?
Any relevant logs, error output, GraphiQL screenshots, etc?
Any other comments?
The
checkAlwaysTrueInstanceofflag inphpstan.neon.distcan be toggled on once #3008 is merged.Where has this been tested?
Operating System: Ubuntu 20.04 (wsl2 + devilbox + php 8.1.15)
WordPress Version: 6.4.2