Skip to content

Commit 1a8a657

Browse files
committed
specifiedNullTypes
1 parent a5e4757 commit 1a8a657

17 files changed

+34
-5
lines changed

src/Analyser/Generator/ExprAnalysisResult.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function __construct(
2525
public readonly array $impurePoints,
2626
public readonly SpecifiedTypes $specifiedTruthyTypes,
2727
public readonly SpecifiedTypes $specifiedFalseyTypes,
28+
public readonly SpecifiedTypes $specifiedNullTypes,
2829
?Type $keepVoidType = null,
2930
)
3031
{

src/Analyser/Generator/ExprHandler/ArrowFunctionHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function analyseExpr(
7474
impurePoints: [],
7575
specifiedTruthyTypes: new SpecifiedTypes(),
7676
specifiedFalseyTypes: new SpecifiedTypes(),
77+
specifiedNullTypes: new SpecifiedTypes(),
7778
);
7879
}
7980

@@ -115,6 +116,7 @@ public function processArrowFunctionNode(
115116
impurePoints: $exprResult->impurePoints,
116117
specifiedTruthyTypes: new SpecifiedTypes(),
117118
specifiedFalseyTypes: new SpecifiedTypes(),
119+
specifiedNullTypes: new SpecifiedTypes(),
118120
);
119121
}
120122

src/Analyser/Generator/ExprHandler/AssignHandler.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ static function (GeneratorScope $scope) use ($stmt, $expr, $context, $alternativ
158158
impurePoints: array_merge($impurePoints, $result->impurePoints),
159159
specifiedTruthyTypes: new SpecifiedTypes(),
160160
specifiedFalseyTypes: new SpecifiedTypes(),
161+
specifiedNullTypes: new SpecifiedTypes(),
161162
);
162163
},
163164
true,
@@ -189,6 +190,7 @@ static function (GeneratorScope $scope) use ($stmt, $expr, $context, $alternativ
189190
impurePoints: $result->impurePoints,
190191
specifiedTruthyTypes: new SpecifiedTypes(),
191192
specifiedFalseyTypes: new SpecifiedTypes(),
193+
specifiedNullTypes: new SpecifiedTypes(),
192194
);
193195
}
194196

@@ -332,6 +334,7 @@ public function processAssignVar(
332334
impurePoints: $impurePoints,
333335
specifiedTruthyTypes: new SpecifiedTypes(),
334336
specifiedFalseyTypes: new SpecifiedTypes(),
337+
specifiedNullTypes: new SpecifiedTypes(),
335338
);
336339
} elseif ($var instanceof ArrayDimFetch) {
337340
$dimFetchStack = [];
@@ -544,6 +547,7 @@ public function processAssignVar(
544547
impurePoints: $impurePoints,
545548
specifiedTruthyTypes: new SpecifiedTypes(),
546549
specifiedFalseyTypes: new SpecifiedTypes(),
550+
specifiedNullTypes: new SpecifiedTypes(),
547551
);
548552
} elseif ($var instanceof PropertyFetch) {
549553
$objectResult = yield new ExprAnalysisRequest($stmt, $var->var, $scope, $context, $alternativeNodeCallback);
@@ -661,6 +665,7 @@ public function processAssignVar(
661665
impurePoints: $impurePoints,
662666
specifiedTruthyTypes: new SpecifiedTypes(),
663667
specifiedFalseyTypes: new SpecifiedTypes(),
668+
specifiedNullTypes: new SpecifiedTypes(),
664669
);
665670
} elseif ($var instanceof Expr\StaticPropertyFetch) {
666671
if ($var->class instanceof Node\Name) {
@@ -753,6 +758,7 @@ public function processAssignVar(
753758
impurePoints: $impurePoints,
754759
specifiedTruthyTypes: new SpecifiedTypes(),
755760
specifiedFalseyTypes: new SpecifiedTypes(),
761+
specifiedNullTypes: new SpecifiedTypes(),
756762
);
757763
} elseif ($var instanceof List_) {
758764
$exprGen = $processExprCallback($scope);
@@ -813,6 +819,7 @@ static function (GeneratorScope $scope): Generator {
813819
impurePoints: [],
814820
specifiedTruthyTypes: new SpecifiedTypes(),
815821
specifiedFalseyTypes: new SpecifiedTypes(),
822+
specifiedNullTypes: new SpecifiedTypes(),
816823
);
817824
},
818825
$enterExpressionAssign,
@@ -836,6 +843,7 @@ static function (GeneratorScope $scope): Generator {
836843
impurePoints: $impurePoints,
837844
specifiedTruthyTypes: new SpecifiedTypes(),
838845
specifiedFalseyTypes: new SpecifiedTypes(),
846+
specifiedNullTypes: new SpecifiedTypes(),
839847
);
840848
} elseif ($var instanceof ExistingArrayDimFetch) {
841849
$dimFetchStack = [];
@@ -940,6 +948,7 @@ static function (GeneratorScope $scope): Generator {
940948
impurePoints: $impurePoints,
941949
specifiedTruthyTypes: new SpecifiedTypes(),
942950
specifiedFalseyTypes: new SpecifiedTypes(),
951+
specifiedNullTypes: new SpecifiedTypes(),
943952
);
944953
}
945954

