Skip to content

Commit 4405700

Browse files
authored
fix: correct parts.unshift() to parts.shift() in isSimpleCallArgument (#2461)
1 parent e2e73e6 commit 4405700

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/util.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ function isSimpleCallArgument(node, depth = 2) {
678678

679679
if (isCallLikeExpression(node)) {
680680
const parts = getChainParts(node);
681-
parts.unshift();
681+
parts.shift();
682682

683683
return (
684684
parts.length <= depth &&

tests/call/__snapshots__/jsfmt.spec.mjs.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ $callable = $item->doSomething(...);
356356
$callable = $item::doSomething(...);
357357
$callable = Foo::doSomething(...);
358358
359+
$this->method1()->method2()->method3(foo()->bar());
360+
359361
=====================================output=====================================
360362
<?php
361363
func();
@@ -760,5 +762,7 @@ $callable = $item->doSomething(...);
760762
$callable = $item::doSomething(...);
761763
$callable = Foo::doSomething(...);
762764
765+
$this->method1()->method2()->method3(foo()->bar());
766+
763767
================================================================================
764768
`;

tests/call/call.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,3 +347,5 @@ public function setFoo($foo)
347347
$callable = $item->doSomething(...);
348348
$callable = $item::doSomething(...);
349349
$callable = Foo::doSomething(...);
350+
351+
$this->method1()->method2()->method3(foo()->bar());

0 commit comments

Comments
 (0)