Skip to content
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

Merged
merged 6 commits into from
Aug 2, 2023
Merged

Conversation

markkelnar
Copy link
Contributor

Fixes for phpstan levels 6 and 7.

Issue reference

@markkelnar markkelnar requested a review from jasonbahl August 2, 2023 19:50
@@ -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 );
Copy link
Collaborator

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. 👀

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasonbahl jasonbahl self-requested a review August 2, 2023 20:45
@jasonbahl
Copy link
Collaborator

@markkelnar I had one concern while reviewing, but I went and confirmed that we're already protecting against said scenario.

Approved. LGTM 💃🏻

@markkelnar markkelnar merged commit 0c4543e into wp-graphql:main Aug 2, 2023
@markkelnar markkelnar deleted the phpstan-level-7 branch August 2, 2023 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants