Problem
Code assumes coverage.xml exists and is valid, leading to cryptic errors when it's not.
Current Risk
File: app/Services/CloverParser.php
- No validation that coverage file exists
- No validation that XML is well-formed
- Silent failures or PHP warnings
Proposed Implementation
if (!file_exists($cloverPath)) {
throw new \RuntimeException("Coverage file not found: {$cloverPath}");
}
$xml = @simplexml_load_file($cloverPath);
if ($xml === false) {
throw new \RuntimeException("Invalid coverage XML at: {$cloverPath}");
}
Benefits
- Clear error messages for missing/invalid coverage files
- Prevents XML parsing errors
- Better debugging experience
Problem
Code assumes coverage.xml exists and is valid, leading to cryptic errors when it's not.
Current Risk
File:
app/Services/CloverParser.phpProposed Implementation
Benefits