Pinch to lock iPhone
It's a custom gesture set up on the jailbroken iPhone. Pinch to lock is not a feature available in Accessibility or any other method on a non-jailbroken phone.

The gesture can be set up using a tweak such as Activator. Go to Settings → Activator → On Lock Screen → Icon Pinch → Lock Device to set it up.