2

I want to add a "PHP Class Doc Comment" to my php file. Everything works fine except that ${DATE} doesn't get replaced. I am clearly missing something so obvious! Can I not access this environment variable because it isn't available for this "built-in" template?

The following template

/**
 * Project-Name
 * Class ${NAME}
 * User: Brad Goss
 * Date: ${DATE}
 */

Results in:

/**
 * Project-Name
 * Class PBPermission
 * User: Brad Goss
 * Date: ${DATE}
 */
6
  • youtrack.jetbrains.com/issue/WI-17507 ? All available "variables" in specific standard file/code templates should be listed in description area. Commented Oct 8, 2013 at 17:27
  • Right, ok. So I can't access DATE... Which is kinda silly. My class comments have always been lacking/non-existent. This would have polished it off nicely. Thanks for your help. Commented Oct 8, 2013 at 17:35
  • You could simply create a Live Template and use it instead -- almost all text is static anyway PLUS live template allows you to format date in the format you want (while $(DATE} is using system date format only). Commented Oct 8, 2013 at 23:25
  • Eek. I definitely don't want to manually type the date, and my name, and the class name. :( No automatic class header comments for me I guess... Commented Oct 9, 2013 at 3:40
  • Yes .. you are changing your name every second minute -- how could I forgot about it?.. And date -- where did I said anything about "typing" it? I've only mentioned formatting... Anyway -- the choice is yours -- I've only offered an alternative. Commented Oct 9, 2013 at 8:43

1 Answer 1

1

Go to SETTINGS -> IDE SETTINGS -> FILE AND CODE TEMPLATES -> PHP FILE HEADER and add the following:

@Date    ${DATE}

Now when you create a new file the file header comment block will contain the date.

Sign up to request clarification or add additional context in comments.

2 Comments

Only problem is I tend to create all my files using finder. I have finder full screen on my second monitor and it's so much faster browsing files (shortcut links in sidebar for popular folders). So I tend to resort to finder to create files. In PHPStorm I tend to open all my files using CMD-OPTION-O and ignore the project explorer. So unfortunately this doesn't solve my issue...
Still no fix 1 year later ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.