diff --git a/src/Cache/Invalidation.php b/src/Cache/Invalidation.php index 9d05e93..67601c3 100644 --- a/src/Cache/Invalidation.php +++ b/src/Cache/Invalidation.php @@ -896,7 +896,7 @@ public function on_updated_menu_meta_cb( $meta_id, $object_id, $meta_key, $meta_ * @return void * @throws Exception */ - public function on_menu_item_added_to_menu_cb( int $object_id, int $tt_id, string $taxonomy ): void { + public function on_menu_item_added_to_menu_cb( int $object_id, int $tt_id, string $taxonomy ): void { if ( 'nav_menu' !== $taxonomy ) { return; @@ -905,7 +905,7 @@ public function on_menu_item_added_to_menu_cb( int $object_id, int $tt_id, strin $menu_term = get_term_by( 'term_taxonomy_id', absint( $tt_id ), $taxonomy ); // if the menu isn't public do nothing - if ( ! $menu_term || ! $this->is_menu_public( absint( $menu_term->term_id ) ) ) { + if ( ! isset( $menu_term->term_id ) || ! $this->is_menu_public( absint( $menu_term->term_id ) ) ) { return; } @@ -923,12 +923,12 @@ public function on_menu_item_added_to_menu_cb( int $object_id, int $tt_id, strin * @return void * @throws Exception */ - public function on_menu_item_updated_cb( int $menu_id, int $menu_item_db_id, array $args ): void { + public function on_menu_item_updated_cb( int $menu_id, int $menu_item_db_id, array $args ): void { $menu_term = get_term_by( 'term_id', absint( $menu_id ), 'nav_menu' ); // if the menu isn't public do nothing - if ( ! $menu_term || ! $this->is_menu_public( absint( $menu_term->term_id ) ) ) { + if ( ! isset( $menu_term->term_id ) || ! $this->is_menu_public( absint( $menu_term->term_id ) ) ) { return; } @@ -944,7 +944,7 @@ public function on_menu_item_updated_cb( int $menu_id, int $menu_item_db_id, arr * * @return void */ - public function on_menu_item_deleted_cb( int $post_id, WP_Post $post ): void { + public function on_menu_item_deleted_cb( int $post_id, WP_Post $post ): void { if ( 'nav_menu_item' !== $post->post_type ) { return; diff --git a/tests/wpunit/PostCacheInvalidationTest.php b/tests/wpunit/PostCacheInvalidationTest.php index dafca87..ed46536 100644 --- a/tests/wpunit/PostCacheInvalidationTest.php +++ b/tests/wpunit/PostCacheInvalidationTest.php @@ -391,7 +391,7 @@ public function testPublishedPostWithCategoryIsForceDeleted() { // make assertions about the evicted caches $this->assertNotEmpty( $evicted_caches ); - + $this->assertEqualSets([ 'userWithPostsConnection', 'singleCategory',