8000 Fix misleading TokenInterface docblock 2.3 by giosh94mhz · Pull Request #12597 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Fix misleading TokenInterface docblock 2.3 #12597

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

Conversation

giosh94mhz
Copy link
Contributor
Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

I've found the docblock for TokenInterface::getUser misleading. By reading it I've written something like:

$username = (string) $token->getUser();

This actually doesn't work, since UserInterface doesn't implements __toString and I have some instance of AdvancedUser (coming from InMemory provider).

If the token always return a UserInterface or string, then my fix is ok.

[fix my PR #12596]

* @return mixed either returns an object which implements __toString(), or
* a primitive string is returned.
* @return mixed either returns an object which implements Symfony\Component\Security\Core\User\UserInterface,
* or a primitive string is returned.
Copy link
Contributor

Choose a reason for hiding this comment

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

"or a primitive string." would be enough as the verb is already earlier in the sentence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I'll fix it.

@giosh94mhz giosh94mhz force-pushed the misleading_token_interface_docblock_23 branch from 066f9aa to f2e0c53 Compare December 1, 2014 09:21
@giosh94mhz giosh94mhz force-pushed the misleading_token_interface_docblock_23 branch from f2e0c53 to 9783f1b Compare December 1, 2014 09:24
@fabpot fabpot added the Security label Jan 2, 2015
@@ -47,8 +47,8 @@ public function getCredentials();
/**
* Returns a user representation.
*
* @return mixed either returns an object which implements __toString(), or
* a primitive string is returned.
* @return mixed Either returns an object which implements Symfony\Component\Security\Core\User\UserInterface,
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 keep the "object which implements __toString()" as well.

@fabpot
Copy link
Member
fabpot commented Jan 3, 2015

Closing in favor of #13211

This PR was merged into the 2.3 branch.

Discussion
----------

[Security] fixed wrong phpdoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12597
| License       | MIT
| Doc PR        | n/a

Commits
-------

064062d [Security] fixed wrong phpdoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0