<?php
class Demo
{
public static function test(): string
{
return <<<'EOF'
This is the first line!
I am a nowdoc.
Everything is just fine.
The end is near.
EOF;
}
}
test.php
<?php
use PhpCodeMinifier\MinifierFactory;
require __DIR__ . '/vendor/autoload.php';
echo (new MinifierFactory())->create()->minifyFile(__DIR__ . '/Demo.php');
results in:
<?php class Demo{public static function test():string{return <<<'EOF' This is the first line!
I am a nowdoc.
Everything is just fine.
The end is near.
EOF;}}
the first line of the nowdoc/heredoc should be in a new line after the opening EOF
content of nowdoc should not have left side padding when minified
the spacing before the closing EOF is incorrect (has one empty space).
expected:
<?php class Demo{public static function test():string{return <<<'EOF'
This is the first line!
I am a nowdoc.
Everything is just fine.
The end is near.
EOF;}}
It fails with both pre 7.3 syntax and >=7.3 syntax.
Reproduce with:
Demo.php
test.php
results in:
EOF
EOF
is incorrect (has one empty space).expected:
It fails with both pre 7.3 syntax and >=7.3 syntax.