[wp-trac] [WordPress Trac] #58139: Strict type comparison
WordPress Trac
noreply at wordpress.org
Mon Apr 17 14:06:23 UTC 2023
#58139: Strict type comparison
--------------------------------+------------------------------
Reporter: mujuonly | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Networks and Sites | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: multisite
--------------------------------+------------------------------
Comment (by jankyz):
Even if those are strings this condition checks if each has value '1' it
means true
cast to (string) won't change anything here
{{{#!php
<?php
if ( '1' == $blog['deleted'] ) {}
}}}
we can simply reverse the condition and use `===`
{{{#!php
<?php
if ( $blog['deleted'] === '1' ) {}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58139#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list