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

KSES: Adjust type for post_parent param #12934

Merged
merged 1 commit into from
Jan 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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