Skip to content

Commit 2d16403

Browse files
Return early
1 parent d11dc31 commit 2d16403

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/Framework/TestSuite.php

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -174,30 +174,32 @@ public function addTest(Test $test, array $groups = []): void
174174
{
175175
$class = new ReflectionClass($test);
176176

177-
if (!$class->isAbstract()) {
178-
$this->tests[] = $test;
179-
$this->clearCaches();
177+
if ($class->isAbstract()) {
178+
return;
179+
}
180180

181-
if ($test instanceof self && empty($groups)) {
182-
$groups = $test->groups();
183-
}
181+
$this->tests[] = $test;
182+
$this->clearCaches();
184183

185-
if ($this->containsOnlyVirtualGroups($groups)) {
186-
$groups[] = 'default';
187-
}
184+
if ($test instanceof self && empty($groups)) {
185+
$groups = $test->groups();
186+
}
188187

189-
foreach ($groups as $group) {
190-
if (!isset($this->groups[$group])) {
191-
$this->groups[$group] = [$test];
192-
} else {
193-
$this->groups[$group][] = $test;
194-
}
195-
}
188+
if ($this->containsOnlyVirtualGroups($groups)) {
189+
$groups[] = 'default';
190+
}
196191

197-
if ($test instanceof TestCase) {
198-
$test->setGroups($groups);
192+
foreach ($groups as $group) {
193+
if (!isset($this->groups[$group])) {
194+
$this->groups[$group] = [$test];
195+
} else {
196+
$this->groups[$group][] = $test;
199197
}
200198
}
199+
200+
if ($test instanceof TestCase) {
201+
$test->setGroups($groups);
202+
}
201203
}
202204

203205
/**

0 commit comments

Comments
 (0)