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

Summary: Variable is hinted unused if used in file included later, but not if included before
Product: php Reporter: berniev
Component: EditorAssignee: Ondrej Brejla <obrejla>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.1   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:

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!