Since this commit by @angrybrad the phpdoc for Craft::$app has moved into the CraftTrait and is back referenced with @mixin. But Intelephense for VS Code for example doesn't support the @mixin pattern (https://github.com/bmewburn/vscode-intelephense/issues/123), so at least for VS Code auto completion is now broken for Craft::$app 😢
Craft::$app->getEle…We use the @mixin trick in a few other places as well, and that commit fixed a major testing bug, so I don’t want to revert it. I love VSCode, but it’s not a great PHP editor.
I won't go into an editor discussion, because it's a personal choice.
My quick fix was to add @property \craft\web\Application|\craft\console\Application $app to the phpdoc for Craft. Maybe it's possible to add this? I think that I'm not alone using VS Code developing Craft and it would restore the great developer experience I had with Craft. Thank you ❤️
Ah interesting, sure we can add that. That trick doesn’t actually work for PhpStorm, but can’t hurt.
Most helpful comment
Ah interesting, sure we can add that. That trick doesn’t actually work for PhpStorm, but can’t hurt.