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
$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;
}
@@ -176,20 +176,30 @@ class FieldAliasing_CodeQualityRule extends CodeQualityRule_Abstract
continue;
}
// Pattern: 'key' => ...
// Pattern: 'key' => ... (array construction) OR $data['key'] = ... (element assignment)
// We need to analyze what's on the right side
if (!preg_match("/['\"]([a-zA-Z_][a-zA-Z0-9_]*)['\"]\\s*=>/", $line, $key_match)) {
continue;
$key = null;
$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];
$arrow_pos = strpos($line, '=>');
$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));
}
}
$key = $key_match[1];
// Get the value part (everything after =>)
$arrow_pos = strpos($line, '=>');
if ($arrow_pos === false) {
if ($key === null || $value_part === null) {
continue;
}
$value_part = trim(substr($line, $arrow_pos + 2));
// Check for ternary operator
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
$this->info('[4] Starting MySQL server...');
$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');
// 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
$this->info('[5] Starting MySQL server...');
$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');
// 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
* Generated on: 2025-12-26 01:29:30
* Generated on: 2025-12-26 02:43:29
* Table: _api_keys
*
* @property int $id
@@ -53,7 +53,7 @@ use App\RSpade\Core\Models\User_Model;
* @mixin \Eloquent
*/
class Api_Key_Model extends Rsx_System_Model_Abstract
{
{
protected $table = '_api_keys';
public static $enums = [];

View File

@@ -32,7 +32,7 @@ use App\RSpade\Core\Files\File_Storage_Model;
/**
* _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
*
* @property int $id
@@ -70,7 +70,7 @@ use App\RSpade\Core\Files\File_Storage_Model;
* @mixin \Eloquent
*/
class File_Attachment_Model extends Rsx_Site_Model_Abstract
{
{
/**
* _AUTO_GENERATED_ Enum constants
*/
@@ -82,7 +82,6 @@ class File_Attachment_Model extends Rsx_Site_Model_Abstract
const FILE_TYPE_DOCUMENT = 6;
const FILE_TYPE_OTHER = 7;
/** __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
* Generated on: 2025-12-26 01:29:30
* Generated on: 2025-12-26 02:43:29
* Table: _file_storage
*
* @property int $id
@@ -30,7 +30,7 @@ use App\RSpade\Core\Database\Models\Rsx_Model_Abstract;
* @mixin \Eloquent
*/
class File_Storage_Model extends Rsx_Model_Abstract
{
{
// Required static properties from parent abstract class
public static $enums = [];
public static $rel = [];

View File

@@ -14,7 +14,7 @@ use App\RSpade\Core\Models\Region_Model;
*/
/**
* _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
*
* @property int $id
@@ -32,7 +32,7 @@ use App\RSpade\Core\Models\Region_Model;
* @mixin \Eloquent
*/
class Country_Model extends Rsx_Model_Abstract
{
{
public static $enums = [];
protected $table = 'countries';

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
* Generated on: 2025-12-26 01:29:30
* Generated on: 2025-12-26 02:43:29
* Table: ip_addresses
*
* @property int $id
@@ -30,7 +30,7 @@ use App\RSpade\Core\Database\Models\Rsx_System_Model_Abstract;
* @mixin \Eloquent
*/
class Ip_Address_Model extends Rsx_System_Model_Abstract
{
{
/**
* Enum field definitions
* @var array

View File

@@ -24,7 +24,7 @@ use App\RSpade\Core\Session\Session;
*/
/**
* _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
*
* @property int $id
@@ -33,6 +33,7 @@ use App\RSpade\Core\Session\Session;
* @property bool $is_activated
* @property bool $is_verified
* @property int $status_id
* @property mixed $timezone
* @property mixed $remember_token
* @property string $last_login
* @property string $created_at
@@ -60,7 +61,7 @@ class Login_User_Model extends Rsx_Model_Abstract implements
\Illuminate\Contracts\Auth\Authenticatable,
\Illuminate\Contracts\Auth\Access\Authorizable,
\Illuminate\Contracts\Auth\CanResetPassword
{
{
/**
* _AUTO_GENERATED_ Enum constants
*/

View File

@@ -14,7 +14,7 @@ use App\RSpade\Core\Models\Country_Model;
*/
/**
* _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
*
* @property int $id
@@ -31,7 +31,7 @@ use App\RSpade\Core\Models\Country_Model;
* @mixin \Eloquent
*/
class Region_Model extends Rsx_Model_Abstract
{
{
public static $enums = [];
protected $table = 'regions';

View File

@@ -14,7 +14,7 @@ use App\RSpade\Core\Models\User_Model;
*/
/**
* _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
*
* @property int $id
@@ -31,7 +31,7 @@ use App\RSpade\Core\Models\User_Model;
* @mixin \Eloquent
*/
class Site_Model extends Rsx_Model_Abstract
{
{
use SoftDeletes;
/**

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
* Generated on: 2025-12-26 01:29:30
* Generated on: 2025-12-26 02:43:29
* Table: user_invites
*
* @property int $id
@@ -28,7 +28,7 @@ use App\RSpade\Core\Database\Models\Rsx_Site_Model_Abstract;
* @mixin \Eloquent
*/
class User_Invite_Model extends Rsx_Site_Model_Abstract
{
{
/**
* Enum field definitions
* @var array

View File

@@ -25,7 +25,7 @@ use App\RSpade\Core\Models\User_Profile_Model;
/**
* _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
*
* @property int $id
@@ -59,7 +59,7 @@ use App\RSpade\Core\Models\User_Profile_Model;
* @mixin \Eloquent
*/
class User_Model extends Rsx_Site_Model_Abstract
{
{
/**
* _AUTO_GENERATED_ Enum constants
*/
@@ -72,7 +72,6 @@ class User_Model extends Rsx_Site_Model_Abstract
const ROLE_VIEWER = 700;
const ROLE_DISABLED = 800;
/** __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
* Generated on: 2025-12-26 01:29:30
* Generated on: 2025-12-26 02:43:29
* Table: user_permissions
*
* @property int $id
@@ -22,7 +22,7 @@ use App\RSpade\Core\Models\User_Model;
* @mixin \Eloquent
*/
class User_Permission_Model extends Rsx_Model_Abstract
{
{
protected $table = 'user_permissions';
protected $fillable = []; // No mass assignment - always explicit

View File

@@ -35,7 +35,7 @@ use App\RSpade\Core\Models\User_Model;
*/
/**
* _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
*
* @property int $id
@@ -51,7 +51,7 @@ use App\RSpade\Core\Models\User_Model;
* @mixin \Eloquent
*/
class User_Profile_Model extends Rsx_Model_Abstract
{
{
/**
* The table associated with the model
*

View File

@@ -13,7 +13,7 @@ use App\RSpade\Core\Database\Models\Rsx_Model_Abstract;
/**
* _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
*
* @property int $id
@@ -38,7 +38,7 @@ use App\RSpade\Core\Database\Models\Rsx_Model_Abstract;
* @mixin \Eloquent
*/
class User_Verification_Model extends Rsx_Model_Abstract
{
{
/**
* _AUTO_GENERATED_ Enum constants
*/
@@ -47,7 +47,6 @@ class User_Verification_Model extends Rsx_Model_Abstract
const VERIFICATION_TYPE_EMAIL_RECOVERY = 3;
const VERIFICATION_TYPE_SMS_RECOVERY = 4;
/** __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
* Generated on: 2025-12-26 01:29:30
* Generated on: 2025-12-26 02:43:29
* Table: _search_indexes
*
* @property int $id
@@ -37,7 +37,7 @@ use App\RSpade\Core\Database\Models\Rsx_Site_Model_Abstract;
* @mixin \Eloquent
*/
class Search_Index_Model extends Rsx_Site_Model_Abstract
{
{
// Required static properties from parent abstract class
public static $enums = [];
public static $rel = [];

View File

@@ -41,7 +41,7 @@ use App\RSpade\Core\Session\User_Agent;
*/
/**
* _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
*
* @property int $id
@@ -63,7 +63,7 @@ use App\RSpade\Core\Session\User_Agent;
* @mixin \Eloquent
*/
class Session extends Rsx_System_Model_Abstract
{
{
// Enum definitions (required by abstract parent)
public static $enums = [];

View File

@@ -6,7 +6,7 @@ use App\RSpade\Core\Database\Models\Rsx_Model_Abstract;
/**
* _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
*
* @property int $id
@@ -29,7 +29,7 @@ use App\RSpade\Core\Database\Models\Rsx_Model_Abstract;
* @mixin \Eloquent
*/
class Flash_Alert_Model extends Rsx_Model_Abstract
{
{
/**
* _AUTO_GENERATED_ Enum constants
*/
@@ -38,7 +38,6 @@ class Flash_Alert_Model extends Rsx_Model_Abstract
const TYPE_INFO = 3;
const TYPE_WARNING = 4;
/** __AUTO_GENERATED: */
/** __/AUTO_GENERATED */