type fixes
This commit is contained in:
@@ -46,13 +46,13 @@ class DateTime
|
||||
|
||||
public const SYSTEM_DATE_FORMAT = 'Y-m-d';
|
||||
|
||||
private ?string $dateFormat;
|
||||
private string $dateFormat;
|
||||
|
||||
private ?string $timeFormat;
|
||||
private string $timeFormat;
|
||||
|
||||
private DateTimeZone $timezone;
|
||||
|
||||
private ?string $language;
|
||||
private string $language;
|
||||
|
||||
public function __construct(
|
||||
?string $dateFormat = 'YYYY-MM-DD',
|
||||
@@ -94,7 +94,7 @@ class DateTime
|
||||
string $string,
|
||||
?string $format = null,
|
||||
?string $language = null
|
||||
): ?string {
|
||||
): string {
|
||||
|
||||
$dateTime = DateTimeStd::createFromFormat('Y-m-d', $string);
|
||||
|
||||
|
||||
@@ -978,6 +978,7 @@ class Manager
|
||||
*/
|
||||
public function getDirName(string $path, bool $isFullPath = true, bool $useIsDir = true): string
|
||||
{
|
||||
/** @var string */
|
||||
$dirName = preg_replace('/\/$/i', '', $path);
|
||||
|
||||
$dirName = ($useIsDir && is_dir($dirName)) ?
|
||||
@@ -1159,6 +1160,7 @@ class Manager
|
||||
$basePath .= $dirSeparator;
|
||||
}
|
||||
|
||||
/** @var string */
|
||||
return preg_replace('/^'. preg_quote($basePath, $dirSeparator) . '/', '', $path);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ use Espo\Core\Exceptions\Error;
|
||||
|
||||
class ZipArchive
|
||||
{
|
||||
private $fileManager;
|
||||
private Manager $fileManager;
|
||||
|
||||
public function __construct(Manager $fileManager = null)
|
||||
public function __construct(?Manager $fileManager = null)
|
||||
{
|
||||
if (!isset($fileManager)) {
|
||||
if ($fileManager === null) {
|
||||
$fileManager = new Manager();
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class Language
|
||||
*/
|
||||
private $changedData = [];
|
||||
|
||||
private ?string $currentLanguage = null;
|
||||
private string $currentLanguage;
|
||||
|
||||
protected string $defaultLanguage = 'en_US';
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ class Layout
|
||||
|
||||
protected function sanitizeInput(string $name): string
|
||||
{
|
||||
/** @var string */
|
||||
return preg_replace("([\.]{2,})", '', $name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +145,8 @@ class Metadata
|
||||
$this->init();
|
||||
}
|
||||
|
||||
assert($this->data !== null);
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
@@ -175,6 +177,8 @@ class Metadata
|
||||
$this->init($reload);
|
||||
}
|
||||
|
||||
assert($this->data !== null);
|
||||
|
||||
if ($isJSON) {
|
||||
return Json::encode($this->data);
|
||||
}
|
||||
@@ -212,6 +216,8 @@ class Metadata
|
||||
$this->objInit($reload);
|
||||
}
|
||||
|
||||
assert($this->objData !== null);
|
||||
|
||||
return $this->objData;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,6 +101,8 @@ class Module
|
||||
$this->init();
|
||||
}
|
||||
|
||||
assert($this->data !== null);
|
||||
|
||||
if ($key === null) {
|
||||
return $this->data;
|
||||
}
|
||||
@@ -110,7 +112,11 @@ class Module
|
||||
|
||||
private function init(): void
|
||||
{
|
||||
if ($this->useCache && $this->dataCache->has($this->cacheKey)) {
|
||||
if (
|
||||
$this->useCache &&
|
||||
$this->dataCache &&
|
||||
$this->dataCache->has($this->cacheKey)
|
||||
) {
|
||||
/** @var array<string,array<string,mixed>> */
|
||||
$data = $this->dataCache->get($this->cacheKey);
|
||||
|
||||
@@ -121,7 +127,7 @@ class Module
|
||||
|
||||
$this->data = $this->loadData();
|
||||
|
||||
if ($this->useCache) {
|
||||
if ($this->useCache && $this->dataCache) {
|
||||
$this->dataCache->store($this->cacheKey, $this->data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user