@@ -2785,12 +2785,14 @@ function printNode(path, options, print) {
27852785 if ( parent . kind === "encapsedpart" ) {
27862786 const parentParent = path . getParentNode ( 1 ) ;
27872787 let closingTagIndentation = 0 ;
2788+ const flexible = isMinVersion ( options . phpVersion , "7.3" ) ;
2789+ const linebreak = flexible ? hardline : literalline ;
27882790 if ( parentParent . type === "heredoc" ) {
27892791 const lines = parentParent . raw . split ( / \r ? \n / g) ;
27902792 closingTagIndentation = lines [ lines . length - 1 ] . search ( / \S / ) ;
27912793 }
27922794 return join (
2793- literalline ,
2795+ linebreak ,
27942796 node . raw
27952797 . split ( / \r ? \n / g)
27962798 . map ( ( s ) => s . substring ( closingTagIndentation ) )
@@ -2837,17 +2839,20 @@ function printNode(path, options, print) {
28372839 switch ( node . type ) {
28382840 case "string" :
28392841 case "shell" :
2840- case "heredoc" :
2842+ case "heredoc" : {
2843+ const flexible = isMinVersion ( options . phpVersion , "7.3" ) ;
2844+ const linebreak = flexible ? hardline : literalline ;
28412845 return concat ( [
28422846 getEncapsedQuotes ( node ) ,
28432847 // Respect `indent` for `heredoc` nodes
2844- node . type === "heredoc" ? literalline : "" ,
2848+ node . type === "heredoc" ? linebreak : "" ,
28452849 concat ( path . map ( print , "value" ) ) ,
28462850 getEncapsedQuotes ( node , { opening : false } ) ,
28472851 node . type === "heredoc" && docShouldHaveTrailingNewline ( path )
28482852 ? hardline
28492853 : "" ,
28502854 ] ) ;
2855+ }
28512856 // istanbul ignore next
28522857 default :
28532858 return `Have not implemented kind ${ node . type } yet.` ;
0 commit comments