Can a creature choose to squeeze into a space when not forced to do so?

In Pathfinder (not 2, and other systems for comparison would be interesting for comparison but are not the question)…

Assuming you are large or larger, and expect a square you occupy to later be attacked, can you squeeze of your own choice?

For example, a huge or larger creature backed up against a cliff who expects to be targeted by arrows, can they ‘press themselves to the wall’ squeezing into the space nearest the wall, otherwise following all squeeze rules?

Or similarly knowing that a square is trapped in a hallway can you squeeze to walk past without setting it off?