Skip to content

Commit

Permalink
Merge pull request #36742 from fsamapoor/patch-1
Browse files Browse the repository at this point in the history
Refactors tests/app.php to improve code readability.
  • Loading branch information
ChristophWurst authored Sep 27, 2023
2 parents 912b18b + c322224 commit 0a20b5d
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions tests/apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,34 @@
* See the COPYING-README file.
*/

function loadDirectory($path) {
function loadDirectory($path): void {
if (strpos($path, 'integration')) {
return;
}

if (strpos($path, 'Integration')) {
return;
}
if ($dh = opendir($path)) {
while ($name = readdir($dh)) {
if ($name[0] !== '.') {
$file = $path . '/' . $name;
if (is_dir($file)) {
loadDirectory($file);
} elseif (substr($name, -4, 4) === '.php') {
require_once $file;
}
}

if (! $dh = opendir($path)) {
return;
}

while ($name = readdir($dh)) {
if ($name[0] === '.') {
continue;
}

$file = $path . '/' . $name;
if (is_dir($file)) {
loadDirectory($file);
} elseif (str_ends_with($name, '.php')) {
require_once $file;
}
}
}

function getSubclasses($parentClassName) {
function getSubclasses($parentClassName): array {
$classes = [];
foreach (get_declared_classes() as $className) {
if (is_subclass_of($className, $parentClassName)) {
Expand Down

0 comments on commit 0a20b5d

Please sign in to comment.