A class of impulsive nonautonomous differential equations and Ulam–Hyers–Rassias stability