What Bob said.
And not what Pete said. (Jail time for sleeping in your car at a trailhead? )
The Rangers do a cursory check for flagrant violators. Usually as part of their dawn patrol. You'll see them do this every morning- one Ranger drives the length of the Tuolumne area at dawn and spot checks the parking lots with the floodlight. This isn't an exhaustive search- There have been times when I've been sleeping in my vehicle and they passed right over me. And if they do catch folks they will usually just make them leave rather than start handing out fines.
It is *highly* unlikely if you have parked legally and wandered a hundred yards into the woods and bivvied that they will come looking for you.
This isn't Jack Bauer Ninja Ranger with night vision goggles, it likely a hung over junior ranger who drew short straw for the morning rounds.
With that said, If I need to sleep in my vehicle I'll usually go do it on SaddleBack lake road. This is sufficient elevation for acclimation and get you out of park and out of the Yosemite Ranger patrol routes.
They *do* speed trap the living hell out of the area near the Tuolumne Campground (where it dips to 25mph for a few hundred yards), so watch out for that. And don't keep food/scented items in your car. The bear risk is legitimate.