noverify icon indicating copy to clipboard operation
noverify copied to clipboard

Unused variable in do-while loop

Open quasilyte opened this issue 5 years ago • 0 comments

Code Example

<?php

function f() { return rand(0, 5); }

function g() {
  $x = 1;
  do {
    var_dump($x);
  } while ($x = f());
}

Actual Behavior

<critical> UNUSED  unused: Unused variable x (use $_ to ignore this inspection) at /home/isharipov/CODE/php/hello.php:9
  } while ($x = f());
           ^^

Expected Behavior

No warning about unused var.

quasilyte avatar Nov 02 '19 00:11 quasilyte