All the other ways of doing it were ridiculous and much harder to read, and usually required repeating the needle expression (to get its length). I found these occurrences by grepping for various expressions, but I undoubtedly missed some. I didn't try replacing the many instances of strpos(...) === 0 with str_starts_with(...), because I think they're readable enough as-is (although less efficient). Likewise I didn't try porting strpos(...) !== false to str_contains(...). For case-insensitive comparisons, Tim Starling requested that we stick with substr_compare() because it's more efficient than calling strtolower(). On PHP < 8 these functions will be included with a polyfill via vendor/autoload.php. This is included at the beginning of includes/AutoLoader.php, so if our autoloader has been included the polyfill will be available. This means it should be safe to call these functions from any code that would not be usable without our autoloader. Three uses that Tim Starling identified as being performance-sensitive have been split out to a separate commit for porting after the switch to PHP 8. Change-Id: I113a8d052b6845852c15969a2f0e6fbbe3e9f8d9 |
||
|---|---|---|
| .. | ||
| data | ||
| Hook | ||
| AbkhazUppercaseCollation.php | ||
| BashkirUppercaseCollation.php | ||
| Collation.php | ||
| CollationCkb.php | ||
| CollationFactory.php | ||
| CustomUppercaseCollation.php | ||
| IcuCollation.php | ||
| IdentityCollation.php | ||
| NumericUppercaseCollation.php | ||
| RemoteIcuCollation.php | ||
| UppercaseCollation.php | ||