mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 11:14:36 +00:00
Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50. Includes minor code layout fixes for better readability. See #49542. git-svn-id: https://develop.svn.wordpress.org/trunk@47550 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -343,7 +343,7 @@ final class WP_Comment {
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset( $name ) {
|
||||
if ( in_array( $name, $this->post_fields ) && 0 !== (int) $this->comment_post_ID ) {
|
||||
if ( in_array( $name, $this->post_fields, true ) && 0 !== (int) $this->comment_post_ID ) {
|
||||
$post = get_post( $this->comment_post_ID );
|
||||
return property_exists( $post, $name );
|
||||
}
|
||||
@@ -360,7 +360,7 @@ final class WP_Comment {
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get( $name ) {
|
||||
if ( in_array( $name, $this->post_fields ) ) {
|
||||
if ( in_array( $name, $this->post_fields, true ) ) {
|
||||
$post = get_post( $this->comment_post_ID );
|
||||
return $post->$name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user