Skip to content

Commit b662cf1

Browse files
committed
add test for variadic validate
1 parent 47d455d commit b662cf1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

generator/tests/MethodTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ public function testGetFunctionParam()
3737

3838
public function testGetTypeHintFromRessource()
3939
{
40+
$docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/strings/functions/sprintf.xml');
41+
$xmlObject = $docPage->getMethodSynopsis();
42+
$method = new Method($xmlObject[0], $docPage->loadAndResolveFile(), $docPage->getModule(), new PhpStanFunctionMapReader(), Method::FALSY_TYPE);
43+
$params = $method->getParams();
44+
$this->assertEquals('string', $params[0]->getDocBlockType());
45+
$this->assertEquals('string', $params[0]->getSignatureType());
46+
$this->assertEquals('string|int|float|bool', $params[1]->getDocBlockType());
47+
$this->assertTrue($params[1]->isVariadic());
48+
$this->assertEquals('', $params[1]->getSignatureType());
49+
4050
$docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/mbstring/functions/mb-ereg-replace-callback.xml');
4151
$xmlObject = $docPage->getMethodSynopsis();
4252
$method = new Method($xmlObject[0], $docPage->loadAndResolveFile(), $docPage->getModule(), new PhpStanFunctionMapReader(), Method::FALSY_TYPE);

0 commit comments

Comments
 (0)