[wp-trac] [WordPress Trac] #57213: Coding standards : Use Strict Comparison except Loose Comparison wp-includes/class-wp-hook.php

WordPress Trac noreply at wordpress.org
Mon Jun 2 00:27:12 UTC 2025


#57213: Coding standards : Use Strict Comparison except Loose Comparison wp-
includes/class-wp-hook.php
--------------------------+-------------------------------
 Reporter:  rockonshajib  |       Owner:  (none)
     Type:  enhancement   |      Status:  closed
 Priority:  normal        |   Milestone:  Future Release
Component:  General       |     Version:  4.7
 Severity:  normal        |  Resolution:  duplicate
 Keywords:  has-patch     |     Focuses:  coding-standards
--------------------------+-------------------------------
Changes (by SirLouen):

 * keywords:  has-patch needs-testing => has-patch
 * status:  new => closed
 * resolution:   => duplicate


Comment:

 Duplicate of #58831.

 Funny to see that here people were discussing on a ton of things,
 including the performance implications and meanwhile
 [https://core.trac.wordpress.org/ticket/58831#comment:38 this was merged]
 under the hood and noone even noticed [56511] (and not even with static
 casting as proposed by @mukesh27), and obviously not with unit-tests.

 By the way, @johnbillion, just as a curiosity, on the paper a type cast
 with a `===` can't have an impact compared with a regular comparison. For
 all scenarios where type conversion happens the complexity is going to be
 the same, except for strings, where casting from `string` to `int` (in
 case it's ever cast) will have a constant complexity, while a classic
 comparison will need to ultimately do the same. So I doubt that
 performance testing was required at all, and I doubt that these changes
 were required at all (other than aesthetic purposes).

 Anyway, time to close this as it has been already fixed.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57213#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list