PhpED: PHP IDE
new features
features
version comparison
features: php tools
php debugger
php profiler
php frameworks
php scripts
features tour
licensing
php testing
PhpED difference
PhpED on Mac/Linux
testimonials
PhpDock
Nu-Coder
PhpExpress
TechPlatform

PHPDoc for PHP Type Hints

PhpED's PHP Code completion feature set is unique because of its ability to take the advantage of PHP Type Hints defined in PHPDoc comments.
PhpED expects certain syntax to be placed in PHPDoc comments in order to provide Code Insight (PHP IDE autocomplete features) with the information about the correct type of variables and properties. This syntax constructs are explained below.

PHP Class PROPERTIES:
Code:
class Y {
/**
* @var SomeClassA this is to tell CODE INSIGHT that this is SomeClassA instance
*/
public $ $ynSomeClassA;
/**
* @var SomeClassB this is to tell CODE INSIGHT that this is SomeClassB instance
*/
public $ $ynSomeClassB;
}


This PHPDoc syntax is illustrated here: PHP Code Completion Type Hints Class
PHP Function ARGUMENTS:
Code:
/**
* example of basic @param usage
* @param SomeClassA $bA some comments may follow...
* @param SomeClassB $bB some other comments may follow...
*/
function function1($bA, $bB) {
}

// php5 syntax is also supported:
function function1(SomeClassA $bA, param SomeClassB $bB) {
}


This PHPDoc PHP code completion syntax is illustrated here: PHP Code Completion for Function
RETURN VALUES:
Code:
/**
* example of basic @returns usage
* @returns SomeClassA some comments may follow...
*/
function function1() {
$v[0] = new SomeClassA();
return $v[0];
}
note: in case if simple variable was returned, type hint would not be required

This PHP Code completion syntax for function return value is illustrated here: PHP Code Completion for Function return
PHP VARIABLES:
Code:
/**
* @var SomeClassA
*/
$a->

// auto-defined:
$d = new SomeClassA();
$d->


This PHP code completion syntax for class instance variables return value is illustrated here: PHP Code Completion for Class Instances


When PHP types are defined in PHPDoc with these syntax conventions, PHP Code completion will work fine for the PHP variables displaying the methods corresponding to the types if the classes expected in these php variables.

NOTE: If you use .php file extension, PLEASE MAKE SURE that it is associated with appropriate php version in Tools->Settings->File Associations. If you develop php5 code, .php extension must be included in to the PHP5 list and removed from PHP4.

 Download NuSphere PHP IDE

Download a free trial of the fast PHP EDitor and robust Integrated Development Environment for PHP.

 Buy NuSphere PhpED® now

Best PHP Editor and complete PHP IDE.
NuSphere PhpED 21.0 is available from our online store front.
"To be honest its bloody awesome, I have looked at loads of PHP editors and this is THE only one that actual works straight out of the box!!! Brilliant, well done."
Andrew Breward,
Director of Technology
caboodal.com

 Guide

Walk through NuSphere PhpED interface
PhpED video tutorial: Webservices
Learn how to add webservices to your code in less than 5 minutes (a flash demo).

 Special Team4 Offer

Get 4 copies of PhpED for the price of 3!

Optimum solution for development teams.
PhpED 21.0 Team4
Need more than 4 licenses? Contact Us for more quantity discounts, please use "Ordering/Payment issue" subject on the form.

 Dr. Dobb's

Dr. Dobb's

Dr. Dobb's Magazine covers NuSphere PhpED in New and Noteworthy section.

 InfoWorld

infoworld.com
PhpED is a proper, world-class IDE for PHP code. It is the only IDE worth considering if PHP development is your primary job