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

[Console] add union types#41912

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-console
Jul 2, 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-

* @return $this
*/
publicfunctionaddArgument(string$name,int$mode =null,string$description ='',$default =null)
publicfunctionaddArgument(string$name,int$mode =null,string$description ='',mixed$default =null)
Copy link
Member

Choose a reason for hiding this comment

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

Was the parameter annotation wrong here?

Suggested change
publicfunction addArgument(string$name,int$mode =null,string$description ='',mixed$default =null)
publicfunction addArgument(string$name,int$mode =null,string$description ='',string|array|null$default =null)

Copy link
MemberAuthor

@nicolas-grekasnicolas-grekasJun 30, 2021
edited
Loading

Choose a reason for hiding this comment

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

Tests fail if we restrict here. We should at least allowint|float|bool. But I don't see the need to restrict when it was allowed before. We should avoid needless BC breaks IMHO.

Copy link
Member

Choose a reason for hiding this comment

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

It does not make much sense to pass a default value that cannot be produced by invoking the command via the console.null would be the only reasonable exception here.

If we don't want to break BC, I'm fine withmixed but please let's keep the more precise type in the doc block then.

Copy link
MemberAuthor

@nicolas-grekasnicolas-grekasJun 30, 2021
edited
Loading

Choose a reason for hiding this comment

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

What would be the point of the annotation? If technically we don't care, we shouldn't bother our users IMHO.
I'm sure there are ppl out there that already found some creative use of that :)

Copy link
Member

Choose a reason for hiding this comment

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

I'm sure there are ppl out there that already found some creative use of that :)

That's precisely what scares me. 🙈

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

We should be proud of what ppl do with Symfony :)

derrabus reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I did somegit blame + some code inspection. We use mixed in many places already. Having this restricted list is both wrong (as proved by tests) and not needed. I confirm this change.

PR ready.

@nicolas-grekasnicolas-grekasforce-pushed theunions-console branch 3 times, most recently fromfde34d8 to0b1d337CompareJune 30, 2021 16:21
* @param string $description A description text
* @param string|string[]|bool|null $default The default value (must be null for self::VALUE_NONE)
* @param $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
* @param $mode The option mode: One of the VALUE_* constants
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC we dont duplicate the type as per CS?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh wait, this is totally fine 👍

When provided it MAY contain a Type to indicate what is expected
https://docs.phpdoc.org/3.0/guide/references/phpdoc/tags/param.html#param

for now 🤦

When provided it MUST contain a "Type" to indicate what is expected
https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc-tags.md#59-param

Copy link
MemberAuthor

@nicolas-grekasnicolas-grekasJul 1, 2021
edited
Loading

Choose a reason for hiding this comment

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

We settled on:

  • PSR19 is not a thing and is outdated anyway, especially considering PHP8
  • phpdoc.org is the most up-to-date specification/authority for annotations.

derrabus reacted with thumbs up emoji
@nicolas-grekasnicolas-grekas merged commitcf76057 intosymfony:6.0Jul 2, 2021
@nicolas-grekasnicolas-grekas deleted the unions-console branchJuly 3, 2021 09:52
@wouterjwouterj mentioned this pull requestJan 3, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@derrabusderrabusderrabus approved these changes

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

+1 more reviewer

@ro0NLro0NLro0NL left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

6.0

Development

Successfully merging this pull request may close these issues.

4 participants

@nicolas-grekas@ro0NL@derrabus@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp