= 0 && str_contains($new_lines[$prev_line_index], '@PHP-RSX-USE-01-EXCEPTION')) { // Keep the use statement if there's an exception comment $new_lines[] = $line; } else { // Skip this line (remove it) $modified = true; } } } // If modifications were made, write the file back if ($modified) { $new_contents = implode("\n", $new_lines); // Only write if the contents actually changed if ($new_contents !== $actual_contents) { file_put_contents($file_path, $new_contents); // Log the fix to console_debug if available if (function_exists('console_debug')) { console_debug('CODE_QUALITY', 'Auto-fixed: Removed unnecessary Rsx use statements from', $file_path); } } } // Don't add any violations - this rule silently fixes issues } }