From b9b4db0c8edb6ec02f7fba51e65ff114a7951f79 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Wed, 12 Mar 2025 23:32:34 +0100 Subject: [PATCH] Compile: Add more php_shrink tests --- php_shrink.inc.php | 13 ++++++++++++- tests/php_shrink.php | 16 ++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/php_shrink.inc.php b/php_shrink.inc.php index f13c2f95..f127493d 100644 --- a/php_shrink.inc.php +++ b/php_shrink.inc.php @@ -1,7 +1,18 @@ HTMLab; }}', 'class C{var$ab;function f($b){return$b.$this->ab;}}'); +check('namespace NS { class C { public $ab = 1; } } new NS\C; $ab = 2;', 'namespace NS{class C{var$ab=1;}}new NS\C;$a=2;'); check('new \stdClass;', 'new \stdClass;'); +check('if (true) { echo "a"; } else { echo "b"; }', 'if(true)echo"a";else echo"b";'); +check('echo $_GET["a"];', 'echo$_GET["a"];'); +check('$ab = 1; echo "$ab";', '$a=1;echo"$a";'); +check('echo 1; echo 3;', 'echo 1,3;'); +check('echo 1; ?>2