Skip to content

Instantly share code, notes, and snippets.

@mrclay
Created October 6, 2014 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrclay/be36f5940e13c394113f to your computer and use it in GitHub Desktop.
Save mrclay/be36f5940e13c394113f to your computer and use it in GitHub Desktop.
Help me determine the best-supported flavor of variable annotations across PHP IDEs.
<?php
/**
* Help me determine the best-supported flavor of variable annotations across PHP IDEs.
*
* 1. Open this file in your IDE
*
* 2. Place your cursor at the bottom of the file and see which variables are understood
* as instances of the class Foo
*
* 3. Report your findings to http://goo.gl/forms/qBO8OpLPlj
*
* Thanks!
*
*
* @link http://www.eschrade.com/page/zend-studio-code-assist-4b9f800a/
* @link https://blogs.oracle.com/netbeansphp/entry/defining_variable_type_in_a
* @link http://www.jetbrains.com/phpstorm/whatsnew/whatsnew_21.html
*/
class Foo {public $bar;}
function create($class) {return new $class();}
$a1 = create('Foo');
/* @var Foo $a1 */
$a2 = create('Foo');
/* @var $a2 Foo */
$a3 = create('Foo');
/** @var Foo $a3 */
$a4 = create('Foo');
/** @var $a4 Foo */
/* @var Foo $a5 */
$a5 = create('Foo');
/* @var $a6 Foo */
$a6 = create('Foo');
/** @var Foo $a7 */
$a7 = create('Foo');
/** @var $a8 Foo */
$a8 = create('Foo');
// place cursor here, type var names, see if auto-complete for ->bar happens...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment