Skip to content
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

Keep / Convert Yaml comments to PHP #1

Open
alexander-schranz opened this issue Aug 13, 2022 · 1 comment
Open

Keep / Convert Yaml comments to PHP #1

alexander-schranz opened this issue Aug 13, 2022 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@alexander-schranz
Copy link
Member

alexander-schranz commented Aug 13, 2022

Currently the config-transformer is using the symfony/yaml package. Instead we should use a package which is supporting to read comments from yaml files as they provide many usefull things like links to documentation.

Yaml:

# Read the documentation at https://github.com/thephpleague/flysystem-bundle/blob/master/docs/1-getting-started.md
flysystem:
    storages:
        default.storage:
            adapter: 'local'
            options:
                directory: '%kernel.project_dir%/%VAR_DIR%/storage/default'

Expected PHP Result:

<?php

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
    // Read the documentation at https://github.com/thephpleague/flysystem-bundle/blob/master/docs/1-getting-started.md
    $containerConfigurator->extension('flysystem', [
        'storages' => [
            'default.storage' => [
                'adapter' => 'local',
                'options' => [
                    'directory' => '%kernel.project_dir%/%VAR_DIR%/storage/default',
                ],
            ],
        ],
    ]);  
};

Currently the comment is missing which adds a lot of value.

Related issues:

@alexander-schranz alexander-schranz changed the title Keep comments Keep / Convert Yaml comments to PHP Aug 14, 2022
@alexander-schranz alexander-schranz added this to the 1.0 milestone Aug 14, 2022
@alexander-schranz alexander-schranz added help wanted Extra attention is needed bug Something isn't working labels Aug 14, 2022
@weaverryan
Copy link

I agree that this is important... but does such a YAML library exist? Or would someone need to hack together a script to "find the comments" then try to re-add them to the PHP after the fact?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants