Coding Standards: Use strict comparison in `WP_Post` where possible.

Props andizer.
Fixes #46508.
Built from https://develop.svn.wordpress.org/trunk@44914


git-svn-id: http://core.svn.wordpress.org/trunk@44745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-03-15 21:55:50 +00:00
parent cd01464b52
commit dd83d8f4c9
2 changed files with 11 additions and 11 deletions

View File

@ -276,19 +276,19 @@ final class WP_Post {
* @return bool
*/
public function __isset( $key ) {
if ( 'ancestors' == $key ) {
if ( 'ancestors' === $key ) {
return true;
}
if ( 'page_template' == $key ) {
if ( 'page_template' === $key ) {
return true;
}
if ( 'post_category' == $key ) {
if ( 'post_category' === $key ) {
return true;
}
if ( 'tags_input' == $key ) {
if ( 'tags_input' === $key ) {
return true;
}
@ -304,11 +304,11 @@ final class WP_Post {
* @return mixed
*/
public function __get( $key ) {
if ( 'page_template' == $key && $this->__isset( $key ) ) {
if ( 'page_template' === $key && $this->__isset( $key ) ) {
return get_post_meta( $this->ID, '_wp_page_template', true );
}
if ( 'post_category' == $key ) {
if ( 'post_category' === $key ) {
if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) {
$terms = get_the_terms( $this, 'category' );
}
@ -320,7 +320,7 @@ final class WP_Post {
return wp_list_pluck( $terms, 'term_id' );
}
if ( 'tags_input' == $key ) {
if ( 'tags_input' === $key ) {
if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) {
$terms = get_the_terms( $this, 'post_tag' );
}
@ -333,7 +333,7 @@ final class WP_Post {
}
// Rest of the values need filtering.
if ( 'ancestors' == $key ) {
if ( 'ancestors' === $key ) {
$value = get_post_ancestors( $this );
} else {
$value = get_post_meta( $this->ID, $key, true );
@ -355,11 +355,11 @@ final class WP_Post {
* @return array|bool|object|WP_Post
*/
public function filter( $filter ) {
if ( $this->filter == $filter ) {
if ( $this->filter === $filter ) {
return $this;
}
if ( $filter == 'raw' ) {
if ( 'raw' === $filter ) {
return self::get_instance( $this->ID );
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-alpha-44913';
$wp_version = '5.2-alpha-44914';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.