Skip to content

Commit be871d1

Browse files
Merge pull request #533 from kamil-tekiela/Native-param-types-in-tests
Add native param types in tests
2 parents b05c846 + 1a27fbc commit be871d1

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

tests/Components/GroupKeywordTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function provideExpressions(): Generator
5353

5454
/** @param GroupKeyword|array<GroupKeyword> $component */
5555
#[DataProvider('provideExpressions')]
56-
public function testBuild($component, string $expected): void
56+
public function testBuild(GroupKeyword|array $component, string $expected): void
5757
{
5858
if (is_array($component)) {
5959
$this->assertSame($expected, GroupKeyword::buildAll($component));

tests/Lexer/ContextTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ public function testLoadError(): void
116116
$this->assertFalse(Context::load('Foo'));
117117
}
118118

119-
/** @param int|string $mode */
120119
#[DataProvider('providerForTestMode')]
121-
public function testMode($mode, int $expected): void
120+
public function testMode(int|string $mode, int $expected): void
122121
{
123122
Context::setMode($mode);
124123
$this->assertSame($expected, Context::getMode());

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getTokensList(string $query): TokensList
5959
* : list<array{string, Token|null, int}>
6060
* )
6161
*/
62-
public function getErrorsAsArray($obj): array
62+
public function getErrorsAsArray(Lexer|Parser $obj): array
6363
{
6464
$ret = [];
6565
if ($obj instanceof Lexer) {

tests/Utils/CLITest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function testGetopt(): void
5050

5151
/** @param array<string, bool|string>|false $getopt */
5252
#[DataProvider('highlightParamsProvider')]
53-
public function testRunHighlight($getopt, string $output, int $result): void
53+
public function testRunHighlight(array|false $getopt, string $output, int $result): void
5454
{
5555
$cli = $this->getCLI($getopt);
5656
$this->expectOutputString($output);
@@ -122,7 +122,7 @@ public static function highlightParamsProvider(): array
122122

123123
/** @param array<string, bool|string>|false $getopt */
124124
#[DataProvider('highlightParamsStdInProvider')]
125-
public function testRunHighlightStdIn(string $input, $getopt, string $output, int $result): void
125+
public function testRunHighlightStdIn(string $input, array|false $getopt, string $output, int $result): void
126126
{
127127
$cli = $this->getCLIStdIn($input, $getopt);
128128
$this->expectOutputString($output);
@@ -187,7 +187,7 @@ public static function highlightParamsStdInProvider(): array
187187

188188
/** @param array<string, bool|string>|false $getopt */
189189
#[DataProvider('lintParamsStdInProvider')]
190-
public function testRunLintFromStdIn(string $input, $getopt, string $output, int $result): void
190+
public function testRunLintFromStdIn(string $input, array|false $getopt, string $output, int $result): void
191191
{
192192
$cli = $this->getCLIStdIn($input, $getopt);
193193
$this->expectOutputString($output);
@@ -249,7 +249,7 @@ public static function lintParamsStdInProvider(): array
249249

250250
/** @param array<string, bool|string>|false $getopt */
251251
#[DataProvider('lintParamsProvider')]
252-
public function testRunLint($getopt, string $output, int $result): void
252+
public function testRunLint(array|false $getopt, string $output, int $result): void
253253
{
254254
$cli = $this->getCLI($getopt);
255255
$this->expectOutputString($output);
@@ -313,7 +313,7 @@ public static function lintParamsProvider(): array
313313

314314
/** @param array<string, bool|string>|false $getopt */
315315
#[DataProvider('tokenizeParamsProvider')]
316-
public function testRunTokenize($getopt, string $output, int $result): void
316+
public function testRunTokenize(array|false $getopt, string $output, int $result): void
317317
{
318318
$cli = $this->getCLI($getopt);
319319
$this->expectOutputString($output);
@@ -365,7 +365,7 @@ public static function tokenizeParamsProvider(): array
365365

366366
/** @param array<string, bool|string>|false $getopt */
367367
#[DataProvider('tokenizeParamsStdInProvider')]
368-
public function testRunTokenizeStdIn(string $input, $getopt, string $output, int $result): void
368+
public function testRunTokenizeStdIn(string $input, array|false $getopt, string $output, int $result): void
369369
{
370370
$cli = $this->getCLIStdIn($input, $getopt);
371371
$this->expectOutputString($output);

0 commit comments

Comments
 (0)