Avoid incompatible sniffs running together
Generic.WhiteSpace.ScopeIndent and PSR2.Methods.FunctionCallSignature both try to fix indentation differently. This results in files not being able to be fixed automatically with phpcbf.
See https://github.com/squizlabs/PHP_CodeSniffer/issues/2078#issuecomment-401641650 where @gsherwood says that Generic.WhiteSpace.ScopeIndent should win in these cases.
This pull request fixes #2078 by eliminating the incompatibility when both sniffs are being run. When Generic.WhiteSpace.ScopeIndent is not active, then PSR2.Methods.FunctionCallSignature will continue to work as normal. When Generic.WhiteSpace.ScopeIndent is active, then this particular code-path will be ignored/skipped.
I haven't tested this enough it seems. I'll mark this as a draft for now.
- Do you have a code sample demonstrating the conflict ?
- Could that code sample be added to the test file ?
- As for referencing another sniff via a hard-coded name to avoid conflicts: that's generally not the way to solve these type of issues.
- Do you have a code sample demonstrating the conflict ?
Yes, see https://github.com/squizlabs/PHP_CodeSniffer/issues/2078#issuecomment-401641650.
- Could that code sample be added to the test file ?
I've been working on this, and it's difficult. I expect to update the pull request with this soon.
- As for referencing another sniff via a hard-coded name to avoid conflicts: that's generally not the way to solve these type of issues.
I agree. Can you suggest a viable alternative in this case?
I'm not winning at adding a test case for this. Please can someone help?