The paper studies a reconfigurable intelligent surface (RIS)-assisted multi-user uplink massive multiple-input multiple-output (MIMO) system with imperfect hardware. At the RIS, the paper considers phase noise, while at the base station, the paper takes into consideration the radio frequency impairments and low-resolution analog-to-digital converters. The paper derives approximate expressions for the ergodic achievable rate in closed forms under Rician fading channels. For the cases of infinite numbers of antennas and infinite numbers of reflecting elements, asymptotic data rates are derived to provide new design insights. The derived power scaling laws indicate that while guaranteeing a required system performance, the transmit power of the users can be scaled down at most by the factor 1/M when M goes infinite, or by the factor 1/(MN) when M and N go infinite, where M is the number of antennas and N is the number of the reflecting units. Furthermore, an optimization algorithm is proposed based on the genetic algorithm to solve the phase shift optimization problem with the aim of maximizing the sum rate of the system. Additionally, the optimization problem with discrete phase shifts is considered. Finally, numerical results are provided to validate the correctness of the analytical results.