Task #99451
Updated by Sybille Peters almost 2 years ago
h2. Problems 1. The order is reversed: the values in ->inSet which are passed to FIND_IN_SET are reversed 2. argument names do not clearly reflect what is needle, what is haystack, what is the comma separated list 3. PHPDoc is vague, possibly also misleading: > $fieldName The field name. > string $value Argument to be used in FIND_IN_SET() comparison. 4. Possibly it might be good ideat to rename the function name (or create a new one and deprecate the old) as it is not a simple FIND_IN_SET, it is a FIND_IN_SET where the haystack refers to is a database field name fieldname which contains a comma separated list of values h2. Suggestions To mitigate this, I think at least the following should be done: - function argument names should be named in a way which makes it intuitive. For example, use names such as "needle" and "haystack" or "pattern" and "fieldList" as is customary in PHP and / or SQL. - make PHPDoc more specific if helpful in addition to argument names. Remove explanations which only repeat the name of the argumen. E.g. "field name" as explanation for fieldName is unnecessary fluff. - possibly improve documentation: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Database/ExpressionBuilder/Index.html#comparisons. Apply same principles here.