noverify icon indicating copy to clipboard operation
noverify copied to clipboard

Handling of !isset (and probably !empty, etc.)

Open quasilyte opened this issue 5 years ago • 0 comments

Code Example

<?php

if (!isset($x)) {
  // Not important.
} else {
  var_dump($x); // <--
}

Actual Behavior

Warning about undefined var.

Expected Behavior

No warnings.

Found this code pattern in Yii2 framework. Real code:

                if (!isset($all)) {
                    $all = $name;
                } else {
                    throw new Exception("Only one target can have empty 'depends' option. Found two now: $all, $name");
                }

quasilyte avatar Nov 01 '19 23:11 quasilyte