Yes, of course. But JS is frontend mostly, so I can imagine it's easier to accidentally scrape some JS with text.
PHP, not so much, only if the server returns source by accident.
What if the server is GitHub? Or some random blog about PHP development? There are lots of situations where it's very intentional that PHP is contained in HTML.