4.2.9. Make Static Closures And Arrow Functions

Add the static option to closures and arrow functions. This prevents the defining environment to be included in the closure.

4.2.9.1. Before

<?php
    $a = function () { return 1; };
    $b = fn () => 2;
?>

4.2.9.2. After

<?php
    $a = static function () { return 1; };
    $b = static fn () => 2;
?>

4.2.9.3. Suggested Analysis

4.2.9.4. Reverse Cobbler

  • No anchor for Functions/RemoveStaticFromFunction

4.2.9.5. Specs

Short Name

Functions/MakeStaticFunction

Exakat version

2.3.0

Available in

Entreprise Edition, Exakat Cloud