1.2.463. First Class Callable

A syntax using ellipsis was introduced to make it easy to make a method into a callable.

<?php

// Using ellipsis as the only argument
$a = $object->method(...);

// Old style equivalent
$a = array($object, 'method');

// calling the closure.
$a();

?>

See also PHP RFC: First-class callable syntax.

1.2.463.1. Specs

Short name

Php/FirstClassCallable

Rulesets

All, Appinfo

Exakat since

2.3.0

PHP Version

With PHP 8.1 and more recent

Severity

Time To Fix

Precision

Very high

Features

first-class-callable

Available in

Entreprise Edition, Exakat Cloud