process_all_files(); $already_run = true; } } private function process_all_files(): void { // Get all files from manifest $files = Manifest::get_all(); foreach ($files as $file_path => $metadata) { // Skip non-PHP files if (($metadata['extension'] ?? '') !== 'php') { continue; } // Check for FQCN violations detected by the PHP AST parser if (isset($metadata['rsx_fqcn_violations'])) { foreach ($metadata['rsx_fqcn_violations'] as $violation) { $line = $violation['line'] ?? 0; $fqcn = $violation['fqcn'] ?? 'unknown'; // Extract the simple class name from the FQCN $parts = explode('\\', trim($fqcn, '\\')); $simple_name = end($parts); $message = "Direct FQCN reference '{$fqcn}' is not allowed. RSX classes are path-agnostic and should be referenced by simple name only."; $suggestion = "Replace '{$fqcn}' with '{$simple_name}'. The autoloader will automatically resolve the class."; // Get the code snippet if we can access the file $code_snippet = ''; if (file_exists($file_path)) { $file_contents = file_get_contents($file_path); $lines = explode("\n", $file_contents); if ($line > 0 && $line <= count($lines)) { $code_snippet = trim($lines[$line - 1]); } } $this->add_violation( $file_path, $line, $message, $code_snippet, $suggestion, 'high' ); } } } } }