Is the difference in the hypotheses of these two statements relevant? The following is a problem from Conway's Functions of One Complex Variable, and my proof: 
Let $G$ be a region and suppose that $f:G \rightarrow \mathbb{C}$ is analytic. Show that if $f(z)$ is real for every $z \in G,$ then the function $f$ is constant.
Proof:
We can write $f(x + iy) = u(x,y) + iv(x,y).$ Since $f(z)$ is real for every $z \in G$ we have that $v(x,y) = 0$ for all $x + iy \in G.$ 
Theorem 2.29: Let $u$ and $v$ be real-valued functions defined on a domain $G$ and suppose that $u$ and $v$ have continuous partial derivatives. Then $f:G \rightarrow \mathbb{C}$ defined by $f(z) = u(z) + iv(z)$ is analytic iff $u$ and $v$ satisfy the Cauchy-Riemann equations.
Since $f$ is analytic in $G$ we have by Theorem 2.29 that the Cauchy-Riemann equations $u_x = v_y = 0$ and $u_y = -v_x = 0$ hold throughout $G.$ Suppose $x(t),y(t)$ are two functions of $t \in [c,d]$ and $x(t) + iy(t) \in G$ for all $t \in [c,d].$ Then
$\frac{d}{dt}u(x(t),y(t)) = u_x(x(t),y(t))x′(t) +u_y(x(t),y(t))y′(t)= 0\cdot x'(t)+ 0\cdot y'(t) = 0, t \in [c,d].$
Therefore $u(x(c),y(c)) = u(x(d),y(d)).$ Fix $z_1 \in G$ and suppose $z \in G$ is any other point. Since $G$ is a region, there is a polygonal path starting at $z_1$, ending at $z$, and lying entirely in $G.$ Since $u$ takes on the same value
on the endpoints of each straight line segment, $f = u$ has the same value at $z$ as at $z_1.$ Hence the function $f$ is constant.

Question: Is the statement and proof any different, if we say:
Let $f$ be a real-valued function defined and analytic on an open connected set $G \subset \mathbb{R}^2.$ Prove that the function $f$ is constant on $G$?
 A: The function $f(x,y) = x$ is real-valued and analytic on the open unit ball. But it is very much not constant.
Satisfying the Cauchy-Riemann equations is a very strong condition. Real analytic functions do not necessarily satisfy these equations. This makes a big difference.
In general, being complex-differentiable is much stronger than being real-differentiable. One should expect statements about real differentiable functions to be true for complex differentiable functions, but not the converse.
A: Your proof looks good. Here is another version:
If $f'(z_0) \neq 0$, then consider $\phi(t) = f(z_0+it\overline{f'(z_0)})$. We 
have $\phi'(0) = i |f'(z_0)|^2$, hence for small $t$ we see that $\phi(t)$ is not real, which is a contradiction, hence $f'(z_0) = 0$. It follows that if $\gamma$ is a differentiable path in $G$ joining $w,z$ then $f(w)=f(z)$.
Choose $z_0 \in G$ and let $C=\{ z \in G | f(z) = f(z_0) \}$. $C$ is closed since $f$ is continuous, and open since $G$ is open and open balls are path
connected by straight lines. Since $G$ is connected, we have $G=C$.
