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

',' expected in javascript embedded in PHP #2834

Open
leonardolara opened this issue Mar 28, 2024 · 2 comments
Open

',' expected in javascript embedded in PHP #2834

leonardolara opened this issue Mar 28, 2024 · 2 comments

Comments

@leonardolara
Copy link

Describe the bug
Intelephense's javascript analyzer is showing a ',' expected in opening brackets after PHP code in line 8 of the code below.

To Reproduce

<?php
header('Content-Type:text/html; charset=UTF-8');
$fruits = [1 => 'apples', 2 => 'oranges', 3 => 'lemons'];
?>
<script>
var x = [
    <?php foreach ($fruits as $key => $name) { ?>
    {
        "key": "<?php echo $key ?>",
        "name": "<?php echo $name ?>"
    },
    <?php } ?>
];
</script>

Expected behavior
There should be no syntax error detected in this code at line 8.

Screenshots
N/A

Platform and version
Windows 10, Intelephense v1.10.4.

@bmewburn
Copy link
Owner

I can't reproduce this with the given code. Could it be coming from a different extension?

@leonardolara
Copy link
Author

leonardolara commented Mar 30, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants