0

I came across this as part of some Laravel PHP code on YouTube. It does work, it's on a fresh install of vanilla Laravel 6, and the instructor appears to be using PHPStorm IDE:

dd( ...vars: $paymentGateway->charge( amount:2500));

I am aware of the splat operator, but this appears to be taking it a step further. I have looked everywhere and cannot find an explanation for ...vars: $whatever as an argument (or as anything else, for that matter). I don't understand how vars is not prepended with $ and the : that comes after.

UPDATE: The instructor answered my question. This is PHPStorm specific syntax. More information can be found here: https://www.jetbrains.com/help/webstorm/viewing-method-parameter-information.html

  • 2
    It's worth noting that it isn't any syntax. It isn't even part of the code—if you copy the code elsewhere or open the file with other editor you won't see it. It's basically the same as line numbers: an editor hint. – Álvaro González Nov 13 '19 at 18:26

1 Answers1

0

The instructor answered my question:

"... that is added by the IDE for reference only. Do not add that to your code. It’s called method hints and it’s a PHPStorm feature not a php thing"

For more information:

https://www.jetbrains.com/help/webstorm/viewing-method-parameter-information.html

I'll leave this here with the hope that it may save someone else some time when searching for three dots ... and a colon : such as ...vars:. It would have saved me a good hour at least!