@@ -957,6 +966,7 @@ static function (GeneratorScope $scope): Generator {
957966
impurePoints: $result->impurePoints,
958967
specifiedTruthyTypes: new SpecifiedTypes(),
959968
specifiedFalseyTypes: new SpecifiedTypes(),
969+
specifiedNullTypes: new SpecifiedTypes(),
960970
);
961971
}
962972

src/Analyser/Generator/ExprHandler/BinaryPlusHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, Expre
4747
impurePoints: array_merge($leftResult->impurePoints, $rightResult->impurePoints),
4848
specifiedTruthyTypes: new SpecifiedTypes(),
4949
specifiedFalseyTypes: new SpecifiedTypes(),
50+
specifiedNullTypes: new SpecifiedTypes(),
5051
);
5152
}
5253

src/Analyser/Generator/ExprHandler/CastIntHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function analyseExpr(
4646
impurePoints: [],
4747
specifiedTruthyTypes: new SpecifiedTypes(),
4848
specifiedFalseyTypes: new SpecifiedTypes(),
49+
specifiedNullTypes: new SpecifiedTypes(),
4950
);
5051
}
5152

src/Analyser/Generator/ExprHandler/ClassConstFetchHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function analyseExpr(
5454
impurePoints: [],
5555
specifiedTruthyTypes: new SpecifiedTypes(),
5656
specifiedFalseyTypes: new SpecifiedTypes(),
57+
specifiedNullTypes: new SpecifiedTypes(),
5758
);
5859
}
5960

src/Analyser/Generator/ExprHandler/ClosureHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function analyseExpr(
9696
impurePoints: [],
9797
specifiedTruthyTypes: new SpecifiedTypes(),
9898
specifiedFalseyTypes: new SpecifiedTypes(),
99+
specifiedNullTypes: new SpecifiedTypes(),
99100
);
100101
}
101102

@@ -459,6 +460,7 @@ private function processClosureStatementResult(
459460
impurePoints: $closureStatementResult->impurePoints,
460461
specifiedTruthyTypes: new SpecifiedTypes(),
461462
specifiedFalseyTypes: new SpecifiedTypes(),
463+
specifiedNullTypes: new SpecifiedTypes(),
462464
),
463465
$closureScope,
464466
];

src/Analyser/Generator/ExprHandler/FuncCallHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function analyseExpr(
8080
impurePoints: $impurePoints,
8181
specifiedTruthyTypes: new SpecifiedTypes(),
8282
specifiedFalseyTypes: new SpecifiedTypes(),
83+
specifiedNullTypes: new SpecifiedTypes(),
8384
);
8485
}
8586
}

src/Analyser/Generator/ExprHandler/LiteralArrayHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public function analyseExpr(
109109
impurePoints: $impurePoints,
110110
specifiedTruthyTypes: new SpecifiedTypes(),
111111
specifiedFalseyTypes: new SpecifiedTypes(),
112+
specifiedNullTypes: new SpecifiedTypes(),
112113
);
113114
}
114115

src/Analyser/Generator/ExprHandler/MethodCallHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function analyseExpr(
7171
impurePoints: $impurePoints,
7272
specifiedTruthyTypes: new SpecifiedTypes(),
7373
specifiedFalseyTypes: new SpecifiedTypes(),
74+
specifiedNullTypes: new SpecifiedTypes(),
7475
);
7576
}
7677

0 commit comments

Comments
 (0)