Fork me on GitHub
a Sensio Labs Product

7th Gear (v3.59.3) edition

Rule use_arrow_functions

Anonymous functions with one-liner return statement must use arrow functions.


Using this rule is risky

Risky when using isset() on outside variables that are not imported with use ().


Example #1

--- Original
+++ New
-foo(function ($a) use ($b) {
-    return $a + $b;
+foo(fn ($a) => $a + $b);

Rule sets

The rule is part of the following rule sets:


The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.