Search code examples
phpstorm

PhpStorm change class snippet (template)


PhpStorm version 2017.1.

When I want to add a class file I right click on necessary folder > New > PHP Class and I get defined php class. But I would like to change some things.

Firstly, remove Created by PhpStorm, and do not have { on new line but just in one line with class name.

How can I do it? I am quite new to PhpStorm and I expected it to have some snippets for it, but googling had no result oddly enough.


Solution

  • Those are File Templates and they are available at Settings/Preferences | Editor | File and Code Templates

    That particular template is "PHP Class" .. which may include some other blocks from "Includes" and "Code" tabs (using #parse(filename) Velocity directive).

    You may just edit that template .. or create your own one -- it then will be listed as a separate entry in File | New... menu.


    ...and do not have { on new line but just in one line with class name.

    That may be controlled by your Code Style if "Reformat according to style" option is checked. In such case adjust as needed at Settings/Preferences | Editor | Code Style | PHP.


    Since you are new to PhpStorm -- I suggest checking these links: