Allow the use of PHP short open tags

Hello,

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?

0
6 comments

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.

https://gyazo.com/d96bdc0630d580ac5b7cffea3e5da460

1

@Dimas Frolov

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)

1

Hi there,

Settings/Preferences  | Editor | General | Smart Keys | PHP | Auto-insert '<?php' tag after typing '<?'

0

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.

0

Please sign in to leave a comment.