diff --git a/resources/schema.json b/resources/schema.json index 117bdae6ab..7c24b59c48 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -349,6 +349,7 @@ "UnwrapArrayUnique": { "$ref": "#/definitions/default-mutator-config" }, "UnwrapArrayValues": { "$ref": "#/definitions/default-mutator-config" }, "UnwrapLcFirst": { "$ref": "#/definitions/default-mutator-config" }, + "UnwrapRtrim": { "$ref": "#/definitions/default-mutator-config" }, "UnwrapStrRepeat": { "$ref": "#/definitions/default-mutator-config" }, "UnwrapStrReplace": { "$ref": "#/definitions/default-mutator-config" }, "UnwrapStrToLower": { "$ref": "#/definitions/default-mutator-config" }, diff --git a/src/Mutator/ProfileList.php b/src/Mutator/ProfileList.php index 2cc11e3a64..4e378d10ff 100644 --- a/src/Mutator/ProfileList.php +++ b/src/Mutator/ProfileList.php @@ -239,6 +239,7 @@ final class ProfileList Mutator\Unwrap\UnwrapArrayUnique::class, Mutator\Unwrap\UnwrapArrayValues::class, Mutator\Unwrap\UnwrapLcFirst::class, + Mutator\Unwrap\UnwrapRtrim::class, Mutator\Unwrap\UnwrapStrRepeat::class, Mutator\Unwrap\UnwrapStrReplace::class, Mutator\Unwrap\UnwrapStrToLower::class, @@ -421,6 +422,7 @@ final class ProfileList 'UnwrapArrayUnique' => Mutator\Unwrap\UnwrapArrayUnique::class, 'UnwrapArrayValues' => Mutator\Unwrap\UnwrapArrayValues::class, 'UnwrapLcFirst' => Mutator\Unwrap\UnwrapLcFirst::class, + 'UnwrapRtrim' => Mutator\Unwrap\UnwrapRtrim::class, 'UnwrapStrRepeat' => Mutator\Unwrap\UnwrapStrRepeat::class, 'UnwrapStrReplace' => Mutator\Unwrap\UnwrapStrReplace::class, 'UnwrapStrToLower' => Mutator\Unwrap\UnwrapStrToLower::class, diff --git a/src/Mutator/Unwrap/UnwrapRtrim.php b/src/Mutator/Unwrap/UnwrapRtrim.php new file mode 100644 index 0000000000..1792ecfed6 --- /dev/null +++ b/src/Mutator/Unwrap/UnwrapRtrim.php @@ -0,0 +1,72 @@ +doTest($input, $expected); + } + + public function mutationsProvider(): iterable + { + yield 'It mutates correctly when provided with a string' => [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' +bar()); +PHP + , + <<<'PHP' +bar(); +PHP + ]; + + yield 'It mutates correctly when provided with a more complex situation' => [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' +