Skip to content

Commit 7913c28

Browse files
Remove useless checks
1 parent 677ca44 commit 7913c28

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

src/Analyser/ExprHandler/MethodCallHandler.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,24 +153,22 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
153153
$scope = $argsResult->getScope();
154154

155155
if ($methodReflection !== null) {
156-
if ($parametersAcceptor !== null) {
157-
$methodThrowPoint = $this->getMethodThrowPoint($methodReflection, $parametersAcceptor, $expr, $scope);
158-
if ($methodThrowPoint !== null) {
159-
$throwPoints[] = $methodThrowPoint;
160-
}
156+
$methodThrowPoint = $this->getMethodThrowPoint($methodReflection, $parametersAcceptor, $expr, $scope);
157+
if ($methodThrowPoint !== null) {
158+
$throwPoints[] = $methodThrowPoint;
161159
}
162160

163161
if ($methodReflection->getName() === '__construct' || $methodReflection->hasSideEffects()->yes()) {
164162
$nodeScopeResolver->callNodeCallback($nodeCallback, new InvalidateExprNode($normalizedExpr->var), $scope, $storage);
165163
$scope = $scope->invalidateExpression($normalizedExpr->var, true, $methodReflection->getDeclaringClass());
166-
} elseif ($this->rememberPossiblyImpureFunctionValues && $methodReflection->hasSideEffects()->maybe() && !$methodReflection->getDeclaringClass()->isBuiltin() && $parametersAcceptor !== null) {
164+
} elseif ($this->rememberPossiblyImpureFunctionValues && $methodReflection->hasSideEffects()->maybe() && !$methodReflection->getDeclaringClass()->isBuiltin()) {
167165
$scope = $scope->assignExpression(
168166
new PossiblyImpureCallExpr($normalizedExpr, $normalizedExpr->var, sprintf('%s::%s()', $methodReflection->getDeclaringClass()->getDisplayName(), $methodReflection->getName())),
169167
$parametersAcceptor->getReturnType(),
170168
new MixedType(),
171169
);
172170
}
173-
if ($parametersAcceptor !== null && !$methodReflection->isStatic()) {
171+
if (!$methodReflection->isStatic()) {
174172
$selfOutType = $methodReflection->getSelfOutType();
175173
if ($selfOutType !== null) {
176174
$scope = $scope->assignExpression(

src/Analyser/ExprHandler/StaticCallHandler.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
198198
$scope = $argsResult->getScope();
199199
$scopeFunction = $scope->getFunction();
200200

201-
if ($methodReflection !== null && $parametersAcceptor !== null) {
201+
if ($methodReflection !== null) {
202202
$methodThrowPoint = $this->getStaticMethodThrowPoint($methodReflection, $parametersAcceptor, $expr, $scope);
203203
if ($methodThrowPoint !== null) {
204204
$throwPoints[] = $methodThrowPoint;
@@ -221,7 +221,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
221221
} elseif (
222222
$methodReflection !== null
223223
&& $this->rememberPossiblyImpureFunctionValues
224-
&& $parametersAcceptor !== null
225224
&& $scope->isInClass()
226225
&& $scope->getClassReflection()->is($methodReflection->getDeclaringClass()->getName())
227226
&& $methodReflection->hasSideEffects()->maybe()

src/Analyser/TypeSpecifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1896,7 +1896,7 @@ private function specifyTypesFromCallableCall(TypeSpecifierContext $context, Fun
18961896
}
18971897
}
18981898

1899-
if ($assertions === null || $assertions->getAll() === [] || $parametersAcceptor === null) {
1899+
if ($assertions === null || $assertions->getAll() === []) {
19001900
return null;
19011901
}
19021902

0 commit comments

Comments
 (0)