From 611e2694652c6cce7a1713e17777f3eba6853477 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 10 Dec 2025 07:12:47 +0000 Subject: [PATCH] Fix: Php_Fixer now updates use statements in framework files for non-developer mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/RSpade/Core/PHP/Php_Fixer.php | 34 +++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/app/RSpade/Core/PHP/Php_Fixer.php b/app/RSpade/Core/PHP/Php_Fixer.php index 7ac8c393e..3fcf65ac0 100755 --- a/app/RSpade/Core/PHP/Php_Fixer.php +++ b/app/RSpade/Core/PHP/Php_Fixer.php @@ -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) {