Cannot use variable $%S twice

Description

The same variable cannt be mentionned twice in the use part of a closure definition. This would mean the same argument is defined twice, which is useless.

Example

<?php

$fn = function() use ($a, &$a) {
    $a = 2;
};

?>

Literal Examples

  • Cannot use variable $a twice

Solutions

  • Make all variables mentionned in the use expression unique (with or without the reference).