Fix MODEL-REL-01 and MODEL-ENUMS-01 false positives in code quality rules
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -106,8 +106,26 @@ class ModelRelations_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
$relationship_methods = [];
|
||||
$complex_relationships = [];
|
||||
|
||||
// Track multi-line comment state
|
||||
$in_multiline_comment = false;
|
||||
|
||||
// Parse each method to find relationships
|
||||
foreach ($lines as $i => $line) {
|
||||
// Track multi-line comment state
|
||||
// Check for comment start (but not if it's closed on same line)
|
||||
if (preg_match('#/\*#', $line) && !preg_match('#/\*.*\*/#', $line)) {
|
||||
$in_multiline_comment = true;
|
||||
}
|
||||
// Check for comment end
|
||||
if (preg_match('#\*/#', $line)) {
|
||||
$in_multiline_comment = false;
|
||||
continue; // Skip the closing line too
|
||||
}
|
||||
// Skip lines inside multi-line comments
|
||||
if ($in_multiline_comment) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Look for public non-static function declarations
|
||||
if (preg_match('/public\s+(?!static\s+)function\s+(\w+)\s*\(/', $line, $func_match)) {
|
||||
$method_name = $func_match[1];
|
||||
|
||||
Reference in New Issue
Block a user