Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
6 tasks done
pistej opened this issue Jul 26, 2022 · 2 comments
Open
6 tasks done
Assignees
Labels
Milestone

Comments

@pistej
Copy link

pistej commented Jul 26, 2022

  • PHPMD version: 2.12.0
  • PHP Version: 8.0, 8.1
  • Installation type: composer, in docker image
  • Operating System / Distribution & Version: Alpine, ubuntu 20.04

Current Behavior

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

Expected Behavior

Analysis should work

Steps To Reproduce:

  • Install PHPMD composer require --dev phpmd/phpmd
  • create test.php file with code example below
  • run php vendor/bin/phpmd test.php ansi naming

Example code

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

<?= $var1,$var2 ?>

Checks before submitting

  • Be sure that there isn't already an issue about this. See: Issues list
  • Be sure that there isn't already a pull request about this. See: Pull requests
  • I have added every step to reproduce the bug.
  • If possible I added relevant code examples.
  • This issue is about 1 bug and nothing more.
  • The issue has a descriptive title. For example: "JSON rendering failed on Windows for filenames with space".
@kylekatarnls
Copy link
Member

Bug confirmed, meanwhile you can use:

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

Or:

<?= $var1.$var2 ?>

@kylekatarnls
Copy link
Member

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.

@kylekatarnls kylekatarnls self-assigned this Aug 27, 2022
@kylekatarnls kylekatarnls added this to the 2.13.0 milestone Aug 27, 2022
@kylekatarnls kylekatarnls modified the milestones: 2.13.0, 2.14.0 Sep 10, 2022
@kylekatarnls kylekatarnls modified the milestones: 2.14.0, 2.15.0 Sep 27, 2023
@kylekatarnls kylekatarnls modified the milestones: 2.15.0, 2.16.0 Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants