All of a sudden my PhpStorm has stopped responding the Code Style > Code Generation
configurations in settings.
I want generated code for constructor as below
/** @var string $keyFileLocation */
protected string $keyFileLocation;
/**
* CalendarClientService constructor.
* @param Config $config
* @param Container $sessionContainer
* @param ServiceAccountCredentials $serviceAccountCredentials
*/
public function __construct(
Config $config,
Container $sessionContainer,
ServiceAccountCredentials $serviceAccountCredentials
) {
$this->config = $config;
$this->sessionContainer = $sessionContainer;
$this->serviceAccountCredentials = $serviceAccountCredentials;
}
but I get this instead:
/** @var string $keyFileLocation */
protected string $keyFileLocation;/**
* CalendarClientService constructor.
* @param Config $config
* @param Container $sessionContainer
* @param ServiceAccountCredentials $serviceAccountCredentials
*/public function __construct(Config $config,Container $sessionContainer,ServiceAccountCredentials $serviceAccountCredentials) {$this->config=$config;
$this->sessionContainer=$sessionContainer;
$this->serviceAccountCredentials=$serviceAccountCredentials;}
It was working fine earlier and I don't think I've changed anything.
File >> File Properties >> Line Separator
configuration tried with both \n
and \r\n
alternatively.
Settings >> Editor >> Code Style >> Line Separator
is set to \n
Below is the code for Settings >> Editor >> File and Code Templates >> PHP Constructor
#if (${PARAM_DOC} != "" || ${THROWS_DOC} != "" || ${CLASS_NAME} != "")
/**
${CLASS_NAME} constructor.
${PARAM_DOC}
${THROWS_DOC}
*/
#end
public function __construct(${PARAM_LIST}) {${BODY}}
NOTE
This was working fine yesterday and its happening with all insertions for Code Generation
and PHPDocs
. Settings >> Editor >> CodeStyle
is configured to use PSR12
and Ctrl + Alt + L fixes all other formatting issues except this one. I assume the main culprit is new line
.
I created a fresh project and cloned the Git. This resolved the issue. It looks like the new line
configuration got somehow corrupted and failed to reset it.