Repository: symplify/symplify (php)

Issue:
[monorepo-builder] vendor/bin/monorepo-builder init generates files with deprecated code
The vendor/bin/monorepo-builder init command generates

```php
    $parameters->set(Option::DATA_TO_APPEND, [
        ComposerJsonSection::REQUIRE_DEV => [
            'phpunit/phpunit' => '^9.5',
        ],
    ]);
```

Option::DATA_TO_APPEND is deprecated, though the deprecation message isn't enormously useful to first-time users:

```php
    /**
     * @var string
     * @deprecated Use MBConfig instead
     * @api
     */
    public const DATA_TO_APPEND = 'data_to_append';
```

How does one actually get $mbConfig, in order to call packageDirectories() on it?

On a related note, why not generate the initial file with the packages directory set by default?  Otherwise, if you're following the instructions you immediately get an error.

Pull request description:
[MonorepoBuilder] Fix old config leftovers [closes #4405]

Patch:
diff --git a/packages/monorepo-builder/build/target-repository/README.md b/packages/monorepo-builder/build/target-repository/README.md
index 09fd258fe..5aba7b8c7 100644
--- a/packages/monorepo-builder/build/target-repository/README.md
+++ b/packages/monorepo-builder/build/target-repository/README.md
@@ -49,17 +49,13 @@ vendor/bin/monorepo-builder merge
 Typical location for packages is `/packages`. But what if you have different naming or extra `/projects` directory?
 
 ```php
-// File: monorepo-builder.php
-
-use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+// monorepo-builder.php
 use Symplify\ComposerJsonManipulator\ValueObject\ComposerJsonSection;
-use Symplify\MonorepoBuilder\ValueObject\Option;
-
-return static function (ContainerConfigurator $containerConfigurator): void {
-    $parameters = $containerConfigurator->parameters();
+use Symplify\MonorepoBuilder\Config\MBConfig;
 
+return static function (MBConfig $mbConfig): void {
     // where are the packages located?
-    $parameters->set(Option::PACKAGE_DIRECTORIES, [
+    $mbConfig->packageDirectories([
         // default value
         __DIR__ . '/packages',
         // custom
@@ -67,12 +63,12 @@ return static function (ContainerConfigurator $containerConfigurator): void {
     ]);
 
     // how skip packages in loaded direectories?
-    $parameters->set(Option::PACKAGE_DIRECTORIES_EXCLUDES, [__DIR__ . '/packages/secret-package']);
+    $mbConfig->packageDirectoriesExcludes([__DIR__ . '/packages/secret-package']);
 
     // "merge" command related
 
     // what extra parts to add after merge?
-    $parameters->set(Option::DATA_TO_APPEND, [
+    $mbConfig->dataToAppend([
         ComposerJsonSection::AUTOLOAD_DEV => [
             'psr-4' => [
                 'Symplify\Tests\\' => 'tests',
@@ -83,7 +79,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
         ],
     ]);
 
-    $parameters->set(Option::DATA_TO_REMOVE, [
+    $mbConfig->dataToRemove([
         ComposerJsonSection::REQUIRE => [
             // the line is removed by key, so version is irrelevant, thus *
             'phpunit/phpunit' => '*',


Test patch:
diff --git a/packages/monorepo-builder/packages-tests/Merge/ComposerJsonDecorator/AppenderComposerJsonDecorator/Source/appending_config.php b/packages/monorepo-builder/packages-tests/Merge/ComposerJsonDecorator/AppenderComposerJsonDecorator/Source/appending_config.php
index 339f264a9..271498a0b 100644
--- a/packages/monorepo-builder/packages-tests/Merge/ComposerJsonDecorator/AppenderComposerJsonDecorator/Source/appending_config.php
+++ b/packages/monorepo-builder/packages-tests/Merge/ComposerJsonDecorator/AppenderComposerJsonDecorator/Source/appending_config.php
@@ -4,12 +4,11 @@ declare(strict_types=1);
 
 use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
 use Symplify\MonorepoBuilder\ComposerJsonManipulator\ValueObject\ComposerJsonSection;
+use Symplify\MonorepoBuilder\Config\MBConfig;
 use Symplify\MonorepoBuilder\ValueObject\Option;
 
-return static function (ContainerConfigurator $containerConfigurator): void {
-    $parameters = $containerConfigurator->parameters();
-
-    $parameters->set(Option::DATA_TO_APPEND, [
+return static function (MBConfig $mbConfig): void {
+    $mbConfig->dataToAppend([
         ComposerJsonSection::REQUIRE_DEV => [
             'phpstan/phpstan' => '^0.9',
             'tracy/tracy' => '^2.4',