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 1 #215

Open
wants to merge 4 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: 3 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 0
level: 1
paths:
- wp-multi-network/includes
- wpmn-loader.php
Expand All @@ -9,5 +9,5 @@ parameters:
#- %rootDir%/../../php-stubs/wp-cli-stubs/wp-cli-i18n-stubs.php
#- %rootDir%/../../php-stubs/wp-cli-stubs/wp-cli-tools-stubs.php
ignoreErrors:
- '/^Call to static method encode\(\) on an unknown class Requests_IDNAEncoder.$/'

- '/^Call to static method encode\(\) on an unknown class Requests_IDNAEncoder\.$/'
- '/^Constant WP_CONTENT_URL not found\.$/'
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function delete( $args, $assoc_args ) {
* @param array $args Positional CLI arguments.
* @param array $assoc_args Associative CLI arguments.
*/
public function move_site( $args, $assoc_args ) {
public function move_site( $args, $assoc_args ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
list( $site_id, $new_network_id ) = $args;

$network_id = move_site( $site_id, $new_network_id );
Expand Down Expand Up @@ -261,7 +261,7 @@ public function list_( $args, $assoc_args ) {
*/
public function plugin( $args, $assoc_args ) {
$fetchers_plugin = new \WP_CLI\Fetchers\Plugin();
$action = array_shift( $args );
$action = array_shift( $args );
if ( ! in_array( $action, array( 'activate', 'deactivate' ), true ) ) {
WP_CLI::error( sprintf( '%s is not a supported action.', $action ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ public function page_my_networks() {
}
$num_rows = ceil( $num / $cols );
$split = 0;
$rows = array();
for ( $i = 1; $i <= $num_rows; $i++ ) {
$rows[] = array_slice( $my_networks, $split, $cols );
$split = $split + $cols;
Expand Down
6 changes: 0 additions & 6 deletions wp-multi-network/includes/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ function wp_validate_site_url( $domain, $path, $site_id = 0 ) {
$domains = substr_count( $domain, '.' ) > 1 ? (array) substr( $domain, 0, strpos( $domain, '.' ) ) : array();
$pieces = array_filter( array_merge( $domains, $paths ) );
foreach ( $pieces as $slug ) {

// Bail if empty.
if ( empty( $slug ) ) {
return false;
}

// Bail if not lowercase or numbers.
if ( preg_match( '/[^a-z0-9]+/', $slug ) ) {
return false;
Expand Down
Loading