I have a PhpStorm Php file template under Editor > File and Code Templates:
According to the linked Apache Velocity Docs to escape a dollar sign a back slash should be used:
<?php
declare(strict_types=1);
#parse("PHP File Header.php")
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
class ${NAME} implements DataTransformerInterface
{
public function __construct()
{}
public function transform(\$value)
{
return ;
}
}
But when I select the template when creating a class, the backslash stays:
File output:
<?php
declare(strict_types=1);
namespace SomeProject\SomeBundle\Form\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
class TestTransformer implements DataTransformerInterface
{
public function __construct()
{}
public function transform(\$value)
{
return ;
}
public function reverseTransform()
{
return ;
}
}
It works when i directly select the template and not create class, but then the namespace is not taken automatically...

