-
Notifications
You must be signed in to change notification settings - Fork 14
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 7 changes #242
Conversation
@@ -570,8 +582,7 @@ public function on_transition_post_status_cb( $new_status, $old_status, WP_Post | |||
$action_type = 'CREATE'; | |||
} | |||
|
|||
$post_type_object = get_post_type_object( $post->post_type ); | |||
$type_name = $post_type_object instanceof \WP_Post_Type ? strtolower( $post_type_object->graphql_single_name ) : $post_type_object; | |||
$type_name = strtolower( $post_type_object->graphql_single_name ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So with changes like this we really need to be careful that we're only executing code when WPGraphQL is active.
If WPGraphQL Smart Cache were active but WPGraphQL was not active, and the invalidation callbacks were fired, I think this would be some fatals.
So, we should check to ensure we're only executing code if WPGraphQL is already active. 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I confirmed this is the case: https://github.com/wp-graphql/wp-graphql-smart-cache/blob/main/wp-graphql-smart-cache.php#L191-L210
@markkelnar I had one concern while reviewing, but I went and confirmed that we're already protecting against said scenario. Approved. LGTM 💃🏻 |
Fixes for phpstan levels 6 and 7.
Issue reference