8000 [Security] Missing return type in "UserInterface" by turneliusz · Pull Request #13146 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] Missing return type in "UserInterface" #13146

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

Closed
wants to merge 1 commit into from

Conversation

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

@@ -47,7 +47,7 @@
* and populated in any number of different ways when the user object
* is created.
*
* @return Role[] The user roles
* @return Role[]|string[] The user roles
Copy link
Member

Choose a reason for hiding this comment

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

It can be an array containing Role instances and/or strings. Not sure how to express that in a phpdoc.

Copy link
Author

Choose a reason for hiding this comment

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

I think specifying it that way (as above), that it could be or array<Role> or array<string> but not mixed is enough, IDE's are fine with it.

Copy link
Contributor

Choose a reason for hiding this comment

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

PSR-5: (Role|string)[], but I think it's not well supported yet by IDEs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yuck, that's ugly.

Even if PSR-5 is not an accepted standard yet, some tools are implementing it already: phpDocumentor/phpDocumentor#607 (most likely because the author is involved in PSR-5 ;) ).

Copy link
Author

Choose a reason for hiding this comment

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

First of all it's not ugly and it's well supported for years by IDE (which opens my eyes on fact how stupid it is to create new format...). Second, that (|)[] PSR format doesn't fit at all as it's described as "specified as containing multiple types" because that specific return cannot/shouldn't contain mixed strings and objects in one array as it would create a mess. My change represents and documents 2 completely different outputs. That's my IMHO guys.

Copy link
Member

Choose a reason for hiding this comment

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

@turneliusz the current code supports returning a mix of strings and RoleInterface instances. This is precisely why @fabpot said that your proposal does not describe the code expectations

Copy link
Author

Choose a reason for hiding this comment

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

@stof I've misunderstood it then; for me personally it's quite a mess when any function does that. But if that's status quo there is no discussion. I think we can give PSR way a try.

Copy link
Contributor

Choose a reason for hiding this comment

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

@turneliusz I was referring to what PSR-5 proposes as ugly. In general, I agree we shouldn't mix types in a returned array. In this specific case, we can't change the return type, but we need to update the docblock.

Copy link
Member

Choose a reason for hiding this comment

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

@turneliusz Can you use the PSR-5 notation as it best describes the possible returned values?

Copy link
Member

Choose a reason for hiding this comment

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

@turneliusz Can you make the update?

@fabpot fabpot added the Security label Jan 2, 2015
@fabpot fabpot closed this Feb 5, 2015
fabpot added a commit that referenced this pull request Jan 25, 2016
This PR was merged into the 2.3 branch.

Discussion
----------

Fixed the phpDoc of UserInterface

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

#13037 is the original issue ... which was tried to be fixed in #13146 ... which was closed without merging it.

Commits
-------

8e2a33e Fixed the phpDoc of UserInterface
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.

5 participants
0