NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Code completion in NetBeans 8.1

 
Post new topic   Reply to topic    NetBeans Forums -> PHP Users
View previous topic :: View next topic  
Author Message
bejkrools



Joined: 12 Aug 2016
Posts: 2

PostPosted: Fri Aug 12, 2016 11:09 am    Post subject: Code completion in NetBeans 8.1 Reply with quote

Hi, I have got issue with code completion in my project. It works only in "base" class where I make a new object from class. In classes that inherit from base class code completion doean't work. This is an example:

Code:

class Module
{
   public $name;
   
   public function __construct($name)
   {
      $this->name = $name;
   }
   
   public function get_name()
   {
      return $this->name;
   }
}

abstract class ParentClass
{
   public $module;
   
   public function __construct()
   {
      $this->module = new Module('Module');
   }
   
   public function get_object_name()
   {
      $this->module->get_name();
      // 'module' and 'get_name()' showed in list of code completion
   }
}

 class ChildClass extends ParentClass
 {
   public function __construct()
   {
      parent::__construct();
   }
   
   public function get_object_parent_name()
   {
      $this->module->
      //'module' showed in list, but 'get_name()' I'll have to type manually
   }
 }


Each of this classes is in separate file and required in spl_autoload_register function. Code works fine, only completion in NB doest'n work lik I want to. There is something wrong im my code?
Back to top
Tomas Mysik
Posted via mailing list.





PostPosted: Mon Aug 15, 2016 6:13 am    Post subject: Code completion in NetBeans 8.1 Reply with quote

Hi,
NetBeans heavily relies on types defined in PHPDoc blocks (comments). So, in
your case, just define the type of your "module" field like this:

Dne P
Back to top
bejkrools



Joined: 12 Aug 2016
Posts: 2

PostPosted: Wed Aug 17, 2016 5:40 am    Post subject: Re: Code completion in NetBeans 8.1 Reply with quote

Tomas Mysik wrote:
Hi,
NetBeans heavily relies on types defined in PHPDoc blocks (comments). So, in
your case, just define the type of your "module" field like this:

Dne P


Tomas, like what?
Back to top
Harry_89



Joined: 02 Oct 2016
Posts: 1

PostPosted: Sun Oct 02, 2016 1:31 pm    Post subject: Reply with quote

Hello,

I'm having the same problem.

Fresh install with netbeans 8.1.
But there are no suggestions.

What I'm doing wrong?

Thank you
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> PHP Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo