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
Enhancement: Implement UnwrapArrayReverse mutator #527
Conversation
f52601b
to
045bfa8
Compare
Mutator\Unwrap\UnwrapArrayFilter::class, | ||
Mutator\Unwrap\UnwrapArrayMap::class, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 tofalse
- with
$preserve_keys
set totrue
or will two more test cases suffice?
There was a problem hiding this comment.
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'];
<<<'PHP' | ||
<?php | ||
|
||
function array_reduce($array) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π€ not array_reverse
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, thank you, @akondas!
6234bcf
to
7518132
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π
7518132
to
629afcc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @localheinz
This PR
UnwrapArrayReverse
mutatorRelated to #514.
πββοΈ Follows the example in #513.