phpmd / phpmd

PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend.
https://phpmd.org
BSD 3-Clause "New" or "Revised" License
2.34k stars 347 forks source link

Unexpected token when using more varaibles in <?= ?> php echo statement #966

Open pistej opened 2 years ago

pistej commented 2 years ago

Current Behavior

Unexpected token: ,, line: 6, col: 10, file:: /test.php

Expected Behavior

Analysis should work

Steps To Reproduce:

Example code

<?php
$var1 = 'foo';
$var2 = 'bar';
?>

<?= $var1,$var2 ?>

Checks before submitting

kylekatarnls commented 2 years ago

Bug confirmed, meanwhile you can use:

<?php echo $var1,$var2; ?>

Or:

<?= $var1.$var2 ?>
kylekatarnls commented 2 years ago

I'm working on a fix, you can try composer require pdepend/pdepend:dev-fix/short-tags-multiple-variables (if you use PHPMD from composer) to preview it and support comas in <?= ?> tags.