fix modules inter-dependencies on phpstan

This commit is contained in:
Jean-Christian 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%', '%MODULE_ROOT%',
'%DC_ROOT%', '%DC_ROOT%',
'%BOOTSTRAP_ROOT%', '%BOOTSTRAP_ROOT%',
'%SCAN_DIRECTORIES%'
], ],
[ [
$this->run_level, $this->run_level,
(string) Path::real($this->module->get('root'), false), (string) Path::real($this->module->get('root'), false),
(string) Path::real(DC_ROOT, false), (string) Path::real(DC_ROOT, false),
(string) Path::real(__DIR__ . '/phpstan', false), (string) Path::real(__DIR__ . '/phpstan', false),
$this->getScanDirectories(),
], ],
(string) file_get_contents(__DIR__ . '/phpstan/phpstan.rules.' . $full . 'conf') (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); 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: scanDirectories:
- %DC_ROOT% - %DC_ROOT%
%SCAN_DIRECTORIES%
excludePaths: excludePaths:
- %MODULE_ROOT%/*/libs/* - %MODULE_ROOT%/*/libs/*

View file

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