PhpStorm, running tests permissions issues

when running phpunit test inside docker using remote interpreter, various cache files have wrong permissions, because phpstorm runs phpunit as default user, in this case root, so cache files are created with root user, and this makes permission issues, to fix that for development you can do this:

if (0 === \posix_geteuid()) {
    \umask(0000);
}

which detects that user is root (check for zero), and sets umask(0000)

in symfony you can put this in config/bootstrap.php

if ($_SERVER['APP_DEBUG'] && 0 === \posix_geteuid()) {
    \umask(0000);
}