Reputation: 4102
I am new in PhpStorm and I run into a problem when declaring xml on .php file, The problem I am talking about is that PhpStorm is refers the <? ?>
as the short opening tags as php opening tags while I set short_open_tag = Off at the php.ini.
How can I set PhpStorm so it won't refer the short php opening tags as php opening tags?
Upvotes: 2
Views: 5722
Reputation: 731
Variables, echos. Meh. Why not simply...
<<?php ?>?xml version="1.0" encoding="utf-8" ?>
No mess, no complains from PHPStorm or whatever. Basically, you may even use just <??>
instead of <?php ?>
, if you don't need the absolutely bulletproof solution covering both on
and off
cases for short_open_tag
.
Upvotes: 4
Reputation: 198118
PHPStorm as of now does not have any setting for that (see WI-2059 add "Disable short tags" option to project's options).
So you can not set that so far. All you can do is to write the code in a way that it does not clash, for example by echoing the XML declaration processing instruction:
<?php echo '<?xml version="1.0" encoding="utf-8" ?>' ?>
Upvotes: 7
Reputation: 15968
Just put your XML in a variable and output it:
<?php
$xml = <<<XML
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<description>CSH for Content Elements Table.</description>
<type>CSH</type>
<csh_table>tt_content</csh_table>
</meta>
</T3locallang>
XML;
echo $xml;
?>
There is no other solution for PhpStorm, AFAIK.
Upvotes: 2