Hi

On 2026-11-23 23:52, Andrew F wrote:
The unqualified names of the three classes are also awfully generic and potentially preclude future extensions: There clearly are more possible ways of “matching strings” than a scan for (sub)string literals. The new stdlib APIs that we've introduced lately clearly specify the “algorithm” or standard they implement in the name (e.g. `Random\Engine\Xoshiro256StarStar` or `Uri\Rfc3986\Uri`).

I have to disagree with this bit, though. The fundamental functionality which these methods provide is string matching and replacement. The use of Aho-Corasick to implement this is an implementation detail which users should not need to be concerned with, and which PHP should be able to change if a better implementation is found. (By way of example: the standard sorting function is called sort(), not quicksort().)

Yes. I acknowledge that myself in the *literal sentence* that follows after the part you quoted. My point about “this is a specific type of matching that is being performed by those classes” stands though, and I believe the classes should be renamed.

Best regards
Tim Düsterhus

Reply via email to