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
binary_operator_spaces doesn't work in function #5667
Comments
I don't see how the second example is a bug? The |
But why fixer aligns it randomly? If its out of him scope. |
Oh, you didn't post the before file? I assumed the report was that it wasn't changing the arrows? |
I stumbled upon the same issue. Hoping it was fixed in V3, but unfortunately it is not. Rule: 'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [
'=>' => 'align_single_space_minimal',
],
], Before: public function share(Request $request): array
{
return array_merge(parent::share($request), [
'flashNotifications' => fn () => Session::get('flash_notification'),
'currentUser' => fn () => $this->getCurrentUser($request->user()),
'menuItems' => fn () => $this->getMenuItems($request->user()),
]);
} After: public function share(Request $request): array
{
return array_merge(parent::share($request), [
'flashNotifications' => fn () => Session::get('flash_notification'),
'currentUser' => fn () => $this->getCurrentUser($request->user()),
'menuItems' => fn () => $this->getMenuItems($request->user()),
]);
} Expectation: public function share(Request $request): array
{
return array_merge(parent::share($request), [
'flashNotifications' => fn () => Session::get('flash_notification'),
'currentUser' => fn () => $this->getCurrentUser($request->user()),
'menuItems' => fn () => $this->getMenuItems($request->user()),
]);
} |
I think it will be fixed by #6112 |
…f methods (VincentLanglet) This PR was squashed before being merged into the master branch (closes #6112). Discussion ---------- [BinaryOperatorSpacesFixer] Fix align of `=` inside calls of methods Hi. I found a bug when using align/align_with_space_minimal for `=`. Before, any time a `(` was found, the check was skipped until the `)`. Now, I do this only for `(` for function definition and for/foreach/if/while/... So ``` $this->foo(function () { $a = 1; $aa = 2; }) ``` aligns the `=`. It fix my personal issue (I added a test), and I think it will fix the issue #5667 Commits ------- f7750fd [BinaryOperatorSpacesFixer] Fix align of `=` inside calls of methods
thanks for reporting, needed additional fixing, please see #6334 |
I have a similar issue, not sure if it fits here or should be a new issue. During upgrading of PHP-CS-Fixer (see littleredbutton/bigbluebutton-api-php#130) I changed the config from: 'binary_operator_spaces' => [
'align_double_arrow' => true,
'align_equals' => true,
] to: 'binary_operator_spaces' => ['operators' => ['=' => 'align', '=>' => 'align']] As a result the expression inside the function argument is changed. Before $hooksCreateParameters->setMeetingId($meetingId = $this->faker->uuid);
$hooksCreateParameters->setGetRaw($getRaw = $this->faker->boolean); After $hooksCreateParameters->setMeetingId($meetingId = $this->faker->uuid);
$hooksCreateParameters->setGetRaw($getRaw = $this->faker->boolean); Expected $hooksCreateParameters->setMeetingId($meetingId = $this->faker->uuid);
$hooksCreateParameters->setGetRaw($getRaw = $this->faker->boolean); |
Bug report
-vvv
)'binary_operator_spaces' => [
'operators' => [
'+=' => 'align_single_space_minimal',
'=' => 'align_single_space_minimal',
'=>' => 'align_single_space_minimal'
],
],
Code snippet that reproduces the problem
Also another type of issue with arrow functions
The text was updated successfully, but these errors were encountered: