Skip to content

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

Closed
@jrfnl

Description

@jrfnl

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions