Typehiting for Smarty?

Hello,

how about adding support for defining variable type inside smarty like:

{* @var StoneBag $stones *}
or
{** @var StoneBag $stones *}

It could work exactly like inline phpDoc for variable:
/** @var StoneBag $stones */

Why?
1) autocompletion for methods and properties with Smarty templates:
{$stones->(autocompletion here)
2) finding all usages
3) refactoring (ie. Rename).

Right now we have to use Ctrl+Shift+F first in order to check if some method or property is used inside smarty templates. Only after we change all templates manually one by one, we can use great php storm reafactoring tools to change php files.

Don't know how many people still using Smarty, but maybe it wouldn't be so hard to introduce?

1 comment
Comment actions Permalink

Hi there,

You can submit your Feature Request to the Issue Tracker at https://youtrack.jetbrains.com/issues/WI

 

P.S.

Twig is the new Smarty these days. Together with Blade (from Laravel) they are the most popular modern templating engines for PHP these days (well, at least based on the fact that they used together with certain frameworks by default). But even them have not seen the love for similar requests from devs recently (https://youtrack.jetbrains.com/issue/WI-28093 and https://youtrack.jetbrains.com/issue/WI-25287 & https://youtrack.jetbrains.com/issue/WI-26501 respectively)

1

Please sign in to leave a comment.