On the periodic solutions to the Kirchhoff--Bernstein nonlinear wave equation