Coding Standards: Use strict comparison where static strings are involved.

This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.

git-svn-id: https://develop.svn.wordpress.org/trunk@47808 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-05-16 18:40:52 +00:00
parent 36e4db6b01
commit 6742d0d7a6
160 changed files with 1143 additions and 1007 deletions
+6 -4
View File
@@ -132,7 +132,7 @@ function edit_user( $user_id = 0 ) {
$user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false';
}
$user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : '';
$user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' === $_POST['comment_shortcuts'] ? 'true' : '';
$user->use_ssl = 0;
if ( ! empty( $_POST['use_ssl'] ) ) {
@@ -142,7 +142,7 @@ function edit_user( $user_id = 0 ) {
$errors = new WP_Error();
/* checking that username has been typed */
if ( '' == $user->user_login ) {
if ( '' === $user->user_login ) {
$errors->add( 'user_login', __( '<strong>Error</strong>: Please enter a username.' ) );
}
@@ -474,7 +474,9 @@ function default_password_nag_handler( $errors = false ) {
}
// get_user_setting() = JS-saved UI setting. Else no-js-fallback code.
if ( 'hide' == get_user_setting( 'default_password_nag' ) || isset( $_GET['default_password_nag'] ) && '0' == $_GET['default_password_nag'] ) {
if ( 'hide' === get_user_setting( 'default_password_nag' )
|| isset( $_GET['default_password_nag'] ) && '0' == $_GET['default_password_nag']
) {
delete_user_setting( 'default_password_nag' );
update_user_option( $user_ID, 'default_password_nag', false, true );
}
@@ -509,7 +511,7 @@ function default_password_nag_edit_user( $user_ID, $old_data ) {
function default_password_nag() {
global $pagenow;
// Short-circuit it.
if ( 'profile.php' == $pagenow || ! get_user_option( 'default_password_nag' ) ) {
if ( 'profile.php' === $pagenow || ! get_user_option( 'default_password_nag' ) ) {
return;
}