Skip to content

Commit

Permalink
phpstan changes for level 7
Browse files Browse the repository at this point in the history
  • Loading branch information
markkelnar committed Aug 2, 2023
1 parent 18ed5a9 commit d6c0308
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
18 changes: 9 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/Admin/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ public function validate_before_save_cb( $data, $post ) {
$existing_post = get_post( $post['ID'] );

// Overwrite new/invalid query with previous working query, or empty
$data['post_content'] = $existing_post->post_content;
if ( $existing_post ) {
$data['post_content'] = $existing_post->post_content;
}

AdminErrors::add_message( $e->getMessage() );
}
Expand Down Expand Up @@ -286,7 +288,9 @@ public function make_excerpt_column_sortable_in_admin_cb( $columns ) {
* @return array
*/
public function wp_editor_settings( $settings, $editor_id ) {
if ( 'content' === $editor_id && Document::TYPE_NAME === get_current_screen()->post_type ) {
$screen = get_current_screen();

if ( $screen && 'content' === $editor_id && Document::TYPE_NAME === $screen->post_type ) {
$settings['tinymce'] = false;
$settings['quicktags'] = false;
$settings['media_buttons'] = false;
Expand Down
13 changes: 10 additions & 3 deletions src/Cache/Invalidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function init() {
/**
* Return a list of ignored meta keys
*
* @return array|null
* @return array
*/
public static function get_ignored_meta_keys() {
if ( null !== self::$ignored_meta_keys ) {
Expand Down Expand Up @@ -542,6 +542,10 @@ public function on_transition_post_status_cb( $new_status, $old_status, WP_Post

$post_type_object = get_post_type_object( $post->post_type );

if ( ! $post_type_object instanceof \WP_Post_Type ) {
return;
}

// If the post type is not public and not publicly queryable
// don't track it
if ( false === $post_type_object->public && false === $post_type_object->publicly_queryable ) {
Expand Down Expand Up @@ -578,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 );

// if we create a post
// we need to purge lists of the type
Expand Down Expand Up @@ -731,6 +734,10 @@ public function on_postmeta_change_cb( $meta_id, $post_id, $meta_key, $meta_valu

$post_type_object = get_post_type_object( $post->post_type );

if ( ! $post_type_object instanceof \WP_Post_Type ) {
return;
}

// If the post type is not public and not publicly queryable
// don't track it
if ( false === $post_type_object->public && false === $post_type_object->publicly_queryable ) {
Expand Down

0 comments on commit d6c0308

Please sign in to comment.