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

Generic/IncrementDecrementSpacing: handle (yet) more situations #133

Open
1 task
jrfnl opened this issue Dec 5, 2023 · 0 comments
Open
1 task

Generic/IncrementDecrementSpacing: handle (yet) more situations #133

jrfnl opened this issue Dec 5, 2023 · 0 comments

Comments

@jrfnl
Copy link
Member

jrfnl commented Dec 5, 2023

Is your feature request related to a problem?

Quoting from a discussion in squizlabs/PHP_CodeSniffer#3626:

For pre-increment, I can think of a further/future iteration for the sniff - checking whether a pre-increment is used on a static property with a fully qualified classname or namespace relative classname, but that is something I choose not to handle (yet) when I made this change last year. When that change would be added, then, yes, extra tests would be needed for pre-in/decrement.

++\ClassName::$prop;
++Relative\ClassName::$prop;
--namespace\Relative\ClassName::$prop;

The reason I did not make that change (yet) is that this would need a different patch for PHPCS 3.x vs PHPCS 4.x, which would make the merge more complex. Also see squizlabs/PHP_CodeSniffer#3041.

Describe the solution you'd like

Valid (correct spacing):

++\ClassName::$prop;
++Relative\ClassName::$prop;
--namespace\Relative\ClassName::$prop;

Invalid (too much space):

++ \ClassName::$prop;
++    Relative\ClassName::$prop;
-- /*comment*/ namespace\Relative\ClassName::$prop;

Additional context (optional)

Follow up on #46

  • I intend to create a pull request to implement this feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant