fix: spark namespaces cannot show a namespace with mutilple paths

This commit is contained in:
kenjis 2022-12-14 17:02:00 +09:00
parent f30fba67ed
commit fbb8db40f5
No known key found for this signature in database
GPG Key ID: BD254878922AF198
4 changed files with 17 additions and 14 deletions

View File

@ -38,7 +38,8 @@ class Autoload extends AutoloadConfig
* ];
*```
*
* @var array<string, string>
* @var array<string, array<int, string>|string>
* @phpstan-var array<string, string|list<string>>
*/
public $psr4 = [
APP_NAMESPACE => APPPATH, // For custom app namespace

View File

@ -20,11 +20,6 @@ parameters:
count: 1
path: system/Autoloader/Autoloader.php
-
message: "#^Property Config\\\\Autoload\\:\\:\\$psr4 \\(array\\<string, string\\>\\) in isset\\(\\) is not nullable\\.$#"
count: 1
path: system/Autoloader/Autoloader.php
-
message: "#^Property Config\\\\Cache\\:\\:\\$backupHandler \\(string\\) in isset\\(\\) is not nullable\\.$#"
count: 1

View File

@ -74,14 +74,20 @@ class Namespaces extends BaseCommand
$tbody = [];
foreach ($config->psr4 as $ns => $path) {
$path = realpath($path) ?: $path;
foreach ($config->psr4 as $ns => $paths) {
if (is_string($paths)) {
$paths = [$paths];
}
$tbody[] = [
$ns,
realpath($path) ?: $path,
is_dir($path) ? 'Yes' : 'MISSING',
];
foreach ($paths as $path) {
$path = realpath($path) ?: $path;
$tbody[] = [
$ns,
realpath($path) ?: $path,
is_dir($path) ? 'Yes' : 'MISSING',
];
}
}
$thead = [

View File

@ -45,7 +45,8 @@ class AutoloadConfig
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* @var array<string, string>
* @var array<string, array<int, string>|string>
* @phpstan-var array<string, string|list<string>>
*/
public $psr4 = [];