| @@ -46,11 +46,11 @@ | ||
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Get the current rule options. |
| 49 | 49 | * |
| 50 | - * @param array $defaults Default options. | |
| 50 | + * @param array<string,mixed> $defaults Default options. | |
| 51 | 51 | * |
| 52 | - * @return array | |
| 52 | + * @return array<string,mixed> | |
| 53 | 53 | */ |
| 54 | 54 | function get_rule_options( $defaults = [] ) { |
| 55 | 55 | $rule = current_rule(); |
| 56 | 56 | |
| @@ -61,9 +61,9 @@ | ||
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Get the current rule extras. |
| 64 | 64 | * |
| 65 | - * @return array | |
| 65 | + * @return array<string,mixed> | |
| 66 | 66 | */ |
| 67 | 67 | function get_rule_extras() { |
| 68 | 68 | $rule = current_rule(); |
| 69 | 69 | |
| @@ -129,6 +129,11 @@ | ||
| 129 | 129 | * @return boolean |
| 130 | 130 | */ |
| 131 | 131 | function is_post_type( $post_type ) { |
| 132 | 132 | global $post; |
| 133 | - return is_object( $post ) && ( is_singular( $post_type ) || $post->post_type === $post_type ); | |
| 133 | + | |
| 134 | + if ( ! is_a( $post, '\WP_Post' ) ) { | |
| 135 | + return false; | |
| 136 | + } | |
| 137 | + | |
| 138 | + return is_singular( $post_type ) || $post->post_type === $post_type; | |
| 134 | 139 | } |