1.2.467. Follow Closure Definition

This command adds DEFINITION link between closure <https://www.php.net/`closure>`_ and arrow functions definitions and their usage.

Local usage of the closure <https://www.php.net/`closure>`_, in the same scope, are detected. Relayed closure <https://www.php.net/`closure>`_, when they are transmitted to another method for usage, is detected, for one jump.

This also supports first class callable, when the callable is defined in the code code (aka, not with native PHP functions or external libraries).

<?php

function foo() {
    $closure = function () {};
    // Local usage
    echo $closure();
}

function bar(Closure $x) {
    // relayed usage
    echo $x();
}


?>

1.2.467.1. Specs

Short name

Complete/FollowClosureDefinition

Rulesets

All, CE, Changed Behavior, NoDoc

Exakat since

1.9.2

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Features

closure, arrow-function

Available in

Entreprise Edition, Community Edition, Exakat Cloud