Permalink
Browse files

Fix types for caching methods, rename delete method

  • Loading branch information...
villesiltala committed Jan 25, 2019
1 parent 7e05cf5 commit ffc27884634f9b202586d6a93e9a4370eb39744a
Showing with 4 additions and 4 deletions.
  1. +4 −4 helpers/menu.php
@@ -303,7 +303,7 @@ private static function is_current( $item, $override ) {
*
* @return bool|array
*/
protected static function get_cached_menu_items( int $menu_id ) {
protected static function get_cached_menu_items( ?int $menu_id ) {
if ( static::disable_cache() ) {
return false;
}
@@ -319,7 +319,7 @@ protected static function get_cached_menu_items( int $menu_id ) {
*
* @return bool
*/
protected static function set_cached_menu_items( int $menu_id, $menu_items ) {
protected static function set_cached_menu_items( ?int $menu_id, ?array $menu_items = [] ) {
if ( static::disable_cache() ) {
return false;
}
@@ -337,7 +337,7 @@ protected static function set_cached_menu_items( int $menu_id, $menu_items ) {
*
* @return bool
*/
public static function delete_cache_menu_items( $menu_id = 0 ) {
public static function delete_cached_menu_items( $menu_id = 0 ) {
if ( static::disable_cache() ) {
return false;
}
@@ -359,4 +359,4 @@ protected static function disable_cache() {
$this->add_helper( 'menu', new Menu() );
// Add hook to delete menu items cache if a menu is updated.
add_action( 'wp_update_nav_menu', [ Menu::class, 'delete_cache_menu_items' ], 1, 1 );
add_action( 'wp_update_nav_menu', [ Menu::class, 'delete_cached_menu_items' ], 1, 1 );

0 comments on commit ffc2788

Please sign in to comment.