How do I enable code completion for clases and methods I create in code for in netbeans 8.
Thanks, Dion
How do I enable code completion for clases and methods I create in code for in netbeans 8.
Thanks, Dion
You really should google this kinda thing, but I'm in the mood to answer a question :-)
Anyway, most IDE's read your code in pretty much the same way. I can't attest to NetBeans specifically (I use PHPStorm), but the general idea is to make sure you add docblocks to your classes, methods etc. The IDE reads these and can then provide decent code-completion.
<?php
namespace App;
/**
* Class MyClass
* Does some stuff
* @package App
*/
class MyClass extends SomeOtherClass
{
/**
* This is my var
* @var string
*/
public $myVar = 'some val';
/**
* This is my method
* @param string $yourString
* @return SomethingElse
*/
public function myMethod ($yourString)
{
$this->myVar = $yourString;
return new SomethingElse($this->myVar);
}
}
Have a look at the PHPdoc site for the tag syntax. Most IDE's will also have a way of generating this for you as well.