PHP-Parser icon indicating copy to clipboard operation
PHP-Parser copied to clipboard

`doc/component/Pretty_printing.markdown`: `shortArraySyntax` not the legacy option

Open WinterSilence opened this issue 3 years ago • 2 comments

This is a legacy option, and phpVersion should be used to control this behavior instead.

it's invalid because you can use latest version of PHP, but print code compatible with old versions

WinterSilence avatar Sep 10 '22 01:09 WinterSilence

I don't understand what you're trying to say. The phpVersion option has nothing to do with the version of PHP you're running on.

nikic avatar Sep 10 '22 07:09 nikic

@nikic for example, we want use old array syntax to print AST contained flexible heredoc's, but we can't pass ['phpVersion' => PhpVersion::fromComponents(5, 4)] because this can fail rendering flexible heredoc's.

https://github.com/nikic/PHP-Parser/blob/b4b60c8460136c492dd551e14516e5caaceef8fa/lib/PhpParser/PrettyPrinterAbstract.php#L157

WinterSilence avatar Sep 10 '22 08:09 WinterSilence