Fix: Php_Fixer now updates use statements in framework files for non-developer mode
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -136,13 +136,23 @@ class Php_Fixer
|
||||
return false;
|
||||
}
|
||||
|
||||
// If not in framework developer mode, only process files in rsx/
|
||||
if (!config('rsx.code_quality.is_framework_developer', false)) {
|
||||
if (!str_starts_with($file_path, 'rsx/')) {
|
||||
return false;
|
||||
}
|
||||
// Determine if this is a framework file (app/RSpade/) vs user file (rsx/)
|
||||
$is_rsx_file = str_starts_with($file_path, 'rsx/');
|
||||
$is_framework_file = str_starts_with($file_path, 'app/RSpade/');
|
||||
$is_framework_developer = config('rsx.code_quality.is_framework_developer', false);
|
||||
|
||||
// Skip files not in rsx/ or app/RSpade/
|
||||
if (!$is_rsx_file && !$is_framework_file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Determine what fixes to apply based on mode and file location
|
||||
// - Framework developer mode: full fixes on all files
|
||||
// - Non-framework developer mode:
|
||||
// - rsx/ files: full fixes
|
||||
// - app/RSpade/ files: ONLY use statement fixes (for class override support)
|
||||
$use_statements_only = !$is_framework_developer && $is_framework_file;
|
||||
|
||||
$absolute_path = base_path($file_path);
|
||||
$original_content = file_get_contents($absolute_path);
|
||||
|
||||
@@ -167,11 +177,19 @@ class Php_Fixer
|
||||
}
|
||||
|
||||
// Apply fixes sequentially
|
||||
// For framework files in non-developer mode, only fix use statements
|
||||
$modified_content = $original_content;
|
||||
$modified_content = self::__fix_namespace($file_path, $modified_content, $step_2_manifest_data);
|
||||
|
||||
if (!$use_statements_only) {
|
||||
$modified_content = self::__fix_namespace($file_path, $modified_content, $step_2_manifest_data);
|
||||
}
|
||||
|
||||
$modified_content = self::__fix_use_statements($file_path, $modified_content, $step_2_manifest_data);
|
||||
$modified_content = self::__fix_model_relationships($file_path, $modified_content, $step_2_manifest_data);
|
||||
$modified_content = self::__fix_attribute_namespacing($file_path, $modified_content, $step_2_manifest_data);
|
||||
|
||||
if (!$use_statements_only) {
|
||||
$modified_content = self::__fix_model_relationships($file_path, $modified_content, $step_2_manifest_data);
|
||||
$modified_content = self::__fix_attribute_namespacing($file_path, $modified_content, $step_2_manifest_data);
|
||||
}
|
||||
|
||||
// Save if modified
|
||||
if ($modified_content !== $original_content) {
|
||||
|
||||
Reference in New Issue
Block a user