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 207420 - Variable is hinted unused if used in file included later, but not if included before
Summary: Variable is hinted unused if used in file included later, but not if included...
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-18 02:34 UTC by berniev
Modified: 2012-01-18 09:05 UTC (History)
0 users

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 berniev 2012-01-18 02:34:19 UTC
Product Version = NetBeans IDE 7.1 (Build 201112071828)
Operating System = Linux version 3.0.0-14-generic-pae running on i386
Java; VM; Vendor = 1.6.0_23
Runtime = OpenJDK Client VM 20.0-b11

Not sure if this is intended behavior. If it is then this is a feature request.
Also hints unused in the included file but that's probably a lot harder !

Case 1: File included before
========================
fileA
<?php
    $a=0;
?>

fileB
<?php
    include('FileA');
    $b = $a;                     //  <==== $a NOT hinted unused
?>

Case 2: File included after
======================
fileC
<?php
    $d = $c;
?>

fileD
<?php
    $c = 0;                   // <==== $a IS hinted unused
    include('FileC);
?>
Comment 1 Ondrej Brejla 2012-01-18 09:05:56 UTC
It's really hard and performance consuming to implement this behavior.
But:

1) $a in fileB is NOT hinted as "unsued" because it IS used (in assignment with $b), so everything is ok.

2) ...here is no $a so it can't be hinted ;)
but $c is hinted, because we can't really go through included files...as I wrote, it's really performance consuming...

...so it's really feature. Enhancement is a correct issue type :)

Thanks for your cooperation!