I've had this issue for years and always thought I was doing something wrong.
If you fold a block of code in PhpStorm and then decide to edit that document then it is very easy to do something that causes the code to unfold or to behave in a strange manner.
If you copy and paste a folded method/function into the same document (or use the duplicate option) then the IDE will unfold the source block and then fold the destination block. The source block should remain folded and either the destination block also remain folded (preferable) or only that block be unfolded.
If you paste a chunk of code into the middle of file that has several folded blocks, the folding goes all to-pot.
I've folded all methods in a class file and been working on another file (with the first file open in a different tab) and come back later to find some or all of the methods unfolded.
Basically, the code folding is unreliable.