Skip to content

Commit 80ad161

Browse files
minor symfony#57713 [TypeInfo] Add tests for uncovered conditions (alexandre-daubois)
This PR was merged into the 7.2 branch. Discussion ---------- [TypeInfo] Add tests for uncovered conditions | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Commits ------- 0f45601 [TypeInfo] Add tests for uncovered conditions
2 parents aaa2b8c + 0f45601 commit 80ad161

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)