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 211260

Summary: PHP Does Not detect all unused variables
Product: php Reporter: joao_neto <joao_neto>
Component: RefactoringAssignee: Ondrej Brejla <obrejla>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P3    
Version: 7.1.1   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description joao_neto 2012-04-16 14:28:24 UTC
On a PHP functions and methods, create a var without use it raise a "unnused" highlight on the editor, but this feature does not cat highlight variables ununsed but the publisher has not find cases of variables that were not used, but were used on allocations in a more than once time.

Examples:

<?php
function a()
{
  $test = 1; //highlight unnused var
}

function b()
{
  $test = 1;
  $test ++; //do not highlight $test
}
 
in practice, this variable is not being used because the assignment it is not serving.
Comment 1 Ondrej Brejla 2012-04-16 14:34:04 UTC
Works for me properly in 7.2. In function a(), $test variable is underlined as unused.

In function b(), NO variable is underlined, because $test variable which is declared by its first assignment is then used in an unary incrementation. So no "Unused variable" hint occurs in NB 7.2.