Skip to content

Commit

Permalink
just return null instead of the default type
Browse files Browse the repository at this point in the history
  • Loading branch information
verfriemelt-dot-org committed Dec 12, 2022
1 parent eddc6a2 commit 45062c1
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/Type/Php/DateIntervalDynamicReturnTypeExtension.php
Expand Up @@ -28,16 +28,10 @@ public function isStaticMethodSupported(MethodReflection $methodReflection): boo

public function getTypeFromStaticMethodCall(MethodReflection $methodReflection, StaticCall $methodCall, Scope $scope): ?Type
{
$defaultReturnType = ParametersAcceptorSelector::selectFromArgs(
$scope,
$methodCall->getArgs(),
$methodReflection->getVariants(),
)->getReturnType();

$dateTimeString = $scope->getType($methodCall->getArgs()[0]->value);

if (!($dateTimeString instanceof ConstantStringType)) {
return $defaultReturnType;
return null;
}

$isValid = DateInterval::createFromDateString($dateTimeString->getValue()) !== false;
Expand Down

0 comments on commit 45062c1

Please sign in to comment.