Skip to content

[master] Fix: PHPCS Errors #111

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

Open
wants to merge 2 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
2 changes: 0 additions & 2 deletions inc/classes/class-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ protected function setup_hooks() {
*/
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );

}

/**
Expand Down Expand Up @@ -101,5 +100,4 @@ public function admin_enqueue_scripts( $hook_suffix ) {
);
}
}

}
16 changes: 4 additions & 12 deletions inc/classes/class-custom-nav-menu-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ protected function setup_hooks() {
*/
add_filter( 'wp_nav_menu_objects', array( $this, 'wp_nav_menu_objects' ), 10, 2 );
add_filter( 'walker_nav_menu_start_el', array( $this, 'walker_nav_menu_start_el' ), 10, 4 );

}

/**
Expand Down Expand Up @@ -105,14 +104,11 @@ private function get_nav_menu_meta_data( $menu_item_id, $from_cache = true ) {
/**
* Add custom fields on menu item edit screen.
*
* @param int $id Current menu item ID.
* @param object $item Current menu object.
* @param int $depth Current menu children depth.
* @param array $args Current menu Arguments.
* @param int $id Current menu item ID.
*
* @return void
*/
public function wp_nav_menu_item_custom_fields( $id, $item, $depth, $args ) {
public function wp_nav_menu_item_custom_fields( $id ) {
$data = $this->get_nav_menu_meta_data( $id, false );

$features = array(
Expand Down Expand Up @@ -305,11 +301,10 @@ public function wp_update_nav_menu_item( $menu_id, $item_id ) {
* Function to filter nav menu objects.
*
* @param array $sorted_items Menu items after being sorted.
* @param array $args Menu arguments.
*
* @return array Sorted menu items.
*/
public function wp_nav_menu_objects( $sorted_items, $args ) {
public function wp_nav_menu_objects( $sorted_items ) {
global $nav_menu_custom_fields;
if ( empty( $nav_menu_custom_fields ) || ! is_array( $nav_menu_custom_fields ) ) {
$nav_menu_custom_fields = array();
Expand All @@ -331,12 +326,10 @@ public function wp_nav_menu_objects( $sorted_items, $args ) {
*
* @param string $html HTML of nav menu item.
* @param object $item Menu item object.
* @param int $depth Menu item's children depth.
* @param array $args Menu item's arguments.
*
* @return string HTML of nav menu item.
*/
public function walker_nav_menu_start_el( $html, $item, $depth, $args ) {
public function walker_nav_menu_start_el( $html, $item ) {
global $nav_menu_custom_fields;
if ( empty( $nav_menu_custom_fields ) || ! is_array( $nav_menu_custom_fields ) ) {
return $html;
Expand Down Expand Up @@ -513,5 +506,4 @@ private function get_nav_menu_cached_meta_data( $item_id ) {
private function cache_nav_menu_meta_data( $item_id, $data ) {
set_transient( $this->meta_key . '-' . $item_id, $data, DAY_IN_SECONDS );
}

}
4 changes: 1 addition & 3 deletions inc/classes/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace WP_Menu_Custom_Fields\Inc;

use \WP_Menu_Custom_Fields\Inc\Traits\Singleton;
use WP_Menu_Custom_Fields\Inc\Traits\Singleton;

/**
* Class Plugin
Expand All @@ -24,7 +24,5 @@ protected function __construct() {
// Load plugin classes.
Assets::get_instance();
Custom_Nav_Menu_Fields::get_instance();

}

}
3 changes: 1 addition & 2 deletions inc/helpers/autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @return void
*/
function autoloader( $resource = '' ) {
function autoloader( $resource = '' ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.resourceFound

$resource_path = false;
$namespace_root = 'WP_Menu_Custom_Fields\\';
Expand Down Expand Up @@ -81,7 +81,6 @@ function autoloader( $resource = '' ) {
// We are already making sure that the file exists and it's valid.
require_once( $resource_path ); // phpcs:ignore
}

}

spl_autoload_register( '\WP_Menu_Custom_Fields\Inc\Helpers\autoloader' );
4 changes: 1 addition & 3 deletions inc/traits/trait-singleton.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ final public static function get_instance() {
*
* @var array
*/
static $instance = [];
static $instance = array();

/**
* If this trait is implemented in a class which has multiple
Expand All @@ -83,7 +83,5 @@ final public static function get_instance() {
}

return $instance[ $called_class ];

}

} // End trait
Loading