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 199044

Summary: Enable CC for private/protected members for /* @var $this ClassName */
Product: php Reporter: CheeseSucker
Component: PHPDocAssignee: Petr Pisl <ppisl>
Status: NEW ---    
Severity: normal CC: CheeseSucker
Priority: P3    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description CheeseSucker 2011-05-31 14:18:30 UTC
When working in PHP I often separate the GUI code from the business logic.

SomeClass.php:
<?php
class SomeClass {
    public $publicVar;
    protected $protectedVar;
    private $privateVar;

    public function display() {
        require('html.php');
    }
}

html.php:
<?php
/* @var $this SomeClass */
?>


If I write "$this->[space]" in html.php, only $this->publicVar will show up in the autocomplete list. Expected behaviour is to get all member variables.
Comment 1 nazzz 2011-12-02 22:38:08 UTC
(In reply to comment #0)
> When working in PHP I often separate the GUI code from the business logic.
> 
> SomeClass.php:
> <?php
> class SomeClass {
>     public $publicVar;
>     protected $protectedVar;
>     private $privateVar;
> 
>     public function display() {
>         require('html.php');
>     }
> }
> 
> html.php:
> <?php
> /* @var $this SomeClass */
> ?>
> 
> 
> If I write "$this->[space]" in html.php, only $this->publicVar will show up in
> the autocomplete list. Expected behaviour is to get all member variables.


In my opinion this is correct behaviour of autocomplete, as protected and private variables/methods are not accessible outside parent object. So such functionality is not helpful at all.
Regarding your example such constructions are inefficient and does not meet object oriented programming concepts. 
Using object oriented approach you should extend your class instead of injecting php code directly.

More can be found here:
http://php.net/manual/en/language.oop5.visibility.php