-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Tap fluent chainable #53753
base: 11.x
Are you sure you want to change the base?
Tap fluent chainable #53753
Conversation
Since arrow functions need to return something but unset() is a keyword that returns void and not a function
Since tap tries to call the methods technically from outside
fyi: The two remaining failed tests failed without a conclusive error message |
The tests are failing due to a segmentation fault. This is not easy to debug but could be due to performance or failure but PHPUnit are no longer able to handle printing the correct output due to the complexity of new code. Converted to draft since tests are failing. |
Reducing the number of lines does not make code better. I find this more complex to read than before. Changes like these also make it harder for newcomers to contribute. Not to mention the (albeit minor) impact on performance. |
I love But |
This really adds no value. |
Refactor chainable/fluent class methods to use
tap()
where possibleThis doesn't require new tests as the existing tests not failing should prove that there are no side-effects outside of the changed methods
Rules
return $this
and one additional line will be reduced to a one-liner (since additional lines could not be transformed into an arrow function. Using normal functions would nullify the line reduction benefit. Only using the last line before thereturn $this
would look inconsistent)return $this
in a method is a method call on$this
, the higher-order tap is used instead