prettier/plugin-php is not format code in php (<?) short open tag , work with only (<?php)
Hi
prettier/plugin-php is not format code in php (<?) short open tag , work with only (<?php)
Prettier 6.3.1 PHP Plugin 0.16.2
Input:
<?
echo 1;
echo 300;
function a($a )
{
echo 100;
echo 800;
}
?>
Save Output:
<?
echo 1;
echo 300;
function a($a )
{
echo 100;
echo 800;
}
?>
Input:
<?php
echo 1;
echo 300;
function a($a )
{
echo 100;
echo 800;
}
?>
Save Output , Work with <?php :
<?php
echo 1;
echo 300;
function a($a)
{
echo 100;
echo 800;
}
?>
Debug options { "filepath": "includes\get-approve-email.php", "parser": "php", "semi": false, "arrowParens": "always", "singleQuote": true, "printWidth": 800, "tabWidth": 3, "separatorWidth": 800, "trailingCommaPHP": false, "braceStyle": "psr-2", "requirePragma": false, "insertPragma": false } Thanks.
@mean-cj Please share your steps to configure prettier plugin to work in as simple terms as possible, following the readme, didn't work for me
Short open tags (<?) are not supported by the parser we're using, that's why the code is treated as an inline element (as if it was HTML). I can see that supporting (and automatically converting) short opening tags would be useful especially when working with legacy codebases, but I'm not sure if it's worth the effort considering that they are discouraged / being removed in recent PHP releases (https://wiki.php.net/rfc/deprecate_php_short_tags)
Related: https://github.com/prettier/plugin-php/issues/1679