diff --git a/psalm_autoload.php b/psalm_autoload.php index d8d92a892ce8..6ebe830423b5 100644 --- a/psalm_autoload.php +++ b/psalm_autoload.php @@ -4,49 +4,40 @@ require __DIR__ . '/system/util_bootstrap.php'; -$helperDirs = [ +$directories = [ 'system/Helpers', -]; - -foreach ($helperDirs as $dir) { - $dir = __DIR__ . '/' . $dir; - if (! is_dir($dir)) { - continue; - } - - chdir($dir); - - foreach (glob('*_helper.php') as $filename) { - $filePath = realpath($dir . '/' . $filename); - - require_once $filePath; - } -} - -$dirs = [ - 'tests/_support/_controller', - 'tests/_support/Controllers', - 'tests/_support/Entity', - 'tests/_support/Entity/Cast', - 'tests/_support/Models', - 'tests/_support/Validation', - 'tests/_support/View', + 'tests/_support', 'tests/system/Config/fixtures', ]; +$excludeDirs = [ + 'tests/_support/Config', + 'tests/_support/View/Cells', + 'tests/_support/View/Views', +]; -foreach ($dirs as $dir) { - $dir = __DIR__ . '/' . $dir; - if (! is_dir($dir)) { - continue; - } - - chdir($dir); - - foreach (glob('*.php') as $filename) { - $filePath = realpath($dir . '/' . $filename); - - require_once $filePath; +foreach ($directories as $directory) { + $iterator = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator( + $directory, + RecursiveDirectoryIterator::UNIX_PATHS | RecursiveDirectoryIterator::CURRENT_AS_FILEINFO, + ), + RecursiveIteratorIterator::CHILD_FIRST, + ); + + /** @var SplFileInfo $file */ + foreach ($iterator as $file) { + if (! $file->isFile()) { + continue; + } + + if (in_array($file->getPath(), $excludeDirs, true)) { + continue; + } + + if ($file->getExtension() !== 'php') { + continue; + } + + require_once $file->getPathname(); } } - -chdir(__DIR__); diff --git a/system/BaseModel.php b/system/BaseModel.php index a5762a23be7d..ca0e20c32829 100644 --- a/system/BaseModel.php +++ b/system/BaseModel.php @@ -1093,9 +1093,7 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc $row = $this->doProtectFields($row); // Restore updateIndex value in case it was wiped out - if ($updateIndex !== null) { - $row[$index] = $updateIndex; - } + $row[$index] = $updateIndex; $row = $this->setUpdatedField($row, $this->setDate()); } diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index 0f432eeac1e8..58f4f745ccd6 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -1,4 +1,4 @@ -# total 3271 errors +# total 3270 errors includes: - argument.type.neon - assign.propertyType.neon @@ -19,7 +19,6 @@ includes: - missingType.iterableValue.neon - missingType.parameter.neon - missingType.property.neon - - notIdentical.alwaysTrue.neon - nullCoalesce.property.neon - offsetAccess.notFound.neon - property.defaultValue.neon diff --git a/utils/phpstan-baseline/notIdentical.alwaysTrue.neon b/utils/phpstan-baseline/notIdentical.alwaysTrue.neon deleted file mode 100644 index 48feec028165..000000000000 --- a/utils/phpstan-baseline/notIdentical.alwaysTrue.neon +++ /dev/null @@ -1,8 +0,0 @@ -# total 1 error - -parameters: - ignoreErrors: - - - message: '#^Strict comparison using \!\=\= between mixed and null will always evaluate to true\.$#' - count: 1 - path: ../../system/BaseModel.php