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

Docs: Readability issue when passing constructor args #170

Closed
beganovich opened this issue Nov 30, 2024 · 4 comments · Fixed by #171
Closed

Docs: Readability issue when passing constructor args #170

beganovich opened this issue Nov 30, 2024 · 4 comments · Fixed by #171

Comments

@beganovich
Copy link
Contributor

beganovich commented Nov 30, 2024

Refers to documentation for creating custom client when using compatible S3 storage.

Link: https://github.com/thephpleague/flysystem-bundle/blob/3.x/docs/2-cloud-storage-providers.md#digitalocean-spaces

I think it's very easy to overlook the fact you have to pass two blank spaces in order for YAML parser to read this correctly.

arguments:
     -  endpoint: '%env(DIGITALOCEAN_SPACES_ENDPOINT)%'

Proposed solutions.

1:

arguments:
     -
         endpoint: '%env(DIGITALOCEAN_SPACES_ENDPOINT)%'

2:

arguments:
     $configuration:
         endpoint: '%env(DIGITALOCEAN_SPACES_ENDPOINT)%'

3:

arguments:
     - { endpoint: '%env(DIGITALOCEAN_SPACES_ENDPOINT)%' }

Number two is used by some popular packages, such as HWIOAuthBundle (https://github.com/hwi/HWIOAuthBundle/blob/master/docs/3-configuring_the_security_layer.md#a-have-a-user-provider-that-implements-oauthawareuserproviderinterface)

I can send relevant PRs if you agree this is useful.

@maxhelias
Copy link
Collaborator

Hi!
I tend to agree, but unlike HWIOAuthBundle, the S3Client class is not in our package. At first glance, $configuration shouldn't change, but the binding on it can create a BC in documentation at any time (this is the only issue with solution 2).
In this context, solution 3 seems more appropriate WDYT ?

@maxhelias
Copy link
Collaborator

I have mixed feelings, solution 3 is good when you only have one line as an option. But 1 seems fine to me when there are several lines. And this is what Symfony's documentation seems to promote

@beganovich
Copy link
Contributor Author

Agree on solution 2, definitely my least favourite one since it depends on named argument. Your call on 1 or 3. If 1 is what Symfony docs follow, I'd happily send PR following style no 1.

Any of those 3 are more obvious than the current one, IMHO.

@maxhelias
Copy link
Collaborator

Let's go for solution 1 then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants