It is common to see people use multibyte string functions (like mb_strlen) instead of their common analogs (like strlen), while not writing any tests exploiting multibyte functionality.
In this situations mutators as simple as below could be of use:
- if (mb_strlen($str) < 10) {
+ if (strlen($str) < 10) {
And similar mutators for functions like mb_substr, and others.
(This mutator could simply check if a function call starts with mb_, and then replace the function name with a prefix-less function if it exists, though this may not be the best approach.)
This mutator could simply check if a function call starts with
mb_, and then replace the function name with a prefix-less function if it exists, though this may not be the best approach
I'd prefer to have a map which holds mb_ function names as key, and non mb_ variants as the value, and then we simply check if the function name is a key in the map, and replace it with the value.
Great idea.
As I understand, both your implementation suggestions mean we will have 1 mutator class that mutates N functions, right?
In this case, we need settings to be able to disable any of the function mutations.
Funny I already have this mutator stashed on mine laptop ;-) Will create PR when I get back to home
As the PR is merged do we closes the issue ?
BTW thanks for great feedback during review.
Sure, should be closed
BTW, if the Fixes #654 had been used instead of Relates to issue #654, this issue would have been closed automatically (also, the bot would have added needed labels automatically).
Thanks for adding this feature, nice contribution!
Most helpful comment
Funny I already have this mutator stashed on mine laptop ;-) Will create PR when I get back to home