Skip to content

Commit 06c5a5d

Browse files
ENGCOM-7781: improve NonComposerComponentRegistration #28975
- Merge Pull Request #28975 from rvitaliy/magento2:feature/improve-NonComposerComponentRegistration.php - Merged commits: 1. 8e45616
2 parents 2219289 + 8e45616 commit 06c5a5d

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

app/etc/NonComposerComponentRegistration.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
//Register components (via a list of glob patterns)
89
namespace Magento\NonComposerComponentRegistration;
@@ -11,23 +12,23 @@
1112

1213
/**
1314
* Include files from a list of glob patterns
14-
*
15-
* @throws RuntimeException
16-
* @return void
1715
*/
18-
$main = function ()
19-
{
16+
(static function (): void {
2017
$globPatterns = require __DIR__ . '/registration_globlist.php';
21-
$baseDir = dirname(dirname(__DIR__)) . '/';
18+
$baseDir = \dirname(__DIR__, 2) . '/';
2219

2320
foreach ($globPatterns as $globPattern) {
2421
// Sorting is disabled intentionally for performance improvement
25-
$files = glob($baseDir . $globPattern, GLOB_NOSORT);
22+
$files = \glob($baseDir . $globPattern, GLOB_NOSORT);
2623
if ($files === false) {
2724
throw new RuntimeException("glob(): error with '$baseDir$globPattern'");
2825
}
29-
array_map(function ($file) { require_once $file; }, $files);
30-
}
31-
};
3226

33-
$main();
27+
\array_map(
28+
static function (string $file): void {
29+
require_once $file;
30+
},
31+
$files
32+
);
33+
}
34+
})();

0 commit comments

Comments
 (0)