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 202457 - Variable not in scope hint is shown also when variable IS in scope
Summary: Variable not in scope hint is shown also when variable IS in scope
Status: RESOLVED INVALID
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.1
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-21 20:42 UTC by maghiel
Modified: 2011-09-23 04:20 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description maghiel 2011-09-21 20:42:25 UTC
Steps to reproduce:
<?php
class newPHPClass
{
    protected $_foo = 'bar';
    
    public function baz()
    {
        $apple = 'fruit';
    }
}

Result:
Hint: "Variable $apple does not seem to be used in it's scope" is shown. 

Expected result:
No hint!
Comment 1 Ondrej Brejla 2011-09-22 07:42:13 UTC
No, it really isn't used...it's just defined...but not used...you have variable $apple and you are not using it...it's just defined.

And that's exactly what the hint makes...it alerts you, when you define some variable and don't use it. Because you really don't want to have variables, which are only defined, do you? ;)
Comment 2 Ondrej Brejla 2011-09-22 07:43:52 UTC
Maybe you thought that hint controls "initializing" of variables...that's another hint, this hint just controls "usage" of declared variables.
Comment 3 maghiel 2011-09-22 18:47:18 UTC
IMHO the hint text is a bit confusing then. It makes me think the editor tries to hint me about a variable that is being used outside of its scope. Now that I read the hint again, with your comment, I understand it.
Maybe the text should be altered to avoid confusion. By example to "Variable $foo seems to be unused in its scope".

"it's scope" is a grammatical error by the way. "It's" means "it is" or "it has". In other words, it reads "Variable $foo does not seem to be used in it is scope." currently :p

Shall I file an enhancement for the change of the hint text and a bug report for the grammar error?
Comment 4 Tomas Mysik 2011-09-23 04:15:58 UTC
(In reply to comment #3)
> Shall I file an enhancement for the change of the hint text and a bug report
> for the grammar error?

Yes, please, one bug will be fine.

Thanks a lot!
Comment 5 maghiel 2011-09-23 04:20:53 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Shall I file an enhancement for the change of the hint text and a bug report
> > for the grammar error?
> 
> Yes, please, one bug will be fine.
> 
> Thanks a lot!

http://netbeans.org/bugzilla/show_bug.cgi?id=202527