Enhance refactor commands with controller-aware Route() updates and fix code quality violations
Add semantic token highlighting for 'that' variable and comment file references in VS Code extension Add Phone_Text_Input and Currency_Input components with formatting utilities Implement client widgets, form standardization, and soft delete functionality Add modal scroll lock and update documentation Implement comprehensive modal system with form integration and validation Fix modal component instantiation using jQuery plugin API Implement modal system with responsive sizing, queuing, and validation support Implement form submission with validation, error handling, and loading states Implement country/state selectors with dynamic data loading and Bootstrap styling Revert Rsx::Route() highlighting in Blade/PHP files Target specific PHP scopes for Rsx::Route() highlighting in Blade Expand injection selector for Rsx::Route() highlighting Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls Update jqhtml packages to v2.2.165 Add bundle path validation for common mistakes (development mode only) Create Ajax_Select_Input widget and Rsx_Reference_Data controller Create Country_Select_Input widget with default country support Initialize Tom Select on Select_Input widgets Add Tom Select bundle for enhanced select dropdowns Implement ISO 3166 geographic data system for country/region selection Implement widget-based form system with disabled state support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,18 @@ class RefactorPhpClass_Command extends Command
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Step 6.5: Check if this is a controller (subclass of Rsx_Controller)
|
||||
$is_controller = false;
|
||||
try {
|
||||
if (Manifest::php_is_subclass_of($old_class, 'Rsx_Controller_Abstract')) {
|
||||
$is_controller = true;
|
||||
$this->info("");
|
||||
$this->info("<fg=cyan>Detected controller class - will also update Route() references</>");
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// Class might not be loaded, skip controller check
|
||||
}
|
||||
|
||||
// Step 7: Apply changes
|
||||
$this->info("");
|
||||
$this->info("Applying changes...");
|
||||
@@ -125,6 +137,20 @@ class RefactorPhpClass_Command extends Command
|
||||
$this->info("");
|
||||
$this->info("<fg=green>Successfully updated {$updated_count} file(s)</>");
|
||||
|
||||
// Step 7.5: If controller, do additional Route() replacements
|
||||
if ($is_controller) {
|
||||
$this->info("");
|
||||
$this->info("Updating Route() references in rsx/ files...");
|
||||
|
||||
$route_updated_count = $updater->update_controller_route_references($old_class, $new_class);
|
||||
|
||||
if ($route_updated_count > 0) {
|
||||
$this->info("<fg=green>✓</> Updated Route() references in {$route_updated_count} file(s)");
|
||||
} else {
|
||||
$this->line("<fg=gray>No Route() references found</>");
|
||||
}
|
||||
}
|
||||
|
||||
// Step 8: Log refactor operation for upstream tracking
|
||||
RefactorLog::log_refactor(
|
||||
"rsx:refactor:rename_php_class {$old_class} {$new_class}",
|
||||
@@ -138,6 +164,22 @@ class RefactorPhpClass_Command extends Command
|
||||
$this->rename_source_file_if_needed($source_path, $new_class, $source_metadata);
|
||||
}
|
||||
|
||||
// Step 10: Final grep for any remaining references
|
||||
$this->info("");
|
||||
$this->info("Checking for remaining references to '{$old_class}'...");
|
||||
|
||||
$remaining_files = $this->grep_remaining_references($old_class);
|
||||
|
||||
if (!empty($remaining_files)) {
|
||||
$this->warn("");
|
||||
$this->warn("Found {old_class} in " . count($remaining_files) . " file(s) (manual review needed):");
|
||||
foreach ($remaining_files as $file) {
|
||||
$this->warn(" - {$file}");
|
||||
}
|
||||
} else {
|
||||
$this->info("<fg=green>✓</> No remaining references found");
|
||||
}
|
||||
|
||||
$this->info("");
|
||||
$this->info("Next steps:");
|
||||
$this->info(" 1. Review changes: git diff");
|
||||
@@ -192,4 +234,49 @@ class RefactorPhpClass_Command extends Command
|
||||
rename($old_absolute, $new_absolute);
|
||||
$this->info("<fg=green>✓</> Renamed: {$current_filename} → {$suggested_filename}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Grep for remaining references to the old class name in ./rsx
|
||||
*
|
||||
* @param string $old_class Old class name to search for
|
||||
* @return array List of relative file paths where the class name still appears
|
||||
*/
|
||||
protected function grep_remaining_references(string $old_class): array
|
||||
{
|
||||
$rsx_path = base_path('rsx');
|
||||
|
||||
if (!is_dir($rsx_path)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Use grep to find files containing the old class name
|
||||
// -r = recursive
|
||||
// -l = list files only
|
||||
// --include = only search these file types
|
||||
// -w = match whole word
|
||||
$command = sprintf(
|
||||
'grep -r -l -w %s --include="*.php" --include="*.blade.php" --include="*.js" --include="*.jqhtml" %s 2>/dev/null',
|
||||
escapeshellarg($old_class),
|
||||
escapeshellarg($rsx_path)
|
||||
);
|
||||
|
||||
$output = shell_exec($command);
|
||||
|
||||
if (empty($output)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$files = explode("\n", trim($output));
|
||||
|
||||
// Convert to relative paths
|
||||
$relative_files = [];
|
||||
foreach ($files as $file) {
|
||||
if (empty($file)) {
|
||||
continue;
|
||||
}
|
||||
$relative_files[] = str_replace(base_path() . '/', '', $file);
|
||||
}
|
||||
|
||||
return $relative_files;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user