fix modules inter-dependencies on phpstan

master
Jean-Christian Paul Denis 2023-04-17 10:40:25 +02:00
parent a4e2b855ce
commit 589313f4ad
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
3 changed files with 19 additions and 3 deletions

View File

@ -282,12 +282,14 @@ class phpstan extends Action
'%MODULE_ROOT%',
'%DC_ROOT%',
'%BOOTSTRAP_ROOT%',
'%SCAN_DIRECTORIES%'
],
[
$this->run_level,
(string) Path::real($this->module->get('root'), false),
(string) Path::real(DC_ROOT, false),
(string) Path::real(__DIR__ . '/phpstan', false),
$this->getScanDirectories(),
],
(string) file_get_contents(__DIR__ . '/phpstan/phpstan.rules.' . $full . 'conf')
);
@ -306,4 +308,19 @@ class phpstan extends Action
return (bool) file_put_contents(DC_VAR . '/phpstan.neon', $content);
}
private function getScanDirectories()
{
$ret = '';
if ($this->module->get('type') == 'plugin') {
$paths = explode(PATH_SEPARATOR, DC_PLUGINS_ROOT);
foreach($paths as $path) {
$path = Path::real($path, false);
if ($path !== false && $path != Path::real(DC_ROOT . DIRECTORY_SEPARATOR . 'plugins', false)) {
$ret .= ' - ' . $path . "\n";
}
}
}
return $ret;
}
}

View File

@ -9,6 +9,7 @@ parameters:
scanDirectories:
- %DC_ROOT%
%SCAN_DIRECTORIES%
excludePaths:
- %MODULE_ROOT%/*/libs/*

View File

@ -9,6 +9,7 @@ parameters:
scanDirectories:
- %DC_ROOT%
%SCAN_DIRECTORIES%
excludePaths:
- %MODULE_ROOT%/*/libs/*
@ -120,9 +121,6 @@ parameters:
# dbStruct object and auto properties
- message : '#Access to an undefined property dbStruct::#'
# fileItem object and auto properties
- message : '#Access to an undefined property fileItem::#'
# cursor object and auto properties
- message : '#Access to an undefined property cursor::#'