Semantic Analysis Preferences

The Semantic Analysis feature enables warning and error messages to be displayed when Zend Studio detects possible errors or problems in your script.

The Semantic Analysis Preferences page is accessed from Window | Preferences | PHP | Editor | Semantic Analysis Properties.

Semantic Analysis Preferences page

Enabling and Configuring Semantic Analysis for All Projects

 

 

Instructions on how to complete a procedure

To enable and configure Semantic Analysis for all projects:

  1. Mark the 'Enable Semantic Analysis' checkbox.

  2. Select the severity level displayed in error messages (warning, ignore or error) for a variety of occurrences, divided into the following categories:

  • Compile Errors

  • Potential Programmer Problems

To select a severity level for an event, click the arrow next to each header to display the possible options (if not displayed) and select the severity level from the drop-down list next to each option.

  1. Click Apply to apply your settings.
    A prompt dialog is displayed indicating that a rebuild of the project must occur for the settings to take effect.

  2. Click Yes to rebuild the project.
    -Or- click No for a rebuild to be performed only when Zend Studio is restarted.
    -Or- click
    Cancel to cancel the operation.

 

Compile Errors

Allows you to select the severity level (error, warning or ignore) for the following:

  • Duplicate PHP element declaration (in same file)

  • Duplicate PHP element declaration (in file hierarchy)

  • Class element visibility reduce

  • Unimplemented abstract methods

  • Abstract class field

  • Reserved types (PHP 7)
  • Multiple default cases in a switch (PHP 7)

Potential Programmer Problems

Allows you to select the severity level (error, warning or ignore) for the following:

  • Undefined local variable

  • Undefined function

  • Undefined field (slow check)

  • Undefined method (slow check)

  • Undefined class or interface

  • Assignment in condition (e.g. 'if (a = b)')

  • Assignment has no effect (e.g. 'a=a')

  • Bad escape sequence in string

  • Unused use statement
  • Undefined trait member
  • Conflicted trait member
  • Deprecated API (slow check)

Applying Semantic Analysis Preferences Setting to a Specific Project

 

 

Instructions on how to complete a procedure

To apply Semantic Analysis Preferences settings to a specific project only:

  1. Select the link labelled "Configure Project Specific Settings".

  2. Select the required project from the list.
    A Semantic Analysis Properties page will appear.

  3. Select the required settings and click Apply.
    A prompt dialog will appear stating that a rebuild of the project must occur for the settings to take effect.

  4. Click Yes to rebuild the project.
    -Or- click No for a rebuild to be performed only when Zend Studio is restarted.
    -Or- click Cancel to cancel the operation.

Note:

Semantic Analysis settings can also be configured for an existing project by right-clicking the project in PHP Explorer view and selecting Properties | Semantic Analysis Properties.