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:
@@ -146,6 +146,32 @@ class RenamePhpClassFunction_Command extends Command
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 3.5: If controller, update Route() references
|
||||
if ($method_was_renamed) {
|
||||
$is_controller = false;
|
||||
try {
|
||||
if (Manifest::php_is_subclass_of($class_name, 'Rsx_Controller_Abstract')) {
|
||||
$is_controller = true;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// Class might not be loaded, skip controller check
|
||||
}
|
||||
|
||||
if ($is_controller) {
|
||||
$this->info("");
|
||||
$this->info("Detected controller class - updating Route() action references...");
|
||||
|
||||
$updater = $updater ?? new MethodUpdater();
|
||||
$route_updated_count = $updater->update_controller_action_route_references($class_name, $old_method, $new_method);
|
||||
|
||||
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() action references found</>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 4: Recursive subclass renaming (unless --skip-subclasses)
|
||||
if (!$skip_subclasses) {
|
||||
$this->info("");
|
||||
@@ -182,6 +208,22 @@ class RenamePhpClassFunction_Command extends Command
|
||||
$class_path
|
||||
);
|
||||
|
||||
// Phase 5: Final grep for any remaining references
|
||||
$this->info("");
|
||||
$this->info("Checking for remaining references to '{$class_name}' and '{$old_method}' on same line...");
|
||||
|
||||
$remaining_files = $this->grep_remaining_method_references($class_name, $old_method);
|
||||
|
||||
if (!empty($remaining_files)) {
|
||||
$this->warn("");
|
||||
$this->warn("Found {$class_name} and {$old_method} on same line 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");
|
||||
}
|
||||
|
||||
// Success summary
|
||||
$this->info("");
|
||||
$this->info("<fg=green>✓</> Successfully renamed {$class_name}::{$old_method} → {$class_name}::{$new_method}");
|
||||
@@ -193,6 +235,61 @@ class RenamePhpClassFunction_Command extends Command
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grep for files where both class name and old method name appear on the same line
|
||||
*
|
||||
* @param string $class_name Class name to search for
|
||||
* @param string $old_method Old method name to search for
|
||||
* @return array List of relative file paths where both appear on same line
|
||||
*/
|
||||
protected function grep_remaining_method_references(string $class_name, string $old_method): array
|
||||
{
|
||||
$rsx_path = base_path('rsx');
|
||||
|
||||
if (!is_dir($rsx_path)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Use grep to find files containing both class name and method name on same line
|
||||
// We'll grep for the class name, then check each result for method name on same line
|
||||
$command = sprintf(
|
||||
'grep -r -l -w %s --include="*.php" --include="*.blade.php" --include="*.js" --include="*.jqhtml" %s 2>/dev/null',
|
||||
escapeshellarg($class_name),
|
||||
escapeshellarg($rsx_path)
|
||||
);
|
||||
|
||||
$output = shell_exec($command);
|
||||
|
||||
if (empty($output)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$candidate_files = explode("\n", trim($output));
|
||||
$matching_files = [];
|
||||
|
||||
// For each file that contains the class name, check if any line has both class and method
|
||||
foreach ($candidate_files as $file) {
|
||||
if (empty($file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read file and check each line
|
||||
$content = file_get_contents($file);
|
||||
$lines = explode("\n", $content);
|
||||
|
||||
foreach ($lines as $line) {
|
||||
// Check if line contains both class name and method name as whole words
|
||||
if (preg_match('/\b' . preg_quote($class_name, '/') . '\b/', $line) &&
|
||||
preg_match('/\b' . preg_quote($old_method, '/') . '\b/', $line)) {
|
||||
$matching_files[] = str_replace(base_path() . '/', '', $file);
|
||||
break; // Found in this file, no need to check more lines
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_unique($matching_files);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a method in a class file and return metadata
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user