Skip to content

Feat spread operator for array #407

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

Merged
merged 2 commits into from
Jan 2, 2020
Merged

Conversation

alexander-akait
Copy link
Collaborator

@alexander-akait alexander-akait commented Sep 11, 2019

  • support spread operator (...) for array
  • always use entry for any item in array (PHP parser do same)
  • add byRef to entry node if we use & with variable to avoid invalid grammatical
  • add unpack when ... uses
  • tests
  • remove unnecessary read_byref due refactor

Entry when key is null means value item ([$var, $var2, $var3])
Entry when key is not null means key-value item (['one' => $var, 'two' => $var, 'three' => $var])

Interesting note - grammar support ... in list and in foreach, but php throw error in runtime, we need do same in future, now it is impossible due invalid grammar in read_expr_item, we need refactor and them do it, it is not high priority because nobody writes this code

@alexander-akait alexander-akait force-pushed the feat-spread_operator_for_array branch from 7fa6745 to bf80c6f Compare September 11, 2019 21:05
@coveralls
Copy link

coveralls commented Sep 11, 2019

Coverage Status

Coverage increased (+0.02%) to 95.877% when pulling bf80c6f on feat-spread_operator_for_array into 0df5a49 on master.

@ichiriac ichiriac changed the base branch from master to prettier September 17, 2019 14:04
@alexander-akait alexander-akait force-pushed the prettier branch 2 times, most recently from c2e2bc4 to 7c09272 Compare October 3, 2019 16:47
@ichiriac
Copy link
Member

ichiriac commented Dec 28, 2019

@evilebottnawi does this branch should be merged ?

@alexander-akait
Copy link
Collaborator Author

Need review and we can merge this 😄

@ichiriac ichiriac self-requested a review January 2, 2020 13:06
@ichiriac ichiriac changed the base branch from prettier to master January 2, 2020 13:07
Copy link
Member

@ichiriac ichiriac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's ok

@ichiriac ichiriac merged commit 6df8778 into master Jan 2, 2020
ichiriac added a commit that referenced this pull request Jan 2, 2020
@alexander-akait alexander-akait deleted the feat-spread_operator_for_array branch January 3, 2020 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants