PhpStorm 2019.1 Help

Generating and Updating Copyright Notice

Create a Copyright profile from scratch

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | Copyright | Copyright Profiles. The Copyright Profiles page opens.

  2. Click the Add button icons general add svg on the toolbar and specify the name of the new profile in the Create new copyright profile dialog that opens. When you click OK, you return to the Copyright Profiles page where the new profile is added to the list of available copyright profiles.

  3. Specify the copyright notice to be generated. Do one of the following:

    • Type the desired plain text.

    • Define a Velocity template, then click the Validate button to check that the template has been specified correctly. See Copyright Profiles for a list of supported Velocity variables.

  4. In the Regexp to detect copyright in comments field, type a character string to distinguish copyright notices from other comments during copyright update.

    Make sure that this regular expression matches the above specified copyright notice. Otherwise instead of updating copyright notices, PhpStorm will insert new ones.

Create a Copyright profile based on the settings of an existing profile

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | Copyright | Copyright Profiles. The Copyright Profiles page opens.

  2. Select the desired profile to inherit the settings from and click the Copy button the Copy Configuration button on the toolbar.

  3. In the Create new copyright profile dialog that opens specify the name of the new profile and click OK. You return to the Copyright Profiles page where the new profile is added to the list of available copyright profiles.

  4. View and edit the profile settings. Proceed as during creation of a profile from scratch.

Import an existing Copyright notice text

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | Copyright | Copyright Profiles. The Copyright Profiles page opens.

  2. Click the Import button the Import button on the toolbar.

  3. In the dialog that opens, choose the location of the %.ipr% file that refers to the copyright profile with the desired notice definition.

  4. From the Choose profile to import list, that appears, select the desired copyright profile.

  5. In the Create new copyright profile dialog that opens specify the name of the new profile and click OK. You return to the Copyright Profiles page where the new profile is added to the list of available copyright profiles.

  6. Proceed as during creation of a profile from scratch.

Discard a Copyright profile

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | Copyright | Copyright Profiles. The Copyright Profiles page opens.

  2. Select the profile you want to discard and click the Delete button the Remove button on the toolbar.

  1. Open the desired file in the editor.

  2. Press Alt+Insert.

  3. From the list that is displayed in the editor, choose Copyright.

The following steps depend on the belonging of a file to a certain scope and the value of the Default project copyright field in the Copyright page.

  • If the file where you want to generate a copyright notice belongs to a certain scope, the copyright notice is generated according to the copyright profile settings.

  • If the Default project copyright field has the value No copyright and the file where you want to generate a copyright notice does not belong to any scope, PhpStorm prompts you to configure copyright settings:

    the Edit Copyright setting prompt

    Click OK to open the Copyright page and configure the desired settings.

Note that if a file belongs to several scopes, these scopes are checked upside down. In doing so, the first scope with this file is declared the proper one, and its copyright profile is used.

  1. In the Project tool window, select files or directories where you want the copyright notice to be updated or just open the desired file in the editor.

  2. Right-click the selection, and choose Update Copyright from the context menu.

    To have copyright notices updated correctly, make sure that the keyword specified in the copyright profile is a part of the notice definition. Otherwise, PhpStorm will not detect copyright notices and, instead of updating existing notices, will insert new ones.

Last modified: 26 July 2019

See Also

Reference:

Concepts: