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 208179 - @SuppressWarnings for PHP editor hints
Summary: @SuppressWarnings for PHP editor hints
Status: RESOLVED WORKSFORME
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.1.1
Hardware: PC Linux
: P4 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-08 21:12 UTC by bingalls
Modified: 2016-09-22 18:25 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 bingalls 2012-02-08 21:12:23 UTC
It would nice to suppress warnings in intentional code. For example:

foreach($myarray as $dummy => $value) {  //@SuppressWarning unused variable
  echo $value;
}
unset($dummy);  //hack to keep Netbeans from complaining
Comment 1 livefree75 2013-07-31 13:18:40 UTC
I agree with the general statement, but in your code block, couldn't you just do:

foreach ($myarray as $value) {
    echo $value;
}
Comment 2 bingalls 2013-07-31 22:07:57 UTC
I think you meant

  foreach (array_values($myarray) as $value) {
    echo $value;
  }

but I'm not sure, what the impact on performance is, including memory, just to silence Netbeans. This is meant as a simple illustration of slightly ugly, but correct code, that draws unneeded attention.

Actually, you made my point for me. Netbeans's syntax checker is intended to find & reduce errors. Accommodating it actually hid & caused an error.
Comment 3 amobilia 2016-09-22 18:25:13 UTC
Hi,
This doesn't occurs anymore on the 8.2 rc version (dev 201609210002).
Feel free to reopen the ticket if the problem isn't solved on your configuration.

Regards