Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DI][FrameworkBundle] Hide service ids that start with a dot#26921

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromnicolas-grekas:container.hidden
Apr 20, 2018

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedApr 13, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets#26630
LicenseMIT
Doc PR-

Now that services are private by default,debug:container should display them by default.
In fact, the public/private concept should not trigger a difference in visibility for this command.

Instead, I propose to handle service ids that start with a dot as hidden services.

PR should be ready.

(For reference, I tried using a tag instead in#26891, but that doesn't work in practice when working on the implementation.)

linaori reacted with thumbs up emojigyKa reacted with thumbs down emoji
@nicolas-grekas
Copy link
MemberAuthor

ping @symfony/deciders this would be great in 4.1, the current state is clumsy.

@lyrixx
Copy link
Member

I like the idea.

But Why did you choose a dot? I think it would be better to choose an underscore even if the meaning of a name starting with a dot in the unix FS is to hide it.

The underscore is already used in the framework (or other lib) to mean "it's internal / private". I'm thinking to_locale,_format,_controller in the routing Component,_fragment in the HttpKernel,_profiler in the DebugBundle,_default in the DIC, and many more,

@nicolas-grekas
Copy link
MemberAuthor

Good question :)
The reason is that an underscored service name cannot be loaded by the YamlFileLoader as they are forbidden. But we have tests that dump + reload configuration to ensure this is allowed. Dumping works, but not loading, for this reason.
So then, if underscore is not allowed, it must be a dot :)

lyrixx reacted with thumbs up emoji

@sroze
Copy link
Contributor

sroze commentedApr 20, 2018
edited
Loading

I really like the idea as well. And tbh, hiding things that started with. is not a new idea so it's a nice choice.

The result of thedebug:container command is going to be different though, as it will now include the private services. Do we consider this as a BC-break? 🙊

@nicolas-grekas
Copy link
MemberAuthor

nicolas-grekas commentedApr 20, 2018
edited
Loading

Do we consider this as a BC-break?

If we were to answer yes to this question, we couldn't do any improvement to any command we publish. The answer must be no.

sroze, lyrixx, and teohhanhui reacted with thumbs up emoji

@lyrixx
Copy link
Member

So then, if underscore is not allowed, it must be a dot :)

okay, go for it ;)

$definition =$this->resolveServiceDefinition($builder,$serviceId);

if (!$definitioninstanceof Definition || !$showPrivate && !$definition->isPublic()) {
if ($showHiddenxor'.' ===$serviceId[0] ??null) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we use parentheses here? At least I have no idea by reading the code whetherxor takes precedence over?? or vice versa.

Copy link
Member

Choose a reason for hiding this comment

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

Is this actually what we want at all? Won't we skip non hidden service now if$showHidden istrue?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

parentheses added

Copy link
Member

Choose a reason for hiding this comment

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

Can we do that in the other files too that use the same condition? :)

Copy link
Member

Choose a reason for hiding this comment

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

never mind, I was looking at an outdated diff

@nicolas-grekas
Copy link
MemberAuthor

Won't we skip non hidden service now if $showHidden is true?

That's correct: by default, you get non-hidden services, and if you add--show-hidden, you get only non-hidden ones. Much more useful IMHO.

using the <info>--show-private</info> flag:
<info>php %command.full_name% --show-private</info>
Copy link
Member

Choose a reason for hiding this comment

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

You should add some docs about the new flag.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

added

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commitcea051e intosymfony:masterApr 20, 2018
fabpot added a commit that referenced this pull requestApr 20, 2018
… a dot (nicolas-grekas)This PR was merged into the 4.1-dev branch.Discussion----------[DI][FrameworkBundle] Hide service ids that start with a dot| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |#26630| License       | MIT| Doc PR        | -Now that services are private by default, `debug:container` should display them by default.In fact, the public/private concept should not trigger a difference in visibility for this command.Instead, I propose to handle service ids that start with a dot as hidden services.PR should be ready.(For reference, I tried using a tag instead in#26891, but that doesn't work in practice when working on the implementation.)Commits-------cea051e [DI][FrameworkBundle] Hide service ids that start with a dot
@nicolas-grekasnicolas-grekas deleted the container.hidden branchApril 25, 2018 16:41
nicolas-grekas added a commit that referenced this pull requestMay 4, 2018
…as-grekas)This PR was merged into the 4.1-dev branch.Discussion----------[FrameworkBundle] Hide some lock-related services| Q             | A| ------------- | ---| Branch?       | 4.1| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -I don't know why, but I missed these in#26921Commits-------d06d8b2 [FrameworkBundle] Hide some lock-related services
@fabpotfabpot mentioned this pull requestMay 7, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@xabbuhxabbuhxabbuh approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

6 participants

@nicolas-grekas@lyrixx@sroze@fabpot@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp