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 - PHP Does Not detect all unused variables
Summary: PHP Does Not detect all unused variables
Status: RESOLVED WORKSFORME
Alias: None
Product: php
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.1.1
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-16 14:28 UTC by joao_neto
Modified: 2012-04-16 14:34 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 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.