Skip to content

PHPStan Level 6#221

Merged
JJJ merged 7 commits intostuttter:masterfrom
lloc:feat/phpstan-level-6
May 21, 2025
Merged

PHPStan Level 6#221
JJJ merged 7 commits intostuttter:masterfrom
lloc:feat/phpstan-level-6

Conversation

@lloc
Copy link
Contributor

@lloc lloc commented May 1, 2025

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()
  • throw new Error instead of WP_CLI::error in a command

@lloc lloc changed the title FPHPStan Level 6 PHPStan Level 6 May 1, 2025
@lloc
Copy link
Contributor Author

lloc commented May 21, 2025

@JJJ Would you like to check the PR? ;-)

@JJJ JJJ requested a review from Copilot May 21, 2025 23:12
@JJJ JJJ self-assigned this May 21, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 void tags and strengthen generic types in docblocks.
  • Replace improper echo esc_html_e() calls and switch WP-CLI error returns to WP_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 void annotation on __construct is unnecessary and can be removed.
* @return void

@JJJ JJJ merged commit 542d9c1 into stuttter:master May 21, 2025
1 check passed
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
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.

3 participants