1.2.312. Create Compact Variables

This command creates Variable definitions, based on usage of compact().

This only works when compact() is used with literal values, or with constants. Dynamic values are not reported.

<?php

function foo() {
    $a = 1;
    return compact('a');
}
?>

1.2.312.1. Specs

Short name

Complete/CreateCompactVariables

Rulesets

All, CE, Changed Behavior, NoDoc

Exakat since

1.9.2

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

compact, dynamic-variable

Available in

Entreprise Edition, Community Edition, Exakat Cloud