diff --git a/resources/schema.json b/resources/schema.json index 7d0b8176d..2abac35b6 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -350,6 +350,7 @@ "UnwrapArrayValues": { "$ref": "#/definitions/default-mutator-config" }, "UnwrapLcFirst": { "$ref": "#/definitions/default-mutator-config" }, "UnwrapLtrim": { "$ref": "#/definitions/default-mutator-config" }, + "UnwrapRtrim": { "$ref": "#/definitions/default-mutator-config" }, "UnwrapStrIreplace": { "$ref": "#/definitions/default-mutator-config" }, "UnwrapStrRepeat": { "$ref": "#/definitions/default-mutator-config" }, "UnwrapStrReplace": { "$ref": "#/definitions/default-mutator-config" }, diff --git a/src/Mutator/ProfileList.php b/src/Mutator/ProfileList.php index 00e807f89..a0b2af87a 100644 --- a/src/Mutator/ProfileList.php +++ b/src/Mutator/ProfileList.php @@ -240,6 +240,7 @@ final class ProfileList Mutator\Unwrap\UnwrapArrayValues::class, Mutator\Unwrap\UnwrapLcFirst::class, Mutator\Unwrap\UnwrapLtrim::class, + Mutator\Unwrap\UnwrapRtrim::class, Mutator\Unwrap\UnwrapStrIreplace::class, Mutator\Unwrap\UnwrapStrRepeat::class, Mutator\Unwrap\UnwrapStrReplace::class, @@ -425,6 +426,7 @@ final class ProfileList 'UnwrapArrayValues' => Mutator\Unwrap\UnwrapArrayValues::class, 'UnwrapLcFirst' => Mutator\Unwrap\UnwrapLcFirst::class, 'UnwrapLtrim' => Mutator\Unwrap\UnwrapLtrim::class, + 'UnwrapRtrim' => Mutator\Unwrap\UnwrapRtrim::class, 'UnwrapStrIreplace' => Mutator\Unwrap\UnwrapStrIreplace::class, 'UnwrapStrRepeat' => Mutator\Unwrap\UnwrapStrRepeat::class, 'UnwrapStrReplace' => Mutator\Unwrap\UnwrapStrReplace::class, diff --git a/src/Mutator/Unwrap/UnwrapRtrim.php b/src/Mutator/Unwrap/UnwrapRtrim.php new file mode 100644 index 000000000..1792ecfed --- /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' +