Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 22, 2023
1 parent 5c5b170 commit c43c2a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
if ($returnType->isConstantScalarValue()->yes()) {
return $returnType->generalize(GeneralizePrecision::lessSpecific());
}
return $returnType;
}

return null;
Expand Down
9 changes: 9 additions & 0 deletions tests/Type/Symfony/data/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ function testCacheCallable(\Symfony\Contracts\Cache\CacheInterface $cache): voi
assertType('string', $result);
};

/**
* @param callable():string $fn
*/
function testNonScalarCacheCallable(\Symfony\Contracts\Cache\CacheInterface $cache, callable $fn): void {
$result = $cache->get('foo', $fn);

assertType('string', $result);
};

/**
* @param \Symfony\Contracts\Cache\CallbackInterface<\stdClass> $cb
*/
Expand Down

0 comments on commit c43c2a4

Please sign in to comment.