This was a sprinkler that was installed incorrectly. When it broke, it could only be fixed by making a lateral PVC pipe repair. This was because the installer hard piped / glued the fitting for the sprinkler head. I always suggest using swing joints, so things like this don't happen.
Start by exposing the lateral.
Cut out the broken section of PVC pipe, if the break is too close to the elbow for a coupling repair, you will need to remove the elbow.
This example will cover the removal of the sprinkler PVC pipe with Elbow elbow. A coupling repair would be a standard lateral repair, but you would have the added advantage of having more flexibility in the lateral line when assembling the repair.
If possible, use the removed section to give you a guide for cutting your replacement PVC piping.
Start building the repair toward the elbow. Use couplings or a tee with threads for attaching a swing joint to supply a sprinkler.
Assembly Example
Assembly Example
Gluing PVC elbow example
When gluing the PVC elbow, you will need to prep both sides at the same time. Bend the longest lateral back far enough to allow you to push the elbow on, then force the elbow onto the short side. Once the elbow is in its final assembled position, hold it in place long enough for the glue to set firmly.
If you are installing / replacing a sprinkler, assemble the swing joint and backfill. Test the repair after the appropriate drying time.