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 - Enable CC for private/protected members for /* @var $this ClassName */
Summary: Enable CC for private/protected members for /* @var $this ClassName */
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: PHPDoc (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-31 14:18 UTC by CheeseSucker
Modified: 2011-12-02 22:38 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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