Skip to content

Commit 0a20b5d

Browse files
Merge pull request #36742 from fsamapoor/patch-1
Refactors tests/app.php to improve code readability.
2 parents 912b18b + c322224 commit 0a20b5d

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

tests/apps.php

+18-12
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,34 @@
66
* See the COPYING-README file.
77
*/
88

9-
function loadDirectory($path) {
9+
function loadDirectory($path): void {
1010
if (strpos($path, 'integration')) {
1111
return;
1212
}
13+
1314
if (strpos($path, 'Integration')) {
1415
return;
1516
}
16-
if ($dh = opendir($path)) {
17-
while ($name = readdir($dh)) {
18-
if ($name[0] !== '.') {
19-
$file = $path . '/' . $name;
20-
if (is_dir($file)) {
21-
loadDirectory($file);
22-
} elseif (substr($name, -4, 4) === '.php') {
23-
require_once $file;
24-
}
25-
}
17+
18+
if (! $dh = opendir($path)) {
19+
return;
20+
}
21+
22+
while ($name = readdir($dh)) {
23+
if ($name[0] === '.') {
24+
continue;
25+
}
26+
27+
$file = $path . '/' . $name;
28+
if (is_dir($file)) {
29+
loadDirectory($file);
30+
} elseif (str_ends_with($name, '.php')) {
31+
require_once $file;
2632
}
2733
}
2834
}
2935

30-
function getSubclasses($parentClassName) {
36+
function getSubclasses($parentClassName): array {
3137
$classes = [];
3238
foreach (get_declared_classes() as $className) {
3339
if (is_subclass_of($className, $parentClassName)) {

0 commit comments

Comments
 (0)