1.2.511. Handle Arrays With Callback

This rule marks method and function calls that accepts array callbacks as argument.

It marks the method call, and not the argument.

<?php

// Handles arrays with callback
$uppercase = array_map('strtoupper', $source);

// Handles arrays with foreach
foreach($source as &$s) {
    $s = uppercase($s);
}

?>

See also array_map.

1.2.511.1. Specs

Short name

Arrays/WithCallback

Rulesets

All, Appinfo, CE, Changed Behavior

Exakat since

1.3.7

PHP Version

All

Severity

Time To Fix

Precision

High

Available in

Entreprise Edition, Community Edition, Exakat Cloud