What are the consequences of violating the separation of concerns principle by allowing a model to access controller data directly in PHP?

Allowing a model to directly access controller data in PHP violates the separation of concerns principle, leading to tightly coupled code that is difficult to maintain and test. To solve this issue, data should be passed from the controller to the model through method parameters or setter methods.

// Controller
class UserController {
    public function getUserData() {
        $userData = $this->getUserDataFromDatabase();
        
        $userModel = new UserModel();
        $userModel->setUserData($userData);
        
        return $userModel;
    }
}

// Model
class UserModel {
    private $userData;
    
    public function setUserData($userData) {
        $this->userData = $userData;
    }
}