wiki.techinc.nl/includes/collation
Aryeh Gregor 7b4b0135b9 Use str_starts_with/str_ends_with
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
2022-05-02 10:59:58 +03:00
..
data
Hook
AbkhazUppercaseCollation.php Add Ӷ and Ԥ to Abkhaz collation 2022-02-15 09:21:03 +00:00
BashkirUppercaseCollation.php
Collation.php Use MainConfigNames instead of string literals, #4 2022-04-26 19:03:37 +03:00
CollationCkb.php
CollationFactory.php Use MainConfigNames instead of string literals, #4 2022-04-26 19:03:37 +03:00
CustomUppercaseCollation.php Add explicit casts between scalar types 2022-03-08 16:59:01 +00:00
IcuCollation.php Use str_starts_with/str_ends_with 2022-05-02 10:59:58 +03:00
IdentityCollation.php
NumericUppercaseCollation.php Add explicit casts between scalar types 2022-03-01 18:19:33 +01:00
RemoteIcuCollation.php RemoteIcuCollation 2021-12-13 22:13:10 +00:00
UppercaseCollation.php