Creating a New Trait

This procedure demonstrates how to create a new PHP trait using the new PHP Trait wizard.

 

 

Instructions on how to complete a procedure

To create a new PHP trait:

  1. In PHP Explorer view, right-click the project/file in which you want to create the new class and select New | Trait.
    The New PHP Trait wizard is displayed.

  1. Enter the following details:

  • Source Folder - If necessary, click Browse to change the source folder.

  • Trait location - Select one of the following options:

    • Create New File - A new PHP file will be created in which the new class will be inserted

    • Add in existing file - The class will be created in an existing file.
      Click Browse to select the file in which it will be created and select whether it will be created as the 1st PHP Block in the file or as a New PHP Block at the end of the file.

  • Trait Name - Enter the name for the trait. If you chose the Create New File option, this will also be the name of the file.

  • Namespace - enter a namespace for the new trait.
  • PHPDoc - select this check-box for PHPDocs comments to be created.

  1. Click Finish.

The new trait will be created with the required code.