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

Enhancement: Implement UnwrapArrayReverse mutator #527

Merged

Conversation

localheinz
Copy link
Member

@localheinz localheinz commented Oct 29, 2018

This PR

Related to #514.

πŸ’β€β™‚οΈ Follows the example in #513.

@localheinz localheinz force-pushed the feature/array-reverse-unwrap branch 2 times, most recently from f52601b to 045bfa8 Compare October 29, 2018 22:17
Mutator\Unwrap\UnwrapArrayFilter::class,
Mutator\Unwrap\UnwrapArrayMap::class,
Copy link
Member Author

Choose a reason for hiding this comment

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

'UnwrapArrayFilter' => Mutator\Unwrap\UnwrapArrayFilter::class,
'UnwrapArrayMap' => Mutator\Unwrap\UnwrapArrayMap::class,
Copy link
Member Author

Choose a reason for hiding this comment

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

$this->doTest($input, $expected);
}

public function provideMutationCases(): \Generator
Copy link
Member Author

Choose a reason for hiding this comment

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

Should I add any cases that involve the $preserve_keys parameter?

See http://php.net/array_reverse.

Copy link
Member

Choose a reason for hiding this comment

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

For the sake of completeness, sure why not.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sanmai

Not sure about the number of tests, do we need to have three instead of one data set

  • as is at the moment
  • with $preserve_keys set to false
  • with $preserve_keys set to true

or will two more test cases suffice?

Copy link
Member

Choose a reason for hiding this comment

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

I'd leave it with just one test with an extra argument. It can be a variable like so:

- $a = array_reverse(['foo'], $preserve_keys);
+ $a = ['foo'];

sanmai
sanmai previously approved these changes Oct 30, 2018
<<<'PHP'
<?php

function array_reduce($array)
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ€” not array_reverse here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ha, thank you, @akondas!

@localheinz localheinz force-pushed the feature/array-reverse-unwrap branch 4 times, most recently from 6234bcf to 7518132 Compare October 30, 2018 08:40
maks-rafalko
maks-rafalko previously approved these changes Oct 30, 2018
Copy link
Member

@maks-rafalko maks-rafalko left a comment

Choose a reason for hiding this comment

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

πŸ‘

@localheinz localheinz changed the title Enhancement: Implement ArrayReverseUnwrap mutator Enhancement: Implement UnwrapArrayReverse mutator Oct 30, 2018
@maks-rafalko maks-rafalko mentioned this pull request Oct 30, 2018
46 tasks
@maks-rafalko maks-rafalko added this to the 0.11.0 milestone Oct 30, 2018
Copy link
Member

@maks-rafalko maks-rafalko left a comment

Choose a reason for hiding this comment

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

Thank you @localheinz

@maks-rafalko maks-rafalko merged commit 6c85cb2 into infection:master Oct 31, 2018
@localheinz localheinz deleted the feature/array-reverse-unwrap branch October 31, 2018 06:33
@localheinz
Copy link
Member Author

Thank you, @akondas, @borNfreee, and @sanmai!

raphaelstolt pushed a commit to raphaelstolt/infection that referenced this pull request Nov 2, 2018
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 this pull request may close these issues.

None yet

4 participants