FractionalModuloOperand
error native on by defaultGroup: Probable bugs
Identify modulo when either operand is a proven finite fractional numeric value with a nonzero fractional part. Integral floats and unknown numeric strings are excluded.
Detection
A case condition runs before its own statements, including a return or break. At file level, a preceding unconditional exit makes later statements unreachable just as it does inside a namespace block.
Report modulo when either operand is a proven finite fractional numeric value with a nonzero fractional part. Integral floats and unknown numeric strings are excluded.
Resolve builtin functions, classes, constants and methods, including imports and supported named arguments. Follow only bounded local facts within one lexical scope. Receiver and argument provenance must establish the specific API contract; variable names and comments never prove intent.
An endless literal-truth loop hides following statements only when no break or goto can leave it. A goto to a label outside the loop preserves reachability there; PHP string escape decoding determines literal truth. Report one finding per violating operation. A reachable path, unchanged value identity and applicable API behavior are required. Intervening mutation, unknown calls involving tracked values, escaped aliases or exhausted analysis budgets invalidate proof.
A variable operand loses its proven value when the enclosing local scope lets it change outside the tracked assignments: a closure captures any variable by reference,
extract()or single-argumentparse_str()writes the local symbol table. In file scope the variable is a global, so a call to a function that is not a resolved builtin, a method or static call, or an object construction also drops the proof. Such code placed entirely after the modulo is ignored unless the modulo sits inside a loop of the same scope.gotojumps are followed like loops: a write the operation can be reached from again, through a jump back, drops the proof, a write placed after it that no jump leads back from does not. A scope that contains bothgotoandtrynever yields a proven variable value.
Exceptions (no report)
- Exclude unresolved required symbols, user-defined lookalikes, incomplete syntax, unknown required values and unsupported versions.
- Both
@custos-ignore FractionalModuloOperandand@noinspection FractionalModuloOperandsuppress this native rule.
Fix
None. A repair requires a semantic decision or application error-handling policy.
PHP versions
Available in PHP 5.3–8.5 where the referenced API exists. Do not apply extension contracts when the resolved API is unavailable. Gate syntax and version-specific behavior to the configured target.
Configure
In custos.json:
{
"rules": {
"FractionalModuloOperand": {
"enabled": false
}
}
}Suppress
Before the statement or declaration (or the first statement of the file):
// @custos-ignore FractionalModuloOperand