Fix PHP-ALIAS-01 rule and resolve all fetch() aliasing violations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-12-26 02:44:39 +00:00
parent 7d379b2402
commit 209dd72b03
20 changed files with 64 additions and 49 deletions

View File

@@ -103,9 +103,9 @@ class FieldAliasing_CodeQualityRule extends CodeQualityRule_Abstract
} }
// Only check models - controllers are an escape hatch for custom responses // Only check models - controllers are an escape hatch for custom responses
$extends = $metadata['extends'] ?? null; $class_name = $metadata['class'] ?? null;
if ($extends !== 'Rsx_Model_Abstract') { if (!$class_name || !\App\RSpade\Core\Manifest\Manifest::php_is_subclass_of($class_name, 'Rsx_Model_Abstract')) {
return; return;
} }
@@ -176,20 +176,30 @@ class FieldAliasing_CodeQualityRule extends CodeQualityRule_Abstract
continue; continue;
} }
// Pattern: 'key' => ... // Pattern: 'key' => ... (array construction) OR $data['key'] = ... (element assignment)
// We need to analyze what's on the right side // We need to analyze what's on the right side
if (!preg_match("/['\"]([a-zA-Z_][a-zA-Z0-9_]*)['\"]\\s*=>/", $line, $key_match)) { $key = null;
continue; $value_part = null;
}
// Array construction: 'key' => value
if (preg_match("/['\"]([a-zA-Z_][a-zA-Z0-9_]*)['\"]\\s*=>/", $line, $key_match)) {
$key = $key_match[1]; $key = $key_match[1];
// Get the value part (everything after =>)
$arrow_pos = strpos($line, '=>'); $arrow_pos = strpos($line, '=>');
if ($arrow_pos === false) { $value_part = trim(substr($line, $arrow_pos + 2));
}
// Element assignment: $data['key'] = value
elseif (preg_match("/\\$[a-zA-Z_][a-zA-Z0-9_]*\\[['\"]([a-zA-Z_][a-zA-Z0-9_]*)['\"]\\]\\s*=/", $line, $key_match)) {
$key = $key_match[1];
// Find the = that's NOT part of => or ==
if (preg_match("/\\]\\s*=(?![>=])/", $line, $eq_match, PREG_OFFSET_CAPTURE)) {
$eq_pos = $eq_match[0][1] + strlen($eq_match[0][0]) - 1;
$value_part = trim(substr($line, $eq_pos + 1));
}
}
if ($key === null || $value_part === null) {
continue; continue;
} }
$value_part = trim(substr($line, $arrow_pos + 2));
// Check for ternary operator // Check for ternary operator
if ($this->is_ternary_expression($value_part)) { if ($this->is_ternary_expression($value_part)) {

View File

@@ -87,7 +87,6 @@ class Migrate_Begin_Command extends Command
// Step 4: Start MySQL again using supervisorctl // Step 4: Start MySQL again using supervisorctl
$this->info('[4] Starting MySQL server...'); $this->info('[4] Starting MySQL server...');
$this->shell_exec_privileged('mkdir -p /var/run/mysqld'); $this->shell_exec_privileged('mkdir -p /var/run/mysqld');
$this->shell_exec_privileged('chmod 777 /var/run/mysqld');
$this->shell_exec_privileged('supervisorctl start mysql 2>&1'); $this->shell_exec_privileged('supervisorctl start mysql 2>&1');
// Step 5: Wait for MySQL to be ready // Step 5: Wait for MySQL to be ready

View File

@@ -66,7 +66,6 @@ class Migrate_Rollback_Command extends Command
// Step 5: Start MySQL using supervisorctl // Step 5: Start MySQL using supervisorctl
$this->info('[5] Starting MySQL server...'); $this->info('[5] Starting MySQL server...');
$this->shell_exec_privileged('mkdir -p /var/run/mysqld'); $this->shell_exec_privileged('mkdir -p /var/run/mysqld');
$this->shell_exec_privileged('chmod 777 /var/run/mysqld');
$this->shell_exec_privileged('supervisorctl start mysql 2>&1'); $this->shell_exec_privileged('supervisorctl start mysql 2>&1');
// Step 6: Wait for MySQL to be ready // Step 6: Wait for MySQL to be ready

View File

@@ -33,7 +33,7 @@ use App\RSpade\Core\Models\User_Model;
*/ */
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: _api_keys * Table: _api_keys
* *
* @property int $id * @property int $id

View File

@@ -32,7 +32,7 @@ use App\RSpade\Core\Files\File_Storage_Model;
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: _file_attachments * Table: _file_attachments
* *
* @property int $id * @property int $id
@@ -82,7 +82,6 @@ class File_Attachment_Model extends Rsx_Site_Model_Abstract
const FILE_TYPE_DOCUMENT = 6; const FILE_TYPE_DOCUMENT = 6;
const FILE_TYPE_OTHER = 7; const FILE_TYPE_OTHER = 7;
/** __AUTO_GENERATED: */ /** __AUTO_GENERATED: */
/** __/AUTO_GENERATED */ /** __/AUTO_GENERATED */

View File

@@ -16,7 +16,7 @@ use App\RSpade\Core\Database\Models\Rsx_Model_Abstract;
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: _file_storage * Table: _file_storage
* *
* @property int $id * @property int $id

View File

@@ -14,7 +14,7 @@ use App\RSpade\Core\Models\Region_Model;
*/ */
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: countries * Table: countries
* *
* @property int $id * @property int $id

View File

@@ -12,7 +12,7 @@ use App\RSpade\Core\Database\Models\Rsx_System_Model_Abstract;
*/ */
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: ip_addresses * Table: ip_addresses
* *
* @property int $id * @property int $id

View File

@@ -24,7 +24,7 @@ use App\RSpade\Core\Session\Session;
*/ */
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: login_users * Table: login_users
* *
* @property int $id * @property int $id
@@ -33,6 +33,7 @@ use App\RSpade\Core\Session\Session;
* @property bool $is_activated * @property bool $is_activated
* @property bool $is_verified * @property bool $is_verified
* @property int $status_id * @property int $status_id
* @property mixed $timezone
* @property mixed $remember_token * @property mixed $remember_token
* @property string $last_login * @property string $last_login
* @property string $created_at * @property string $created_at

View File

@@ -14,7 +14,7 @@ use App\RSpade\Core\Models\Country_Model;
*/ */
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: regions * Table: regions
* *
* @property int $id * @property int $id

View File

@@ -14,7 +14,7 @@ use App\RSpade\Core\Models\User_Model;
*/ */
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: sites * Table: sites
* *
* @property int $id * @property int $id

View File

@@ -12,7 +12,7 @@ use App\RSpade\Core\Database\Models\Rsx_Site_Model_Abstract;
*/ */
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: user_invites * Table: user_invites
* *
* @property int $id * @property int $id

View File

@@ -25,7 +25,7 @@ use App\RSpade\Core\Models\User_Profile_Model;
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: users * Table: users
* *
* @property int $id * @property int $id
@@ -72,7 +72,6 @@ class User_Model extends Rsx_Site_Model_Abstract
const ROLE_VIEWER = 700; const ROLE_VIEWER = 700;
const ROLE_DISABLED = 800; const ROLE_DISABLED = 800;
/** __AUTO_GENERATED: */ /** __AUTO_GENERATED: */
/** __/AUTO_GENERATED */ /** __/AUTO_GENERATED */

View File

@@ -7,7 +7,7 @@ use App\RSpade\Core\Models\User_Model;
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: user_permissions * Table: user_permissions
* *
* @property int $id * @property int $id

View File

@@ -35,7 +35,7 @@ use App\RSpade\Core\Models\User_Model;
*/ */
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: user_profiles * Table: user_profiles
* *
* @property int $id * @property int $id

View File

@@ -13,7 +13,7 @@ use App\RSpade\Core\Database\Models\Rsx_Model_Abstract;
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: user_verifications * Table: user_verifications
* *
* @property int $id * @property int $id
@@ -47,7 +47,6 @@ class User_Verification_Model extends Rsx_Model_Abstract
const VERIFICATION_TYPE_EMAIL_RECOVERY = 3; const VERIFICATION_TYPE_EMAIL_RECOVERY = 3;
const VERIFICATION_TYPE_SMS_RECOVERY = 4; const VERIFICATION_TYPE_SMS_RECOVERY = 4;
/** __AUTO_GENERATED: */ /** __AUTO_GENERATED: */
/** __/AUTO_GENERATED */ /** __/AUTO_GENERATED */

View File

@@ -17,7 +17,7 @@ use App\RSpade\Core\Database\Models\Rsx_Site_Model_Abstract;
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: _search_indexes * Table: _search_indexes
* *
* @property int $id * @property int $id

View File

@@ -41,7 +41,7 @@ use App\RSpade\Core\Session\User_Agent;
*/ */
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:29
* Table: _sessions * Table: _sessions
* *
* @property int $id * @property int $id

View File

@@ -6,7 +6,7 @@ use App\RSpade\Core\Database\Models\Rsx_Model_Abstract;
/** /**
* _AUTO_GENERATED_ Database type hints - do not edit manually * _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-26 01:29:30 * Generated on: 2025-12-26 02:43:30
* Table: _flash_alerts * Table: _flash_alerts
* *
* @property int $id * @property int $id
@@ -38,7 +38,6 @@ class Flash_Alert_Model extends Rsx_Model_Abstract
const TYPE_INFO = 3; const TYPE_INFO = 3;
const TYPE_WARNING = 4; const TYPE_WARNING = 4;
/** __AUTO_GENERATED: */ /** __AUTO_GENERATED: */
/** __/AUTO_GENERATED */ /** __/AUTO_GENERATED */

View File

@@ -351,6 +351,16 @@
"created_at": "2025-12-24T21:02:13+00:00", "created_at": "2025-12-24T21:02:13+00:00",
"created_by": "root", "created_by": "root",
"command": "php artisan make:migration:safe add_timezone_to_login_users_table" "command": "php artisan make:migration:safe add_timezone_to_login_users_table"
},
"2025_12_26_023403_convert_client_status_to_enum.php": {
"created_at": "2025-12-26T02:34:03+00:00",
"created_by": "root",
"command": "php artisan make:migration:safe convert_client_status_to_enum"
},
"2025_12_26_023543_convert_client_status_to_enum.php": {
"created_at": "2025-12-26T02:35:44+00:00",
"created_by": "root",
"command": "php artisan make:migration:safe convert_client_status_to_enum"
} }
} }
} }