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

[Security] add union types#41911

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
nicolas-grekas merged 1 commit intosymfony:6.0fromnicolas-grekas:unions-sec
Jul 1, 2021

Conversation

@nicolas-grekas
Copy link
Member

QA
Branch?6.0
Bug fix?no
New feature?no
Deprecations?no
TicketsPart of#41424
LicenseMIT
Doc PR-

* @paramstring|null$originatedFromUri The URI where was the user at the switch
* @param $user The username (like a nickname, email address, etc.), or a UserInterface instance or an object implementing a __toString method
* @param $credentials This usually is the password of the user
* @param $originatedFromUri The URI where was the user at the switch
Copy link
Member

Choose a reason for hiding this comment

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

Is it valid to omit the type?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

for phpstorm at least it is

Copy link
Member

Choose a reason for hiding this comment

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

https://docs.phpdoc.org/3.0/guide/references/phpdoc/tags/param.html

@param [<Type>] [name] [<description>]

[…]

When provided it MAY contain a Type to indicate what is expected.

Yes, the type is optional. But I had to look it up myself as well and I'm not yet sure if I like that notation. Maybe we just need to get used to it. 🤔

Copy link
Member

Choose a reason for hiding this comment

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

If popular IDEs support it, I'm fine with it personally.

Choose a reason for hiding this comment

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

Once you start using PHP attributes for everything ... you want to use it even to describe arguments. I wish this worked:

#[Param('user','The username (like a nickname, email address, etc.), or a ...')]#[Param('credentials','This usually is the password of the user')]#[Param('originatedFromUri','The URI where was the user at the switch')]publicfunction__construct(string|\Stringable|UserInterface$user,mixed$credentials,/* ... */,string$originatedFromUri =null){// ...}

Or even better, this:

publicfunction__construct(    #[Param('The username (like a nickname, email address, etc.), or a ...')]privatestring|\Stringable|UserInterface$user,    #[Param('This usually is the password of the user')]privatemixed$credentials,// ...    #[Param('The URI where was the user at the switch')]privatestring$originatedFromUri =null){}

But support for attributes in PhpDocumentor doesn't seem a priority:phpDocumentor/Reflection#185

@nicolas-grekasnicolas-grekasforce-pushed theunions-sec branch 4 times, most recently fromc180104 to2b46e64CompareJune 30, 2021 16:21
@nicolas-grekas
Copy link
MemberAuthor

Comments addressed, thanks@wouterj

@nicolas-grekasnicolas-grekas merged commitfd0566c intosymfony:6.0Jul 1, 2021
@nicolas-grekasnicolas-grekas deleted the unions-sec branchJuly 1, 2021 08:37
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@wouterjwouterjwouterj left review comments

@derrabusderrabusderrabus left review comments

@chalasrchalasrchalasr left review comments

Assignees

No one assigned

Projects

None yet

Milestone

6.0

Development

Successfully merging this pull request may close these issues.

6 participants

@nicolas-grekas@javiereguiluz@wouterj@derrabus@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp