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 179303 - "Variable does not seem to be used in this scope" warning sometimes wrong
Summary: "Variable does not seem to be used in this scope" warning sometimes wrong
Status: RESOLVED DUPLICATE of bug 170541
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 normal (vote)
Assignee: rmatous
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-08 02:59 UTC by lathspell
Modified: 2010-03-19 13:42 UTC (History)
0 users

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 lathspell 2010-01-08 02:59:44 UTC
Hello

Netbeans warns me with a little yellow alert sign on the left side that the following code is considered suspicious. When I put the mouse over the alert sign it says "Variable does not seem to be used in this scope". I like this check as it helps spotting typos in variable names but this time it is certainly on the wrong track. It underlins the $i in the foreach statement although that variable gets used as a object reference one line below:

    class T {
	public $attr = 42;

	public function f() {
            $a = array(new T(), new T());
	    foreach ($a as $i) {
	 	echo $i->attr;
	    }
	}
    }

The bug does not occur in every foreach nor if I move the foreach out of the class.
Comment 1 rmatous 2010-03-19 13:42:36 UTC
experimental hint

*** This bug has been marked as a duplicate of bug 170541 ***