I am wondering here by the parameter passing in the new Laravel Mail class. My IDE
(VSCode) also underlines the parameter and throws the following error: syntax error, unexpected ':', expecting ')'
public function envelope()
{
return new Envelope(
subject: 'Subject', // <-- the key subject
from: '[email protected]', // <-- the key from
);
}
Nevertheless, it works. It’s probably a new PHP specification that I don’t know
yet. What is it called and does it work? And how can I teach my IDE that it is
not an error?
2
Answers
Hello Friend Your Syntax Is Wrong The Syntax in Laravel 9.0.0 in image
enter image description here
you can write code in this syntax