Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

Added a new services.yml file to comply with Symfony Best Practices #727

Closed
wants to merge 3 commits into from
Closed

Added a new services.yml file to comply with Symfony Best Practices #727

wants to merge 3 commits into from

Conversation

javiereguiluz
Copy link
Member

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #725
License MIT
Doc PR -

@stof
Copy link
Member

stof commented Oct 20, 2014

👍

services:
# service_name:
# class: AppBundle\Directory\ClassName
# arguments: [@other_service_name, "plain_value", %parameter_name%]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%parameter_name% must be in quotes to be valid yaml

@javiereguiluz
Copy link
Member Author

@Tobion thanks for reporting this error! You are absolutely right and I've just updated the file.

@Tobion
Copy link
Contributor

Tobion commented Oct 20, 2014

👍

@xabbuh
Copy link
Member

xabbuh commented Oct 20, 2014

You should then also include @other_service_name with double quotes.

@Tobion
Copy link
Contributor

Tobion commented Oct 20, 2014

@xabbuh Why? It's not necessary.

@javiereguiluz
Copy link
Member Author

@Tobion I added the quotes suggested by @xabbuh before reading your comment. Even if they are not mandatory, do you think it would be a good idea to add them for consistency reaons? Or do you think it's better to not include them?

By the way, I switched "other_service_name" by "another_service_name". It sounds better than me, but please tell me what you think. Thanks!

@xabbuh
Copy link
Member

xabbuh commented Oct 20, 2014

@Tobion The @ is reserved in YAML for future uses. Of course, it's not necessary here, to be parsed properly. But that also applies to the percent sign. So, let's be consistent here.

@Tobion
Copy link
Contributor

Tobion commented Oct 20, 2014

Then you would also need to put class: AppBundle\Directory\ClassName in quotes which makes everything harder to read.

@Tobion
Copy link
Contributor

Tobion commented Oct 20, 2014

@xabbuh
Copy link
Member

xabbuh commented Oct 20, 2014

Then you would also need to put class: AppBundle\Directory\ClassName in quotes which makes everything harder to read.

The backslash has no special meaning outside double quoted strings. Even worse, "\D" and "\C" are no valid escape sequences, so the backslash would need to be escaped.

@Tobion
Copy link
Contributor

Tobion commented Oct 20, 2014

I was referring to the "consistency" javier was talking about. "plain_value" vs AppBundle\Directory\ClassName

@xabbuh
Copy link
Member

xabbuh commented Oct 20, 2014

Then I misunderstood you.

@fabpot
Copy link
Member

fabpot commented Oct 21, 2014

Thank you @javiereguiluz.

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

Successfully merging this pull request may close these issues.

5 participants