Fix stripping ".git" from dir names
authorChristian Weiske <cweiske@cweiske.de>
Wed, 22 Mar 2023 19:22:01 +0000 (20:22 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 22 Mar 2023 21:21:03 +0000 (22:21 +0100)
This did never work, but earlier PHP versions did not complain

src/phorkie/Repositories.php

index 9021a2e1a549cfe2e5dd4bc754c104982c5c27f2..c6059961a3f6ed2b2124276729698ab4ef46fd37 100644 (file)
@@ -16,13 +16,11 @@ class Repositories
     {
         chdir($this->gitDir);
         $dirs = glob('*.git', GLOB_ONLYDIR);
-        array_walk(
-            $dirs,
-            function ($dir) {
-                return substr($dir, 0, -4);
-            }
-        );
+        foreach ($dirs as $key => $dir) {
+            $dirs[$key] = substr($dir, 0, -4);
+        }
         sort($dirs, SORT_NUMERIC);
+
         if ($GLOBALS['phorkie']['cfg']['randomIds']) {
             $n = end($dirs) + mt_rand(65536, 16777216);
         } else {