-
Notifications
You must be signed in to change notification settings - Fork 57
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
[WIP] Exclude fluent interfaces from OneObjectOperatorPerLineSniff #43
[WIP] Exclude fluent interfaces from OneObjectOperatorPerLineSniff #43
Conversation
This looks nice and clear. Thank you for the PR! I'm about to add these sniffs to my code: https://github.com/Symplify/Symplify |
I would suggest the following steps:
Not really cool, but as long as PHP_CodeSniffer offers no other possibility to configure rules, we depend on public properties. Next step would be thinking about defaults. The only fluent interfaces I use are the doctrine ones. But I'm sure there are a lot more (thinking e.g. of the Symfony Finder component). |
That's another issue, but I'm aware of it. Actually I'm finishing layer above PHP_CodeSniffer that would allow writing rules in clean way. I like it the way PHP-CS-Fixer solves this via Maybe we could approach this via configuration, to skip this rule for classes of certain name ( |
That sounds good to me. So next steps would be
|
@UFOMelkor I agree, let's do this. Could you prepare PR for that? I'm about to simplify the README text, so normal people could read it with joy and understand it. Thank you so much for your activity. It drives me ahead and motivates to work on this and make it better and better! |
What needs to be done here related to your PR with excludable objects? I took care of the public property issue. |
Merged via 4c0168f, thank you. Feel free to check and test it. |
Todo
Could you take care of this? |
Allows the OneObjectOperatorPerLineSniff ignore fluent interfaces.
Fluent interfaces are recognized by its starting points. A starting point can be either a variable (like
$queryBuilder
) or a method call (likecreateQueryBuilder()
).In both cases the fluent interface might end before the end of the call chain. Therefore end points (like
getQuery()
will let the sniff work normally for the calls that are detected afterwards.There are some things to clarify:
Closes #41