Useless Flag ‘s’ (DOTALL)
Identifier: regex.lint.flag.useless.s
When it triggers: The pattern sets the s (DotAll) modifier but contains no unescaped dot outside a character class. The s flag only affects .: an escaped \. and a . inside [...] are literal dots, which it leaves alone.
Message: Flag 's' is useless: the pattern contains no unescaped dot outside a character class.
Visual Explanation:
/^\d+\.\d+$/s
-> no unescaped dot outside a class
-> s has no effect
Example:
// Warning: DotAll does nothing because there is no dot
preg_match('/^user_id:\d+$/s', $input);
// Preferred: Remove unnecessary flag
preg_match('/^user_id:\d+$/', $input);
Fix: Drop the flag or introduce a dot if intended.
Read more:
Try it. Open /^user_id:\d+$/s in the playground: the finding is in the Diagnostics tab.