Neither of those is correct unless you are just giving part of the formula- in which case both are correct! y' depends on both y and z and y depends on both y' and z'.
Given any point in the plane, drop perpendiculars from the point to the y and y' axes. The angle at the point is [itex]\phi[/itex], the distance from the point to the foot of the perpendicular to the y' axis is z' and the distance from the point to the foot of the perpendicular to the y-axis is z. Similarly, the distance from the origin to the foot of the perpendicular to the y-axis is y and the distance from the origin to the foot of the perpendicular to the y'- axis is y'.
The distance from the foot of the y-axis to the intersection of that perpendicular is [itex]y tan(\phi)[/itex]. The length of the rest of that perpendicular is the hypotenuse of that right triangle and so is [itex]\frac{z'}{cos(\phi)}[/itex]. Then [itex]z= y tan(\phi)+ \frac{z'}{cos(\phi)}[/itex]. Multiply both sides by [itex]cos(\phi)[/itex] to get [itex]z cos(\phi)= y sin(\phi)+ z'[/itex] so that [itex]z'= z cos(\phi)- y sin(\phi)[/itex]. Similarly, [itex]y'= z sin(\phi)+ y cos(\phi)[/itex].
You can solve those two equations for y and z or simply replace [itex]\phi[/itex] with [itex]-\phi[/itex] (the opposite of "rotating through angle [itex]\phi[/itex]" is "rotating through angle [itex]-\phi[/itex]"). Since [itex]sin(-\phi)= -sin(\phi)[/itex] and [itex]cos(-\phi)= cos(\phi)[/itex] we can just change the sign in front of the sines: [itex]y= -z' sin(\phi)+ y' cos(\phi)[/itex] and [itex]z= z' cos(\phi)+ y' sin(\phi)[/itex].