File and Code Templates - Code Tab Not Generating date using ${DATE}
Answered
Hello,
I am using the File and Code Templates and under the Code Tab I have modified the PHP Constructor to the following:
/**
* Method Name: __constructor
* Method Purpose: ${CLASS_NAME} constructor.
*
* Date created: ${MONTH}/${DAY}/${YEAR}
* Last modified: ${MONTH}/${DAY}/${YEAR}
*
* Notes on specifcications, special algorithms, and assumptions:
*
*
${PARAM_DOC}
${THROWS_DOC}
*/
public function __construct(${PARAM_LIST}) {${BODY}}
When I generate the constructor in my project I get this:
class Person
{
private $first_name;
private $last_name;
/**
* Method Name: __constructor
* Method Purpose: Person constructor.
*
* Date created: ${MONTH}/${DAY}/${YEAR}
* Last modified: ${MONTH}/${DAY}/${YEAR}
*
* Notes on specifcications, special algorithms, and assumptions:
*
*
* @param $first_name
* @param $last_name
*/
public function __construct($first_name, $last_name)
{
$this->first_name = $first_name;
$this->last_name = $last_name;
}
}
Please notice the code was not executed for the Date created: and Last Modified.
Please advise.
Thank you,
Matt
Please sign in to leave a comment.
Hi there,
List of available predefined variables is shown in the bottom section -- as you can see it does not list date-related variables there -- they are available for File and Include templates but not Code.
Support for them in templates from Includes tab was added only in last major version (https://youtrack.jetbrains.com/issue/WI-18015 and https://youtrack.jetbrains.com/issue/WI-17507)