wiki.techinc.nl/includes/search
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
..
Entity Fix typos in comments (S) 2022-01-09 23:28:53 +05:30
Hook
searchwidgets phan: Disable null_casts_as_any_type setting 2022-03-21 18:25:07 +00:00
BaseSearchResultSet.php phan: Disable scalar_implicit_cast setting 2022-03-18 18:52:24 +00:00
DummySearchIndexFieldDefinition.php
FauxSearchResult.php
FauxSearchResultSet.php
ISearchResultSet.php
NullIndexField.php
PaginatingSearchEngine.php
ParserOutputSearchDataExtractor.php
PerRowAugmentor.php
PrefixSearch.php
ResultAugmentor.php
ResultSetAugmentor.php
RevisionSearchResult.php
RevisionSearchResultTrait.php search: Improve null documentation on RevisionSearchResultTrait 2022-03-14 20:52:31 +00:00
SearchDatabase.php rdbms: Deprecate getLazyConnectionRef 2022-03-03 13:15:44 +01:00
SearchEngine.php Use str_starts_with/str_ends_with 2022-05-02 10:59:58 +03:00
SearchEngineConfig.php Use MainConfigNames instead of string literals, #2 2022-04-13 18:55:46 +03:00
SearchEngineDummy.php
SearchEngineFactory.php Use updated ObjectFactory namespace 2022-03-09 23:04:51 +00:00
SearchExactMatchRescorer.php
SearchHighlighter.php Use MainConfigNames instead of string literals, #2 2022-04-13 18:55:46 +03:00
SearchIndexField.php
SearchIndexFieldDefinition.php
SearchMySQL.php search: Fix various scalar types to match documentation 2022-03-08 19:39:57 +01:00
SearchNearMatcher.php Use MainConfigNames instead of string literals, #2 2022-04-13 18:55:46 +03:00
SearchNearMatchResultSet.php
SearchPostgres.php search: Use NS_MAIN instead of hard coded 0 2022-03-07 21:09:46 +01:00
SearchResult.php
SearchResultSet.php Fix various documentation related to null types 2022-02-26 10:31:24 +01:00
SearchResultSetTrait.php
SearchResultTrait.php
SearchSqlite.php search: Use NS_MAIN instead of hard coded 0 2022-03-07 21:09:46 +01:00
SearchSuggestion.php
SearchSuggestionSet.php search: Fix various scalar types to match documentation 2022-03-08 19:39:57 +01:00
SqlSearchResult.php Use MainConfigNames instead of string literals, #2 2022-04-13 18:55:46 +03:00
SqlSearchResultSet.php search: Fix various scalar types to match documentation 2022-03-08 19:39:57 +01:00
StringPrefixSearch.php
TitlePrefixSearch.php