112

How to make something like this? (all methods collapsed by default without any hotkeys)

collapsed methods

Dmitry K.
  • 3,065
  • 2
  • 21
  • 32

5 Answers5

177

This works for me: CTRL SHIFT numpad -

It also collapses the class... but then just manually re-open the class by clicking the + and the methods are folded.

And then you can re-open all methods with CTRL SHIFT numpad +

https://www.jetbrains.com/help/phpstorm/code-folding-commands.html

jasie
  • 2,192
  • 10
  • 39
  • 54
Andrew
  • 18,680
  • 13
  • 103
  • 118
78

Solution found (File -> Settings -> Editor -> General -> Code Folding

enter image description here

Dmitry K.
  • 3,065
  • 2
  • 21
  • 32
  • 7
    Ok I think I see that you enabled the 'Method bodies' setting, but how did you use this setting to get the methods to all fold? A shortcut? menu button? – Andrew Feb 02 '17 at 18:28
  • @Dimitry K. how to use it now? – Black Jul 07 '17 at 09:01
  • 2
    @Black did you look at this page - https://www.jetbrains.com/help/phpstorm/code-folding.html ? – Dmitry K. Jul 07 '17 at 15:48
  • @Andrew. just hit all the checkboxes you fit necessary, for me PHP function and method bodies were enough. – Rafael Nov 17 '17 at 14:08
  • 1
    What is the checkbox for the comments above PHP functions (shown in green in the OP image)? The ones included in `/** */`. Where you sometimes declare what `@params`the function uses and what it `@returns`. Thanks! – nclsvh Jun 06 '18 at 07:50
  • Thanks for the advice! – Fernando León Dec 02 '19 at 23:21
47

You don't need to change anything in the settings like Dmitry suggested.

Simply do ⌥⌘⌨ *1 -- That's OPTION+CMD+NumPad *, then 1.

If you're on Windows, it's CTRL+SHIFT+NumPad *, then 1.

Colin
  • 2,109
  • 1
  • 20
  • 22
32

I'm using ubuntu,

the command is

-> CTL, SHIFT and MINUS ( this will collapse the whole class including all methods )

-> CTL, PLUS ( will expand the class but all methods should be collapsed )

-> CTL, SHIFT and PLUS ( will expand the whole class including all methods )

sh6210
  • 4,190
  • 1
  • 37
  • 27
7

for windows PhpStorm 2021.1

ctrl + expand method
ctrl - collapse method
ctrl+shift - collapse all method
ctrl+shift + expand all method