Merged
Conversation
…ecify its types: T'
Contributor
Author
|
@JJJ Would you like to check the PR? ;-) |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR upgrades PHPStan to level 6 by adding and refining PHPDoc annotations throughout the codebase and fixes a few minor bugs related to output and CLI error handling.
- Insert missing
@return voidtags and strengthen generic types in docblocks. - Replace improper
echo esc_html_e()calls and switch WP-CLI error returns toWP_CLI::error. - Bump PHPStan configuration from level 5 to level 6.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| wpmn-loader.php | Add missing @return void annotations. |
| wp-multi-network/includes/metaboxes/move-site.php | Add @return void to metabox functions. |
| wp-multi-network/includes/metaboxes/edit-network.php | Add @return void to metabox functions. |
| wp-multi-network/includes/functions.php | Refine PHPDoc parameter and return types. |
| wp-multi-network/includes/deprecated.php | Add missing @return string docblock. |
| wp-multi-network/includes/classes/class-wp-ms-rest-networks-controller.php | Introduce PHPDoc generics and refine return types. |
| wp-multi-network/includes/classes/class-wp-ms-networks-list-table.php | Add @return void and strengthen array return types. |
| wp-multi-network/includes/classes/class-wp-ms-networks-capabilities.php | Refine parameter/return types in docblocks. |
| wp-multi-network/includes/classes/class-wp-ms-networks-admin.php | Refine docblocks and remove improper echo. |
| wp-multi-network/includes/classes/class-wp-ms-networks-admin-bar.php | Add missing @return void. |
| wp-multi-network/includes/classes/class-wp-ms-network-command.php | Update CLI signatures, destructuring, and error handling. |
| phpstan.neon.dist | Bump PHPStan level from 5 to 6. |
Comments suppressed due to low confidence (1)
wpmn-loader.php:113
- [nitpick] Constructors don’t return values by design; the
@return voidannotation on__constructis unnecessary and can be removed.
* @return void
wp-multi-network/includes/classes/class-wp-ms-rest-networks-controller.php
Show resolved
Hide resolved
JJJ
approved these changes
May 21, 2025
thefrosty
added a commit
to thefrosty/wp-multi-network
that referenced
this pull request
Dec 3, 2025
* master: PHPStan Level 6 (stuttter#221) PHPStan Level 5 (stuttter#220) Update README.md PHPStan Level 4 Compliance (stuttter#219) PHPStan Level 3 (stuttter#218) PHPStan Level 2 (stuttter#217) PHPStan Level 1 (stuttter#215) # Conflicts: # wp-multi-network/includes/classes/class-wp-ms-networks-admin.php
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.
PHPStan level 6 focuses on enforcing type hints in PHP code. It's about adding missing type declarations and ensuring that all types are explicitly specified, including array value types and generic types.
Some minor bugs were also fixed:
echo esc_html_e()