Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public function refactor(Node $node): ?Node
return $this->changeArgumentsOrder($node);
}

/**
* @template TCall of MethodCall|StaticCall
* @param TCall $node
* @return TCall|null
*/
private function changeArgumentsOrder(MethodCall|StaticCall $node): MethodCall|StaticCall|null
{
$oldArguments = $node->getArgs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ public function refactor(Node $node): ?Node
return null;
}

/**
* @template TCall of StaticCall|MethodCall
* @param TCall $call
* @return TCall|null
*/
private function refactorNew(New_ $new, StaticCall|MethodCall $call): null|MethodCall|StaticCall
{
if (! $this->isName($new->class, 'PHPUnit\Framework\MockObject\Stub\ReturnValueMap')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ public function refactor(Node $node): ?Node
return null;
}

/**
* @template TCall of StaticCall|MethodCall
* @param TCall $call
* @return ($call is MethodCall ? MethodCall : StaticCall)
*/
private function createFirstArgExtraMethodCall(StaticCall|MethodCall $call): MethodCall|StaticCall
{
/** @var Identifier $identifierNode */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ public function refactor(Node $node): ?Node
return $this->processAssertEqualsWithDelta($node);
}

/**
* @template TCall of MethodCall|StaticCall
* @param TCall $call
* @return ($call is MethodCall ? MethodCall : StaticCall)|null
*/
private function processAssertEqualsIgnoringCase(MethodCall|StaticCall $call): StaticCall|MethodCall|null
{
$args = $call->getArgs();
Expand All @@ -149,6 +154,11 @@ private function processAssertEqualsIgnoringCase(MethodCall|StaticCall $call): S
return $newMethodCall;
}

/**
* @template TCall of MethodCall|StaticCall
* @param TCall $call
* @return ($call is MethodCall ? MethodCall : StaticCall)|null
*/
private function processAssertEqualsCanonicalizing(MethodCall|StaticCall $call): MethodCall|StaticCall|null
{
$args = $call->getArgs();
Expand Down Expand Up @@ -176,6 +186,11 @@ private function processAssertEqualsCanonicalizing(MethodCall|StaticCall $call):
return $newMethodCall;
}

/**
* @template TCall of MethodCall|StaticCall
* @param TCall $call
* @return ($call is MethodCall ? MethodCall : StaticCall)|null
*/
private function processAssertEqualsWithDelta(MethodCall|StaticCall $call): MethodCall|StaticCall|null
{
$args = $call->getArgs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ public function refactor(Node $node): null|MethodCall|StaticCall
return null;
}

/**
* @template TCall of MethodCall|StaticCall
* @param TCall $node
* @return ($node is MethodCall ? MethodCall : StaticCall)|null
*/
private function replaceExceptionWith(
MethodCall|StaticCall $node,
string $exceptionClass,
Expand Down
5 changes: 5 additions & 0 deletions src/NodeFactory/AssertCallFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

final class AssertCallFactory
{
/**
* @template TCall of StaticCall|MethodCall
* @param TCall $node
* @return ($node is MethodCall ? MethodCall : StaticCall)
*/
public function createCallWithName(StaticCall|MethodCall $node, string $name): StaticCall|MethodCall
{
if ($node instanceof MethodCall) {
Expand Down
Loading