Skip to content

PHP 7.4: New NewArrowFunction sniff#985

Merged
wimg merged 1 commit intodevelopfrom
php74/new-arrow-functions-sniff
Apr 10, 2020
Merged

PHP 7.4: New NewArrowFunction sniff#985
wimg merged 1 commit intodevelopfrom
php74/new-arrow-functions-sniff

Conversation

@jrfnl
Copy link
Copy Markdown
Member

@jrfnl jrfnl commented Mar 27, 2020

New sniff to detect PHP 7.4 arrow functions.

Arrow functions

Arrow functions provide a shorthand syntax for defining functions with implicit by-value scope binding.

<?php
$factor = 10;
$nums = array_map(fn($n) => $n * $factor, [1, 2, 3, 4]);
// $nums = array(10, 20, 30, 40);
?>

Refs:

Related to #808

New sniff to detect PHP 7.4 arrow functions.

> Arrow functions
>
> Arrow functions provide a shorthand syntax for defining functions with implicit by-value scope binding.
> ```php
> <?php
> $factor = 10;
> $nums = array_map(fn($n) => $n * $factor, [1, 2, 3, 4]);
> // $nums = array(10, 20, 30, 40);
> ?>

Refs:
* https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.arrow-functions
 * https://wiki.php.net/rfc/arrow_functions_v2

Related to 808
@wimg wimg merged commit a88a4c8 into develop Apr 10, 2020
@wimg wimg deleted the php74/new-arrow-functions-sniff branch April 10, 2020 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants