I found this, and it says "We only use inversion when the adverb modifies the whole phrase and not when it modifies the noun."
What does modifies the whole phase mean?
Take the two sentences below for example:
Not until I saw John with my own eyes did I really believe he was safe.
The word "Not" modifies the phase "until I saw John with my own eyes", right?
Only when we had our lunch would we go to work.
The word "Only" modifies the phase "when we had our lunch", right?
What about sentences like below? Is inversion required? Inversion is required only when adverbs like "only", "never", "not".... modify the whole phase, so sentences like below are not the case, right?
When he only eats chips, he gets fat.
When I only do simple things, I can concentrate.
When a man only thinks of himself, he loses his friends.