Skip to content

Commit 5c341c9

Browse files
Declare array shapes on positional tuple returns (#805)
Co-authored-by: Tomas Votruba <tomas@getrector.org>
1 parent cde0feb commit 5c341c9

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎rules/CodeQuality/NodeFactory/AssertArrayHasKeyCallFactory.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private function isInsideTestCase(Scope $scope): bool
4444
}
4545

4646
/**
47-
* @return Arg[]
47+
* @return array{Arg, Arg, Arg}
4848
*/
4949
private function createArgs(Variable $dimFetchVariable, Expr $dimExpr): array
5050
{

‎rules/CodeQuality/Rector/MethodCall/AssertComparisonToSpecificMethodRector.php‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ public function refactor(Node $node): ?Node
102102
return $this->processCallWithBinaryOp($node, $firstArgumentValue);
103103
}
104104

105-
private function processCallWithBinaryOp(MethodCall|StaticCall $node, BinaryOp $binaryOp): ?Node
105+
/**
106+
* @template TNode of MethodCall|StaticCall
107+
* @param TNode $node
108+
* @return TNode|null
109+
*/
110+
private function processCallWithBinaryOp(MethodCall|StaticCall $node, BinaryOp $binaryOp): MethodCall|StaticCall|null
106111
{
107112
$binaryOpClass = $binaryOp::class;
108113

‎rules/CodeQuality/Rector/MethodCall/AssertIssetToSpecificMethodRector.php‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ public function refactor(Node $node): ?Node
109109
return $this->refactorArrayDimFetchNode($node, $issetExpr);
110110
}
111111

112-
private function refactorArrayDimFetchNode(MethodCall|StaticCall $node, ArrayDimFetch $arrayDimFetch): Node
112+
/**
113+
* @template TNode of MethodCall|StaticCall
114+
* @param TNode $node
115+
* @return TNode
116+
*/
117+
private function refactorArrayDimFetchNode(MethodCall|StaticCall $node, ArrayDimFetch $arrayDimFetch): MethodCall|StaticCall
113118
{
114119
$this->identifierManipulator->renameNodeWithMap($node, [
115120
AssertMethod::ASSERT_TRUE => 'assertArrayHasKey',

‎rules/PHPUnit100/Rector/StmtsAwareInterface/WithConsecutiveRector.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public function refactor(Node $node): null|array|Expression
228228
}
229229

230230
/**
231-
* @return Stmt[]
231+
* @return array{Expression, Expression}
232232
*/
233233
private function refactorToWillReturnCallback(
234234
MethodCall $withConsecutiveMethodCall,

0 commit comments

Comments
 (0)