Skip to content

Commit b764a67

Browse files
committed
Add native type declaration to test methods
Signed-off-by: Maurício Meneghini Fauth <[email protected]>
1 parent d5f6712 commit b764a67

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

tests/TestCase.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ public function setUp(): void
4242
* Gets the token list generated by lexing this query.
4343
*
4444
* @param string $query the query to be lexed
45-
*
46-
* @return TokensList
4745
*/
48-
public function getTokensList($query)
46+
public function getTokensList(string $query): TokensList
4947
{
5048
$lexer = new Lexer($query);
5149

@@ -64,7 +62,7 @@ public function getTokensList($query)
6462
* : list<array{string, Token, int}>
6563
* )
6664
*/
67-
public function getErrorsAsArray($obj)
65+
public function getErrorsAsArray($obj): array
6866
{
6967
$ret = [];
7068
if ($obj instanceof Lexer) {
@@ -95,7 +93,7 @@ public function getErrorsAsArray($obj)
9593
* errors: array{lexer: list<array{string, string, int, int}>, parser: list<array{string, Token, int}>}
9694
* }
9795
*/
98-
public function getData($name): array
96+
public function getData(string $name): array
9997
{
10098
$serializedData = file_get_contents('tests/data/' . $name . '.out');
10199
$this->assertIsString($serializedData);
@@ -131,7 +129,7 @@ public function getData($name): array
131129
*
132130
* @param string $name the name of the test
133131
*/
134-
public function runParserTest($name): void
132+
public function runParserTest(string $name): void
135133
{
136134
/**
137135
* Test's data.

tests/Utils/CLITest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ class CLITest extends TestCase
1616
{
1717
/**
1818
* @param array<string, bool|string>|false $getopt
19-
*
20-
* @return CLI
2119
*/
22-
private function getCLI($getopt)
20+
private function getCLI($getopt): CLI
2321
{
2422
$cli = $this->createPartialMock(CLI::class, ['getopt']);
2523
$cli->method('getopt')->willReturn($getopt);
@@ -29,10 +27,8 @@ private function getCLI($getopt)
2927

3028
/**
3129
* @param array<string, bool|string>|false $getopt
32-
*
33-
* @return CLI
3430
*/
35-
private function getCLIStdIn(string $input, $getopt)
31+
private function getCLIStdIn(string $input, $getopt): CLI
3632
{
3733
$cli = $this->createPartialMock(CLI::class, ['getopt', 'readStdin']);
3834
$cli->method('getopt')->willReturn($getopt);

0 commit comments

Comments
 (0)