Given a statistical model $\{\mathbb{P}_\theta\mid\theta\in\Theta\}$ on $(\Omega,\mathscr{F})$, and given a real-valued random variable $X$, we say a real-valued random variable $T$ is a sufficient statistic if $X_*\mathbb{P}_\theta(dx\mid T)$ (the conditional distribution of $X$ given $T$) is independent of $\theta$. We also say a sufficient statistic $S$ is minimal if for all other sufficient statistics $T$ there is a measurable $\varphi:(\mathbb{R},\operatorname{Bor}(\mathbb{R})) \to (\mathbb{R}, \operatorname{Bor}(\mathbb{R}))$ such that $S=\varphi(T)$ $\mathbb{P}_\theta$-a.e. for any $\theta$.
Suppose that all $X_*\mathbb{P}_\theta(dx)$ are absolutely continuous with respect to the Lebsegue measure with density $f(x\mid\theta)$, and that $X,S$ are real-valued random variables. A well-known theorem says that if "for all $x,y\in \mathbb{R}$ $\frac{f(x\mid\theta)}{f(y\mid\theta)}$ is independent of $\theta$ if and only if $S(x)=S(y)$" (let's call this condition $(\star)$), then $S$ is a minimal sufficient statistic.
A proof of this theorem can be found here (Thm 3.4): http://www.statslab.cam.ac.uk/Dept/People/djsteaching/S1B-15-03-sufficiency-4.pdf. This proof (which is the same as all other proofs that I saw) however only shows that, given another sufficient statistic $T$, there exists a function $\varphi:\mathbb{R}\to\mathbb{R}$ such that $S=\varphi(T)$ $\mathbb{P}_\theta$-a.e. for any $\theta$, but doesn't show it is measurable.
My question is simple: how does one show $\varphi$ is measurable?