From c4c0b094af6d7701ae56c9a3a34184711beec028 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 18 Jul 2018 16:15:20 +0200 Subject: [PATCH] add dump() case as well --- config/level/symfony/symfony31.yml | 14 ++++++++++++++ .../ArgumentDefaultValueReplacerRectorTest.php | 1 + .../Correct/correct5.php.inc | 7 +++++++ .../Wrong/wrong5.php.inc | 7 +++++++ .../ArgumentDefaultValueReplacerRector/config.yml | 14 ++++++++++++++ 5 files changed, 43 insertions(+) create mode 100644 tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/Correct/correct5.php.inc create mode 100644 tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/Wrong/wrong5.php.inc diff --git a/config/level/symfony/symfony31.yml b/config/level/symfony/symfony31.yml index 958ab6ca0af..b2aecfc893d 100644 --- a/config/level/symfony/symfony31.yml +++ b/config/level/symfony/symfony31.yml @@ -36,3 +36,17 @@ services: position: 1 before: 'false' after: 0 + + - + class: 'Symfony\Component\Yaml\Yaml' + method: 'dump' + position: 3 + before: ['false', 'true'] + after: 'Symfony\Component\Yaml\Yaml::DUMP_OBJECT' + + - + class: 'Symfony\Component\Yaml\Yaml' + method: 'dump' + position: 3 + before: 'true' + after: 'Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE' diff --git a/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/ArgumentDefaultValueReplacerRectorTest.php b/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/ArgumentDefaultValueReplacerRectorTest.php index 412e87c043d..4d813f04157 100644 --- a/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/ArgumentDefaultValueReplacerRectorTest.php +++ b/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/ArgumentDefaultValueReplacerRectorTest.php @@ -24,6 +24,7 @@ final class ArgumentDefaultValueReplacerRectorTest extends AbstractRectorTestCas yield [__DIR__ . '/Wrong/wrong2.php.inc', __DIR__ . '/Correct/correct2.php.inc']; yield [__DIR__ . '/Wrong/wrong3.php.inc', __DIR__ . '/Correct/correct3.php.inc']; yield [__DIR__ . '/Wrong/wrong4.php.inc', __DIR__ . '/Correct/correct4.php.inc']; + yield [__DIR__ . '/Wrong/wrong5.php.inc', __DIR__ . '/Correct/correct5.php.inc']; } protected function provideConfig(): string diff --git a/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/Correct/correct5.php.inc b/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/Correct/correct5.php.inc new file mode 100644 index 00000000000..49cf7329f25 --- /dev/null +++ b/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/Correct/correct5.php.inc @@ -0,0 +1,7 @@ + new A(), 'bar' => 1), 0, 0, \Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE); + +Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, \Symfony\Component\Yaml\Yaml::DUMP_OBJECT); diff --git a/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/Wrong/wrong5.php.inc b/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/Wrong/wrong5.php.inc new file mode 100644 index 00000000000..6a00e39c27b --- /dev/null +++ b/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/Wrong/wrong5.php.inc @@ -0,0 +1,7 @@ + new A(), 'bar' => 1), 0, 0, true); + +Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, true); diff --git a/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/config.yml b/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/config.yml index 3ca7abf93fe..09c1b7c4507 100644 --- a/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/config.yml +++ b/tests/Rector/Dynamic/ArgumentDefaultValueReplacerRector/config.yml @@ -35,3 +35,17 @@ services: position: 1 before: 'true' after: 'Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE' + + - + class: 'Symfony\Component\Yaml\Yaml' + method: 'dump' + position: 3 + before: ['false', 'true'] + after: 'Symfony\Component\Yaml\Yaml::DUMP_OBJECT' + + - + class: 'Symfony\Component\Yaml\Yaml' + method: 'dump' + position: 3 + before: 'true' + after: 'Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE'