Take a look at the FP complexity class.
Technically speaking, it is wrong. However, usually people don’t make a huge difference between the two. Its usually clear from the context whether the problem is a decision or a search problem, hence its clear whether it should be in $P$ or $FP$.
So, writing that “Finding the shortest $(s,t)$ path in the graph $G$, is a $P$ problem” would actually mean: “Finding the shortest $(s,t)$ path in the graph $G$, is an $FP$ problem” (since the context is clear)