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 hint that reports unused functions vars and class members ignores code in assertions. Example: class FooEnum { const A = 0; const B = 1; const C = 2; private static $_valid = array(self::A,self::B,self::C); private $foo = self::A; public function setFoo($value) { // pre-condition assert('in_array($value, self::$_valid); // Invalid input type'); // more code // post-condition assert('in_array($this->foo, self::$_valid); // Invalid output type'); } public function getFoo() { // pre-condition assert('in_array($this->foo, self::$_valid); // Invalid output type'); return $this->foo; } } For the above snippet NetBeans will report FooEnum::$_valid as unused. But it is not - and if it is removed (as NetBeans suggests) all assertions will result in runtime-errors terminating the program. While unlike Java, assertions are always embraced in quotes in PHP, they are real source code and should be interpreted that way - just as they are in Java. If NetBeans supports the one it should also work with the other. Personally I would prefer that NetBeans would be able to honor assertions. At least when it comes to single-quoted strings in assertions like '$foo' - which is 1:1 standard PHP source-code. I understand that there are more complex examples where people use variable substitution BUT these are a rarely seen, since it does not comply with common rules for writing assertions (not in Java and also not in PHP). At least 95% of all assertions will use very basic expressions. Typical assertions are: type-checking, checking that a value doesn't fall below zero, checking that a value is not Null or a var has not been previously used. As an alternative it would be nice to at least be able to persistently turn off this warning in NetBeans for just a single class member, function or variable. I suggest setting this issue to a low priority and keeping it on the "todo"-list for a future version.
batch reassigning
Can still be reproduced in Netbeans 7.1