Skip to content

Commit 0f45601

Browse files
[TypeInfo] Add tests for uncovered conditions
1 parent 1a16ebc commit 0f45601

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/Symfony/Component/TypeInfo/Tests/TypeResolver/ReflectionParameterTypeResolverTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ public function testCannotResolveReflectionParameterWithoutType()
4444
$this->resolver->resolve($reflectionParameter);
4545
}
4646

47+
public function testCannotResolveReflectionParameterWithoutTypeOnFunction()
48+
{
49+
$reflectionFunction = new \ReflectionFunction('fclose');
50+
$reflectionParameter = $reflectionFunction->getParameters()[0];
51+
52+
$this->expectException(UnsupportedException::class);
53+
$this->expectExceptionMessage('Cannot resolve type for "fclose($stream)".');
54+
55+
$this->resolver->resolve($reflectionParameter);
56+
}
57+
4758
public function testResolve()
4859
{
4960
$reflectionClass = new \ReflectionClass(ReflectionExtractableDummy::class);

src/Symfony/Component/TypeInfo/Tests/TypeResolver/ReflectionReturnTypeResolverTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ public function testCannotResolveReflectionFunctionAbstractWithoutType()
4444
$this->resolver->resolve($reflectionFunction);
4545
}
4646

47+
public function testCannotResolveReflectionFunctionWithoutType()
48+
{
49+
$reflectionFunction = new \ReflectionFunction('fopen');
50+
51+
$this->expectException(UnsupportedException::class);
52+
$this->expectExceptionMessage('Cannot resolve type for "fopen()".');
53+
54+
$this->resolver->resolve($reflectionFunction);
55+
}
56+
4757
public function testResolve()
4858
{
4959
$reflectionClass = new \ReflectionClass(ReflectionExtractableDummy::class);

0 commit comments

Comments
 (0)