Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tauqeerhayat10's avatar

Closure Function in phpstrom

in new serires laravel 8 from scratch, instructor use closure arrow function with the help of phpstrom...but this option not showing in my project (phpstrom)...where is the issue!

0 likes
5 replies
MichalOravec's avatar

For arrow function you have to have PHP version 7.4 or newer.

isimmons's avatar

Old post but I just ran into this problem. In the latest PHPStorm 2021.3.1 I had to set the language level. Out of the box it was set at version 7.3. I had tried to manually create a arrow function and got an error telling me I had to have at least 7.4 , which was confusing since I only have 8.1 installed on my system. I thought PHPStorm would have auto detected this but apparently it doesn't.

Hope this helps someone out if they run into this.

Sinnbeck's avatar

@isimmons It uses your composer.json, and sticks to the lowest version it finds. So just change it to the correct version

Please or to participate in this conversation.