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.
The following code fragment illustrates the problem: <?php class Test { public $foo = 'foo'; public static function getFoo() { $test = new Test(); return $test->foo; } } ?> The first use of $test gets underlined in yellow, and the warning is 'Variable does not seem to be used in its scope'. Now, I might be wrong, but the line reading 'return $test->foo;' looks like it is using the $test variable, and in the same scope... This is the absolute minimum bit of code I can find to demonstrate this bug, but there are plenty of occurrences of the same spurious warning in my current project. For example, if I add the following: <?php $arr = Array(new Test()); foreach ($arr as $test) { $details = $test; echo "<p>{$details->foo}</p>"; } ?> I get the first instance of $details underlined yellow with the same warning.
Reproducible, as well as in the following code: <?php class Test { public $foo = 'foo'; } function getFoo() { $test = new Test(); echo $test->foo; } ?> Not reproducible in the code: <?php class Test { public $foo = 'foo'; } $test = new Test(); echo $test->foo; ?>
*** This issue has been marked as a duplicate of 157390 ***