-
Notifications
You must be signed in to change notification settings - Fork 56
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
Adopt PSR-12 for return types #163
Conversation
[PSR-12](https://www.php-fig.org/psr/psr-12) is an extension of the PSR-2 set of rules that aims to standardize the code style. Doctrine, so far, hasn't adopted 100% off it, and this PR proposes to start to migrate our rules to PSR-12. The first one is the return types. As described under the section [4.5](https://www.php-fig.org/psr/psr-12/#45-method-and-function-arguments), they SHOULD NOT be a blank space between the return type and colon (`:`). For context on why this was voted in the past, see #9.# Please enter the commit message for your changes. Lines starting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record, I don't see the requirement as it's worded in the PR description. What I see is:
Is this what you @carusogabriel are referring to? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The colon and declaration MUST be on the same line as the argument list closing parenthesis with no spaces between the two characters.
Two characters here are colon and closing parenthesis. No space between them.
Checks out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hell yeah!
I've updated the description, thanks for the review everyone! I'll let this PR open for a week so others can vote as well. |
Hi, is Doctrine going to strictly follow PSR12? IMO PSR12 was a nice step forward but is still far behind this CS. As for myself, I preferred space around colon on both sides and that's one of things that I fancied on Doctrine CS. |
Yes, our goal is to follow PSR12 |
Huge 👎 from me as the original author of Doctrine CS. This is one of the advantages of Doctrine CS currently. |
That's is the idea. By the same way we follow PSR-2 I'm proposing to follow PSR-12. My two main cents:
|
I'll add that prolly we'll deviate somewhere from PSR-12 but IMO the colon thing is not worth deviating |
For people that want to keep the space, you can always enforce that rule in your own standard. Doctrine CS is meant to be a strict set of rules based on PSR, and we encourage people to adjust and remove rules they don't agree with, or add their own rules for added checks. |
Thanks @carusogabriel ! |
Thanks @carusogabriel! |
Although I personally like the enforced whitespace more, I voted yes because I believe that standardization is more important than the personal taste. Furthermore, the latter will adapt very soon. |
Yeah I hated PSR-2 for the first 2 hours I used it. Once past that point, it's been a pleasure. |
Yeah, nice job |
PSR-12 is an extension of the PSR-2 set of rules
that aims to standardize the code style.
Doctrine, so far, hasn't adopted 100% off it, and this PR proposes to start to migrate our rules
to PSR-12.
The first one is the
return types
. As described under the section 4.5,where the two characters are the closing parenthesis
)
and colon:
.For context on why this was voted in the past, see #9.