From ef4d395916165d7a3f89d200234aec86f4321cf7 Mon Sep 17 00:00:00 2001 From: Marcus Kazmierczak Date: Sat, 19 Jun 2021 01:55:01 -0700 Subject: [PATCH] Cleanup PHP Codesniffer warnings and enable fail (#26516) * Cleanup and enable unused variable warning - Removes flag ignore warnings in composer.json - Fixes Unused variable warnings Most cases were: `foreach ( $some_array as $key => $value )` with the $key value not being used. If ommited the foreach will just set the value and ignore the key. * Remove unsed gloal * Fix lint alignment --- composer.json | 2 +- lib/widgets.php | 2 -- packages/block-library/src/navigation/index.php | 10 +++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index dc614eb33307be..cf0658add1f678 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ }, "scripts": { "format": "phpcbf --standard=phpcs.xml.dist --report-summary --report-source", - "lint": "phpcs --standard=phpcs.xml.dist --runtime-set ignore_warnings_on_exit 1", + "lint": "phpcs --standard=phpcs.xml.dist", "test": "phpunit", "test:watch": "phpunit-watcher watch < /dev/tty" } diff --git a/lib/widgets.php b/lib/widgets.php index 53621323f9c182..a2cc51fa293d57 100644 --- a/lib/widgets.php +++ b/lib/widgets.php @@ -56,8 +56,6 @@ function gutenberg_use_widgets_block_editor() { * @return array Legacy widget settings. */ function gutenberg_get_legacy_widget_settings() { - global $wp_widget_factory; - $settings = array(); $widget_types_to_hide_from_legacy_widget_block = apply_filters( diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index b072ca594e78d6..9e709174986519 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -106,11 +106,11 @@ function render_classic_location_menu( $location, $attributes ) { return wp_nav_menu( array( - 'theme_location' => $location, - 'container' => '', - 'items_wrap' => '%3$s', - 'fallback_cb' => false, - 'echo' => false, + 'theme_location' => $location, + 'container' => '', + 'items_wrap' => '%3$s', + 'fallback_cb' => false, + 'echo' => false, ) ); }