fix: phpstan level=6

This commit is contained in:
origami11@yandex.ru 2025-10-06 12:49:36 +03:00
parent acbf2c847d
commit 48269bd424
41 changed files with 324 additions and 347 deletions

View file

@ -368,12 +368,12 @@ class Path
/**
* Список файлов в директории
*
* @param array $allow массив расширений для файлов
* @param ?array $allow массив расширений для файлов
* @param array $ignore массив имен пааок которые не нужно обрабатывать
*
* @returnarray
*/
public function getContent($allow = null, $ignore = [])
public function getContent(?array $allow = null, array $ignore = [])
{
$ignore = array_merge([".", ".."], $ignore);
return self::fileList($this->__toString(), $allow, $ignore);
@ -382,12 +382,12 @@ class Path
/**
* Обьединяет строки в путь соединяя необходимым разделителем
*
* @param array $allow массив расширений разрешеных для файлов
* @param ?array $allow массив расширений разрешеных для файлов
* @param array $ignore массив имен пааок которые не нужно обрабатывать
*
* @return array
*/
function getContentRec($allow = null, $ignore = [])
function getContentRec(?array $allow = null, array $ignore = [])
{
$result = [];
$ignore = array_merge([".", ".."], $ignore);
@ -396,7 +396,7 @@ class Path
}
// Использовать SPL ???
protected static function fileList($base, &$allow, &$ignore)
protected static function fileList(string $base, ?array &$allow, array &$ignore): array
{
if ($base == '') $base = '.';
$result = [];
@ -441,7 +441,7 @@ class Path
*
* @return void
*/
static function prepare($dst, $filename = true)
static function prepare(string $dst, bool $filename = true)
{
if ($filename) {
$path_dst = pathinfo($dst, PATHINFO_DIRNAME);
@ -462,7 +462,7 @@ class Path
*
* @return string
*/
static function updateRelativePathOnFileMove($relativePath, $srcFile, $dstFile) {
static function updateRelativePathOnFileMove(string $relativePath, string $srcFile, string $dstFile) {
$srcToDst = self::relative($srcFile, $dstFile);
return self::normalize(self::join($srcToDst, $relativePath));
}
@ -477,7 +477,7 @@ class Path
*
* @return string
*/
static function updateRelativePathOnDirectoryMove($relativePath, $fileDir, $srcDir, $dstDir) {
static function updateRelativePathOnDirectoryMove(string $relativePath, string $fileDir, string $srcDir, string $dstDir) {
$relativePath = self::normalize($relativePath);
$fileDir = self::normalize($fileDir);
$srcDir = self::normalize($srcDir);