Skip to content

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

$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