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

Add missing space in example for anonymous class declaration #90

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

rikvdh
Copy link
Contributor

@rikvdh rikvdh commented Jul 21, 2024

According to the specification:

Anonymous Classes MUST follow the same guidelines and principles as closures in the above section.

Therefore a space must be between the class keyword and the opening parenthesis, as with closures.

@rikvdh rikvdh changed the title Add missing space for class declaration Add missing space in example for anonymous class declaration Jul 21, 2024
@samdark samdark requested a review from Crell July 23, 2024 06:24
@samdark
Copy link
Member

samdark commented Jul 23, 2024

Good catch, but I think the text should be fixed and not the example.

@jrfnl
Copy link
Contributor

jrfnl commented Jul 23, 2024

Good catch, but I think the text should be fixed and not the example.

Shouldn't the example be fixed for the current version of PER ? Only for the text (and example) to be changed/fixed in the next version of PER ?

@jrfnl
Copy link
Contributor

jrfnl commented Jul 23, 2024

As a side-note: coding standards should be about consistency, "fixing" the text to make the spacing requirements for closures and anonymous classes different makes things _in_consistent.

@Crell
Copy link
Collaborator

Crell commented Jul 23, 2024

@jrfnl Off hand, do you know what CS and CSFixer do here? Do they follow the text or the example?

@jrfnl
Copy link
Contributor

jrfnl commented Jul 23, 2024

@jrfnl Off hand, do you know what CS and CSFixer do here? Do they follow the text or the example?

I can't speak for CS-Fixer, but PHPCS follows the text of the PSR to the letter and only falls back to the examples when the text is unclear or states "as per the example ...".

For this particular case, I just happen to know that both PHPCS as well as CS-Fixer enforce one space. See squizlabs/PHP_CodeSniffer#3200 for a previous discussion about this (and confirmation).

@Crell
Copy link
Collaborator

Crell commented Jul 23, 2024

Then let's go ahead and fix the example to match the text, since that's how everyone else is interpreting it. If we wanted to change that, it would be a separate discussion for a later release.

I'll leave this open for a day or so in case someone else from the working group wants to weigh in, then merge it if no one makes a compelling argument.

@Crell Crell merged commit 58a17b4 into php-fig:master Jul 25, 2024
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

Successfully merging this pull request may close these issues.

4 participants