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

PHPStan Level 2 #217

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 1
level: 2
paths:
- wp-multi-network/includes
- wpmn-loader.php
Expand All @@ -11,3 +11,7 @@ parameters:
ignoreErrors:
- '/^Call to static method encode\(\) on an unknown class Requests_IDNAEncoder\.$/'
- '/^Constant WP_CONTENT_URL not found\.$/'
# WP_Network::$blog_id is a private property that can be accessed via magic methods.
- '/^Access to an undefined property WP_Network::\$blog_id\.$/'
# WP_CLI\Fetchers\User::get() returns WP_User without root namespace.
- '/^Access to property \$ID on an unknown class WP_CLI\\Fetchers\\WP_User\.$/'
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function get_bulk_actions() {
*
* @since 1.3.0
*
* @param type $which Where to display the pagination. Either 'top' or 'bottom'.
* @param string $which Where to display the pagination. Either 'top' or 'bottom'.
*/
public function pagination( $which ) { // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found
parent::pagination( $which );
Expand Down Expand Up @@ -483,7 +483,7 @@ protected function handle_row_actions( $network, $column_name, $primary ) {
* @param int $network_id The current network ID.
* @param string $network_sitename The current network name.
*/
$actions = apply_filters( 'manage_networks_action_links', array_filter( $actions ), $network->id, $network->sitename );
$actions = apply_filters( 'manage_networks_action_links', array_filter( $actions ), $network->id, $network->site_name );

// Return all row actions.
return $this->row_actions( $actions );
Expand Down
2 changes: 1 addition & 1 deletion wp-multi-network/includes/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function wp_sanitize_site_path( $path = '' ) {
* @param string $site_id Optional. Site ID, if an existing site. Default 0.
* @return bool True if the site URL is valid, false otherwise.
*/
function wp_validate_site_url( $domain, $path, $site_id = 0 ) {
function wp_validate_site_url( $domain, $path, $site_id = '0' ) {
global $wpdb;

// Ensure the domain does not already exist on the current network.
Expand Down
4 changes: 2 additions & 2 deletions wp-multi-network/includes/metaboxes/edit-network.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function wpmn_edit_network_assign_sites_metabox( $network = null ) {
<?php if ( ( (int) $site->network_id !== (int) $network->id ) && ! is_main_site_for_network( $site->id ) ) : ?>

<option value="<?php echo esc_attr( $site->id ); ?>">
<?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site->name, $site->domain, $site->path ) ); ?>
<?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site->blogname, $site->domain, $site->path ) ); ?>
</option>

<?php endif; ?>
Expand All @@ -140,7 +140,7 @@ function wpmn_edit_network_assign_sites_metabox( $network = null ) {
<?php if ( (int) $site->network_id === (int) $network->id ) : ?>

<option value="<?php echo esc_attr( $site->id ); ?>" <?php disabled( is_main_site_for_network( $site->id ) ); ?>>
<?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site->name, $site->domain, $site->path ) ); ?>
<?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site->blogname, $site->domain, $site->path ) ); ?>
</option>

<?php endif; ?>
Expand Down
Loading