Allow the use of PHP short open tags 关注
I am using PhpSorm 2020.1.1.
Since a few versions, can't remember exactly how long ago, when I write Php code and start opening a tag, like <?, it gets automatically transformed into <?php.
In more than one project I work on the code uses the short tag syntax, so <? and <?=. I couldn't find a way to set this as a preference.
How can I do that?
Settings/Preferences | Editor | General | Smart Keys | PHP | Auto-insert '<?php' tag after typing '<?'
I have this option turned on, but it's not working now.
I remember some time ago, I just clicked on some popup message about turn this off... And I think it was this switcher. But it's not.
So, the situation like this:
PhpStorm 2022.2.3, Build #PS-222.4345.15, built on October 5, 2022.
And I have this switcher "on".
After typing <? nothing happened. I press space and see mistake now:
Of corse I can press "Replace... " and it will be fixed.
But I believe with that switcher it even couldn't happen.
Strange, works normally here: https://i.gyazo.com/74d192ae4e14d65e5a32bdd67a2a05ba.mp4
Check if restoring default IDE settings helps: https://www.jetbrains.com/help/phpstorm/configuring-project-and-ide-settings.html#restore-defaults
So, I figure out it works, but not always.
At the beginning of script is ok, but inside of some html surrounding is not working.
Must be this one: https://youtrack.jetbrains.com/issue/WI-16220/Insert-closing-php-tag-on-typing-php-inside-HTML
As a possible workaround: make a custom Live Template that will expand <?[SPACE] into <?php [CARET] ?> (use <? as an abbreviation and [SPACE] as an expand key; apply for HTML context only)