Skip to content
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

decide about spaces after/before exclamation mark #113

Closed
rdeutz opened this issue Jul 1, 2015 · 11 comments
Closed

decide about spaces after/before exclamation mark #113

rdeutz opened this issue Jul 1, 2015 · 11 comments

Comments

@rdeutz
Copy link
Contributor

rdeutz commented Jul 1, 2015

In this PR https://github.com/joomla/joomla-cms/pull/7292/files#r33676349 the question raised if we should allow or deny a space after a exclamation mark in a condition. There is a longer discussion about this here: https://github.com/php-fig/fig-standards/issues/102 and https://github.com/php-fig/fig-standards/issues/165.

so how should we write it:

a)

    if ( ! condition) 

Space before and after the exclamation mark

or

b)

    if (!condition)

Happy commenting :-)

@zero-24
Copy link
Member

zero-24 commented Jul 1, 2015

Personaly and for me i think: if (!condition) looks cleaner and it is the current standard* that we use in the most CMS Code.

*Ok no official standard but the current used one. 😄

@roland-d
Copy link
Contributor

roland-d commented Jul 1, 2015

I choose b.

@btoplak
Copy link

btoplak commented Jul 1, 2015

I use (b) for years, I don't have problems spotting it, and I'd say it's defacto unwritten PHP standard. And prevails throughout the J! Core code.

As said in the original ticket - if one wants to emphasize the check, use ($var === false) or (false === $var)

So, definitely (b) as a official standard.

@asika32764
Copy link

(b) +1

@dongilbert
Copy link
Contributor

C) if (! $var)

@photodude
Copy link
Contributor

👍 (b)

@virgofx
Copy link

virgofx commented Jul 22, 2015

C) if (! $var)

@asika32764
Copy link

B, C +1

@elkuku
Copy link
Contributor

elkuku commented Jul 22, 2015

C

Simon Asika notifications@github.com schrieb am Mi., 22. Juli 2015 10:09:

B, C +1


Reply to this email directly or view it on GitHub
#113 (comment)
.

@photodude
Copy link
Contributor

There is nothing that I can see in the PSR-2 standard or in the proposed PSR-12 standard in relation to this code style item.

This is one of the many cases where PSR-2 and the future PSR-12 does not cover things we would like to enforce.

@rdeutz
Copy link
Contributor Author

rdeutz commented Jan 8, 2018

seems most people like b, closing it

@rdeutz rdeutz closed this as completed Jan 8, 2018
photodude added a commit to photodude/coding-standards that referenced this issue Jan 8, 2018
wilsonge pushed a commit that referenced this issue Mar 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants