The result of a function without side effects is dropped
What it finds
trim($name); and str_replace('a', 'b', $s); as statements: these functions return a new value and leave their arguments alone, so a call whose result is dropped does nothing. The call was meant to be assigned, as $name = trim($name);.
From the rule's source, ignored_result.rs.
<?phpfunction clean($name, $list){ trim($name);tx0 reports: the result of trim is dropped str_replace('a', 'b', $name);tx0 reports: the result of str_replace is dropped array_merge($list, [1]);tx0 reports: the result of array_merge is dropped $name = trim($name); sort($list); return $name;} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/php:ignored-result" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/php:ignored-result] reason="..."tx0 explain tx0/php:ignored-result shows the same in the terminal. Found a false positive? Report it.