Skip to content

Commit cc7a121

Browse files
Refactor
1 parent e5415d2 commit cc7a121

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

src/TextUI/Command/Commands/ListTestsAsTextCommand.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@
1919
*/
2020
final readonly class ListTestsAsTextCommand implements Command
2121
{
22+
/**
23+
* @psalm-var list<TestCase|PhptTestCase>
24+
*/
2225
private array $tests;
2326

27+
/**
28+
* @psalm-param list<TestCase|PhptTestCase> $tests
29+
*/
2430
public function __construct(array $tests)
2531
{
2632
$this->tests = $tests;
@@ -37,10 +43,8 @@ public function execute(): Result
3743
$test::class,
3844
str_replace(' with data set ', '', $test->nameWithDataSet()),
3945
);
40-
} elseif ($test instanceof PhptTestCase) {
41-
$name = $test->getName();
4246
} else {
43-
continue;
47+
$name = $test->getName();
4448
}
4549

4650
$buffer .= sprintf(

src/TextUI/Command/Commands/ListTestsAsXmlCommand.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@
2121
*/
2222
final readonly class ListTestsAsXmlCommand implements Command
2323
{
24+
/**
25+
* @psalm-var list<TestCase|PhptTestCase>
26+
*/
2427
private array $tests;
2528
private string $filename;
2629

30+
/**
31+
* @psalm-param list<TestCase|PhptTestCase> $tests
32+
*/
2733
public function __construct(array $tests, string $filename)
2834
{
2935
$this->tests = $tests;
@@ -76,17 +82,15 @@ public function execute(): Result
7682
continue;
7783
}
7884

79-
if ($test instanceof PhptTestCase) {
80-
if ($currentTestClass !== null) {
81-
$writer->endElement();
82-
83-
$currentTestClass = null;
84-
}
85-
86-
$writer->startElement('phpt');
87-
$writer->writeAttribute('file', $test->getName());
85+
if ($currentTestClass !== null) {
8886
$writer->endElement();
87+
88+
$currentTestClass = null;
8989
}
90+
91+
$writer->startElement('phpt');
92+
$writer->writeAttribute('file', $test->getName());
93+
$writer->endElement();
9094
}
9195

9296
if ($currentTestClass !== null) {

0 commit comments

Comments
 (0)