Skip to content

Commit

Permalink
KSES: Adjust type for post_parent param (#12934)
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Jan 16, 2023
1 parent ccd50d5 commit c15b362
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions includes/KSES.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*
* @phpstan-type PostData array{
* post_parent: int,
* post_parent: int|string|null,
* post_type: string,
* post_content?: string,
* post_content_filtered?: string
Expand Down Expand Up @@ -780,11 +780,11 @@ function ( $matches ) {
*
* @since 1.22.0
*
* @param string $post_type Post type slug.
* @param int|null $post_parent Parent post ID.
* @param string $post_type Post type slug.
* @param int|string|null $post_parent Parent post ID.
* @return bool Whether the user can edit the provided post type.
*/
private function is_allowed_post_type( string $post_type, ?int $post_parent ): bool {
private function is_allowed_post_type( string $post_type, $post_parent ): bool {
if ( $this->story_post_type->get_slug() === $post_type && $this->story_post_type->has_cap( 'edit_posts' ) ) {
return true;
}
Expand All @@ -798,7 +798,7 @@ private function is_allowed_post_type( string $post_type, ?int $post_parent ): b
(
'revision' === $post_type &&
! empty( $post_parent ) &&
get_post_type( $post_parent ) === $this->story_post_type->get_slug()
get_post_type( (int) $post_parent ) === $this->story_post_type->get_slug()
) &&
$this->story_post_type->has_cap( 'edit_posts' )
) {
Expand Down

0 comments on commit c15b362

Please sign in to comment.