Press Alt+Up (Ctrl+W on Windows/Linux) to extend the selection from the cursor's location to the encompassing code contexts.
From the example above, the selections being made are as follows:
- Variable name (excluding '$')
- Variable element (including '$')
- Foreach body
- Foreach block
- If body
- If block
- Method body
- Method block
- Class body
- Class block
- File contents
Press Alt+Down (Ctrl+Shift+W) to shrink the selection.