This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 216008

Summary: Autocompletion doesn't work for not declared object's properties
Product: php Reporter: rozwell
Component: EditorAssignee: Ondrej Brejla <obrejla>
Status: NEW ---    
Severity: normal CC: sohorev
Priority: P3    
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description rozwell 2012-07-26 14:45:17 UTC
Take following examples:


This one works:

class Foo
{
  protected $bar;

  public function Baz()
  {
    $this->bar = new Qux();
    $this->bar->...
  }
}


And this one not:

class Foo
{
  public function Baz()
  {
    $this->bar = new Qux();
    $this->bar->...
  }
}


It used to work so this seems to be a regression.
Comment 1 rozwell 2012-07-26 14:46:47 UTC
Using latest stable build (5094) from:
http://bertram.netbeans.org:8080/job/PHP-build/
Comment 2 Ondrej Brejla 2012-07-27 07:03:19 UTC
Can you explain me your real use case, where you do this ugly thing? It's a pure hell and bad practise, code which uses this "feature" is almost unmaintainable.

I'm not sure if I want to enable this crapy "feature" again.
Comment 3 rozwell 2012-07-27 08:14:03 UTC
symfony 1.4, actions.class.php:

class mainActions extends sfActions
{

  public function executeRegistration(sfWebRequest $request)
  {
    $this->form = new RegistrationForm();
    $values = $request->getParameter($this->form->getName());
    if($request->isMethod(sfRequest::POST) && $values){
      $this->form->bind($values);
      if($this->form->isValid()){
        (...)
      }
    }
  }
}


and in template registrationSuccess.php autocompletion works for $form:

<?php echo $form->... ?>


I'm not telling it's good, I just found out it doesn't work anymore ;)
The simple workaround for this is using $form variable and set $this->form later.
Comment 4 Ondrej Brejla 2012-10-08 13:33:29 UTC
I was thinking about it and I considered to not implement it for now. Because the simple fix will break Go To Type (in some cases) and it can't be workarounded. This case can be. Someone cas use @property annotation of a class, so CC will work then. Sorry for any inconvenience. I'll leave this issue opened as an enhancement for some other release.