Skip to content

PHPStan Level 2#217

Merged
JJJ merged 6 commits intostuttter:masterfrom
lloc:chore/phpstan-level-2
Feb 27, 2025
Merged

PHPStan Level 2#217
JJJ merged 6 commits intostuttter:masterfrom
lloc:chore/phpstan-level-2

Conversation

@lloc
Copy link
Contributor

@lloc lloc commented Feb 26, 2025

This PR implements several code quality improvements to meet PHPStan level 2 requirements. The changes fix issues with property access, type declarations, and namespace resolutions across classes.

Changes

  • Set PHPStan analysis level to 2
  • Fixed property access of an object of \WP_Site
    • Changed incorrect name property to correct blogname property
  • Addressed property naming of object of type \WP_Network
    • Renamed sitename to site_name for consistency
    • Ignoring false positive when access to private $blog_id property through magic methods
  • Fixed parameter type declaration of var that is passed to WP_MS_Networks_List_Table::pagination()
  • Ignoring root namespace resolution issue for WP_User return type from WP_CLI\Fetchers\User::get()

No functional changes have been made — these are strictly quality improvements that help prevent potential bugs and make the codebase easier to maintain.

@lloc
Copy link
Contributor Author

lloc commented Feb 27, 2025

@JJJ Renaming of the property name to blogname fixes actually a bug:

Bildschirmfoto 2025-02-27 um 12 52 29

to

Bildschirmfoto 2025-02-27 um 12 50 45

@JJJ JJJ merged commit 63fae1f into stuttter:master Feb 27, 2025
1 check passed
@JJJ
Copy link
Collaborator

JJJ commented Feb 27, 2025

@lloc crushing it with all these improvements 🙏

Merged!

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.

2 participants