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

Don't output null for last element in list/array #174

Closed
alexander-akait opened this issue Aug 29, 2018 · 12 comments
Closed

Don't output null for last element in list/array #174

alexander-akait opened this issue Aug 29, 2018 · 12 comments
Assignees
Labels

Comments

@alexander-akait
Copy link
Collaborator

Input:

list(,$first, $second, $three, $fourth,) = $arr;

Contain null in arguments.

Babylon example: https://astexplorer.net/#/gist/6d37953c6b42f02a3ffe48b6101127c3/745b62f49d2c011d789e6d9754a4d705db5cdab0

I think it is unnecessary, because it is doesn't have sense for executing/parsing/printing/etc.

@ichiriac
Copy link
Member

You're right about stripping null items from the end

@ichiriac
Copy link
Member

ichiriac commented Sep 8, 2018

fixed with this commit : a6519fd - released under 3.0.0-prerelease.4

@ichiriac ichiriac closed this as completed Sep 8, 2018
@alexander-akait
Copy link
Collaborator Author

@ichiriac looks null still exists after upgrading to 3.0.0-prerelease.4 😕

@alexander-akait
Copy link
Collaborator Author

/cc @ichiriac friendly ping, still exists 😄

@ichiriac
Copy link
Member

😀 sorry, i'll check this next week, this week-end i'm bussy, not at home. I'll keep you in tuch

@alexander-akait
Copy link
Collaborator Author

@ichiriac 👍 Thanks!

@ichiriac
Copy link
Member

ichiriac commented Aug 9, 2019

Hi,

I could strip them, but without node you may loose comments, here an example :

<?php
list($a, $b, /* arg3 */, /* arg 4 */) = [1,2,3,4];

It's better to introduce a Noop node that could bind at the right place the comment (could also be used on empty functions bodies in order to attach on it the comment

@alexander-akait
Copy link
Collaborator Author

👍

ichiriac added a commit that referenced this issue Aug 9, 2019
ichiriac added a commit that referenced this issue Aug 9, 2019
@ichiriac ichiriac added the RELEASE-READY Waiting to release label Aug 9, 2019
@ichiriac
Copy link
Member

ichiriac commented Aug 9, 2019

It's fixed & will be released soon

@alexander-akait
Copy link
Collaborator Author

@ichiriac maybe not right place, but just want put here with list problems for use prettier/plugin-php#854

@alexander-akait
Copy link
Collaborator Author

php7.3 was released very long time age and we sill doesn't support many features

@ichiriac
Copy link
Member

ichiriac commented Aug 9, 2019

ok, that was referenced under #345 & #346

@ichiriac ichiriac removed the RELEASE-READY Waiting to release label Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants