The other person is right!
In America:
It’s legal for the cops to hold your phone in front of your face or physically press your thumb on the fingerprint reader, they don’t even need a warrant.
Not even a judge can compel you to enter your pin.
Everywhere else:
Even if it’s legal for them to order you to enter your pin you have the option of lying and taking the punishment for that rather than give up your secrets.