Skip to content

Commit 77be18c

Browse files
committed
Fix tests for new return type \array
1 parent 8ee1e6b commit 77be18c

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

generator/tests/MethodTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function testImapOpen5Parameter()
8080
$xmlObject = $docPage->getMethodSynopsis();
8181
$method = new Method($xmlObject[0], $docPage->loadAndResolveFile(), $docPage->getModule(), new PhpStanFunctionMapReader(), Method::FALSY_TYPE);
8282
$params = $method->getParams();
83-
$this->assertEquals('array', $params[5]->getDocBlockType());
83+
$this->assertEquals('\array', $params[5]->getDocBlockType());
8484
$this->assertEquals('array', $params[5]->getSignatureType());
8585
}
8686

@@ -100,7 +100,7 @@ public function testGetReturnDocBlock(): void
100100
$docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/array/functions/array-replace.xml');
101101
$xmlObject = $docPage->getMethodSynopsis();
102102
$method = new Method($xmlObject[0], $docPage->loadAndResolveFile(), $docPage->getModule(), new PhpStanFunctionMapReader(), Method::NULLSY_TYPE);
103-
$this->assertEquals("@return array Returns an array.\n", $method->getReturnDocBlock());
103+
$this->assertEquals("@return \array Returns an array.\n", $method->getReturnDocBlock());
104104

105105
$docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/shmop/functions/shmop-delete.xml');
106106
$xmlObject = $docPage->getMethodSynopsis();

generator/tests/PhpStanFunctions/PhpStanTypeTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class PhpStanTypeTest extends TestCase
1212
public function testMixedTypes(): void
1313
{
1414
$param = new PhpStanType('array|string|int');
15-
$this->assertEquals('array|string|int', $param->getDocBlockType());
15+
$this->assertEquals('\array|string|int', $param->getDocBlockType());
1616
$this->assertEquals('', $param->getSignatureType());
1717
}
1818

@@ -34,31 +34,31 @@ public function testGenerics(): void
3434
$this->assertEquals('iterable', $param->getSignatureType());
3535

3636
$param = new PhpStanType('array<string,mixed>');
37-
$this->assertEquals('array<string,mixed>', $param->getDocBlockType());
37+
$this->assertEquals('\array<string,mixed>', $param->getDocBlockType());
3838
$this->assertEquals('array', $param->getSignatureType());
3939

4040
$param = new PhpStanType('array<string,mixed>|array<int,string>');
41-
$this->assertEquals('array<string,mixed>|array<int,string>', $param->getDocBlockType());
41+
$this->assertEquals('\array<string,mixed>|\array<int,string>', $param->getDocBlockType());
4242
$this->assertEquals('array', $param->getSignatureType());
4343

4444
$param = new PhpStanType('array<int|string,object|bool>');
45-
$this->assertEquals('array<int|string,object|bool>', $param->getDocBlockType());
45+
$this->assertEquals('\array<int|string,object|bool>', $param->getDocBlockType());
4646
$this->assertEquals('array', $param->getSignatureType());
4747

4848
$param = new PhpStanType('array<int|string,array<int|string>>|array{1: int, 2: string}');
49-
$this->assertEquals('array<int|string,array<int|string>>|array{1: int, 2: string}', $param->getDocBlockType());
49+
$this->assertEquals('\array<int|string,\array<int|string>>|\array{1: int, 2: string}', $param->getDocBlockType());
5050
$this->assertEquals('array', $param->getSignatureType());
5151

5252
$param = new PhpStanType('array{0:float,1:float,2:float,3:float,4:float,5:float}');
53-
$this->assertEquals('array{0:float,1:float,2:float,3:float,4:float,5:float}', $param->getDocBlockType());
53+
$this->assertEquals('\array{0:float,1:float,2:float,3:float,4:float,5:float}', $param->getDocBlockType());
5454
$this->assertEquals('array', $param->getSignatureType());
5555
}
5656

5757
public function testNullable(): void
5858
{
5959
$param = new PhpStanType('array|null');
6060
$this->assertEquals(true, $param->isNullable());
61-
$this->assertEquals('array|null', $param->getDocBlockType());
61+
$this->assertEquals('\array|null', $param->getDocBlockType());
6262
$this->assertEquals('?array', $param->getSignatureType());
6363

6464
$param = new PhpStanType('?int|?string');
@@ -150,7 +150,7 @@ public function testErrorTypeInteraction(): void
150150
public function testDuplicateType(): void
151151
{
152152
$param = new PhpStanType('array<string,string>|array<string,false>|array<string,array<int,mixed>>');
153-
$this->assertEquals('array<string,string>|array<string,false>|array<string,array<int,mixed>>', $param->getDocBlockType());
153+
$this->assertEquals('\array<string,string>|\array<string,false>|\array<string,\array<int,mixed>>', $param->getDocBlockType());
154154
$this->assertEquals('array', $param->getSignatureType());
155155
}
156156

@@ -178,7 +178,7 @@ public function testPositiveIntBecomingInt(): void
178178
public function testListBecomingArray(): void
179179
{
180180
$param = new PhpStanType('list<string>|false');
181-
$this->assertEquals('array<string>', $param->getDocBlockType(Method::FALSY_TYPE));
181+
$this->assertEquals('\array<string>', $param->getDocBlockType(Method::FALSY_TYPE));
182182
$this->assertEquals('array', $param->getSignatureType(Method::FALSY_TYPE));
183183
}
184184

0 commit comments

Comments
 (0)