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

remove else and parenthesis unneeded#2884

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

Closed
cordoval wants to merge1 commit intosymfony:masterfromcordoval:patch-16

Conversation

@cordoval
Copy link
Contributor

No description provided.

@wouterj
Copy link
Member

👎 imo having the else makes the code easier to understand and read

@cordoval
Copy link
ContributorAuthor

ok you advocate bad practices?:rage4:

@wouterj
Copy link
Member

no, I give my opinion based on my preferences.

@cordoval
Copy link
ContributorAuthor

granted, but i still think is simpler to read this way, cleaner and less lines, and advocate a good practice

@xabbuh
Copy link
Member

When talking about cleaner ways, I'd prefer just onereturn statement like this:

if (...) {$response =...;}else {$response =...;}return$response;

@stof
Copy link
Member

stof commentedAug 9, 2013

The Symfony codebase is using early returns withoutelse. So this PR is making it consistent with the code

@wouterj
Copy link
Member

ok, 👍 then :)

@xabbuh
Copy link
Member

Thanks for the clarification,@stof. Is it documented anywhere? I didn't find it in the CS and the first example inhttp://symfony.com/doc/current/contributing/code/standards.html doesn't follow this way.

@stof
Copy link
Member

stof commentedAug 9, 2013

I don't think it is written in the doc, but it is applied when reviewing code (it may be worth adding it in the doc)

@xabbuh
Copy link
Member

At least we should change the example to be consistent which what is actually the "standard" being used.

@xabbuh
Copy link
Member

if ('string' ===$dummy) {if ('values' ===$mergedOptions['some_default']) {returnsubstr($dummy,0,5);    }returnucwords($dummy);}else {thrownew \RuntimeException(sprintf('Unrecognized dummy option "%s"',$dummy));}

This would match the standard?

Or should we use the same style to throw exceptions? Like this:

if ('string' ===$dummy) {if ('values' ===$mergedOptions['some_default']) {returnsubstr($dummy,0,5);    }returnucwords($dummy);}thrownew \RuntimeException(sprintf('Unrecognized dummy option "%s"',$dummy));

@cordoval
Copy link
ContributorAuthor

👍 ready to merge then 🔨

@cordoval
Copy link
ContributorAuthor

i guess this is not that important, closing@weaverryan

@wouterj
Copy link
Member

I is important, code in the doc should follow symfony standards.

@wouterjwouterj reopened thisAug 25, 2013
@cordoval
Copy link
ContributorAuthor

yes but this is a change, don't want to change the whole documentation examples, so it should be a simple merge right?

@wouterj
Copy link
Member

Yes, it's a simple merge

@weaverryan
Copy link
Member

Hey Luis!

I've patched this into the 2.2 branch at sha:e4ecb50. Thanks for this change and for the good conversation around this - the coding standards will be clearer after#2886.

Thanks!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@cordoval@wouterj@xabbuh@stof@weaverryan

[8]ページ先頭

©2009-2025 Movatter.jp