type fixes
This commit is contained in:
@@ -204,6 +204,7 @@ class Login implements LoginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param non-empty-string $endpoint
|
||||
* @return array{?string, ?Result, ?string}
|
||||
*/
|
||||
private function requestToken(
|
||||
|
||||
@@ -463,6 +463,9 @@ class Upgrade implements Command
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param non-empty-string $url
|
||||
*/
|
||||
private function downloadFile(string $url): ?string
|
||||
{
|
||||
$localFilePath = 'data/upload/upgrades/' . Util::generateId() . '.zip';
|
||||
@@ -472,8 +475,16 @@ class Upgrade implements Command
|
||||
if (is_file($url)) {
|
||||
copy($url, $localFilePath);
|
||||
} else {
|
||||
$fp = fopen($localFilePath, 'w');
|
||||
|
||||
if ($fp === false) {
|
||||
echo "\nCould not open local file for writing.\n";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$options = [
|
||||
CURLOPT_FILE => fopen($localFilePath, 'w'),
|
||||
CURLOPT_FILE => $fp,
|
||||
CURLOPT_TIMEOUT => 3600,
|
||||
CURLOPT_URL => $url,
|
||||
];
|
||||
@@ -481,9 +492,7 @@ class Upgrade implements Command
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt_array($ch, $options);
|
||||
|
||||
curl_exec($ch);
|
||||
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ abstract class OAuth2Abstract implements IClient
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return non-empty-string
|
||||
*/
|
||||
protected function getPingUrl()
|
||||
{
|
||||
@@ -404,9 +404,9 @@ abstract class OAuth2Abstract implements IClient
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
* @param non-empty-string $url
|
||||
* @param array<string, mixed>|string|null $params
|
||||
* @param string $httpMethod
|
||||
* @param non-empty-string $httpMethod
|
||||
* @param ?string $contentType
|
||||
* @param bool $allowRenew
|
||||
* @return mixed
|
||||
|
||||
@@ -213,9 +213,9 @@ class Client
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
* @param non-empty-string $url
|
||||
* @param array<string, mixed>|string|null $params
|
||||
* @param string $httpMethod
|
||||
* @param non-empty-string $httpMethod
|
||||
* @param array<string, string> $httpHeaders
|
||||
* @return array{
|
||||
* result: array<string, mixed>|string,
|
||||
@@ -262,9 +262,9 @@ class Client
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
* @param non-empty-string $url
|
||||
* @param array<string, mixed>|string|null $params
|
||||
* @param string $httpMethod
|
||||
* @param non-empty-string $httpMethod
|
||||
* @param array<string, string> $httpHeaders
|
||||
* @return array{
|
||||
* result: array<string, mixed>|string,
|
||||
@@ -302,7 +302,9 @@ class Client
|
||||
$postFields = $params;
|
||||
}
|
||||
|
||||
$curlOptions[CURLOPT_POSTFIELDS] = $postFields;
|
||||
if ($postFields !== '' && $postFields !== null) {
|
||||
$curlOptions[CURLOPT_POSTFIELDS] = $postFields;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -403,7 +405,7 @@ class Client
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
* @param non-empty-string $url
|
||||
* @param string $grantType
|
||||
* @param array{
|
||||
* client_id?: string,
|
||||
|
||||
@@ -177,7 +177,7 @@ class Processor
|
||||
$evaluatedArguments = new EvaluatedArgumentList($rawEvaluatedArguments);
|
||||
|
||||
if ($function instanceof FuncVariablesAware) {
|
||||
$variables = new Variables($this->variables ?? (object) []);
|
||||
$variables = new Variables($this->variables);
|
||||
|
||||
return $function->process($evaluatedArguments, $variables);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,6 @@ class SearchParams
|
||||
* With a primary filter.
|
||||
*
|
||||
* @param string|null $primaryFilter
|
||||
* @return $this
|
||||
*/
|
||||
public function withPrimaryFilter(?string $primaryFilter): self
|
||||
{
|
||||
|
||||
@@ -135,6 +135,7 @@ class Converter
|
||||
$this->entityDefs = $this->metadata->get('entityDefs');
|
||||
}
|
||||
|
||||
/** @var array<string, mixed> */
|
||||
return $this->entityDefs;
|
||||
}
|
||||
|
||||
|
||||
@@ -237,8 +237,9 @@ class Permission
|
||||
$pKey = $rule[$count];
|
||||
}
|
||||
|
||||
/** @phpstan-ignore-next-line empty.variable */
|
||||
if (!empty($pKey)) {
|
||||
$permission[$pKey]= $val;
|
||||
$permission[$pKey] = $val;
|
||||
}
|
||||
|
||||
$count++;
|
||||
|
||||
@@ -890,14 +890,14 @@ class Util
|
||||
/**
|
||||
* Sanitize HTML code.
|
||||
*
|
||||
* @param string|string[] $text A source.
|
||||
* @param string|array<string|int, mixed> $text A source.
|
||||
* @param string[] $permittedHtmlTags Allows only HTML tags without parameters like <p></p>, <br>, etc.
|
||||
* @return string|string[]
|
||||
* @return string|array<string|int, mixed>
|
||||
*/
|
||||
public static function sanitizeHtml($text, $permittedHtmlTags = ['p', 'br', 'b', 'strong', 'pre'])
|
||||
{
|
||||
if (is_array($text)) {
|
||||
foreach ($text as $key => &$value) {
|
||||
foreach ($text as &$value) {
|
||||
$value = self::sanitizeHtml($value, $permittedHtmlTags);
|
||||
}
|
||||
|
||||
|
||||
@@ -391,7 +391,7 @@ class Image implements EntryPoint
|
||||
$orientation = $this->getOrientation($filePath);
|
||||
|
||||
if ($orientation) {
|
||||
$angle = [0, 0, 0, 180, 0, 0, -90, 0, 90][$orientation];
|
||||
$angle = [0, 0, 0, 180, 0, 0, -90, 0, 90][$orientation] ?? 0;
|
||||
|
||||
$targetImage = imagerotate($targetImage, $angle, 0) ?: $targetImage;
|
||||
}
|
||||
|
||||
@@ -2053,7 +2053,7 @@ abstract class BaseQueryComposer implements QueryComposer
|
||||
|
||||
/**
|
||||
* @param string[]|array<string[]> $select
|
||||
* @param string[] $explicitJoins
|
||||
* @param string[]|array<int, mixed>[] $explicitJoins
|
||||
* @param array<string, mixed> $params
|
||||
*/
|
||||
protected function getBelongsToJoinsPart(
|
||||
|
||||
@@ -66,6 +66,7 @@ class UploadUrlService
|
||||
/**
|
||||
* Upload an image from and URL and store as attachment.
|
||||
*
|
||||
* @param non-empty-string $url
|
||||
* @throws Forbidden
|
||||
* @throws Error
|
||||
*/
|
||||
@@ -111,7 +112,7 @@ class UploadUrlService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
* @param non-empty-string $url
|
||||
* @return ?array{string, string} A type and contents.
|
||||
*/
|
||||
private function getImageDataByUrl(string $url): ?array
|
||||
@@ -127,7 +128,7 @@ class UploadUrlService
|
||||
$httpHeaders = [];
|
||||
$httpHeaders[] = 'Expect:';
|
||||
|
||||
$opts[\CURLOPT_URL] = $url;
|
||||
$opts[\CURLOPT_URL] = $url;
|
||||
$opts[\CURLOPT_HTTPHEADER] = $httpHeaders;
|
||||
$opts[\CURLOPT_CONNECTTIMEOUT] = 10;
|
||||
$opts[\CURLOPT_TIMEOUT] = 10;
|
||||
|
||||
@@ -36,6 +36,7 @@ use Espo\Tools\WorkingTime\Calendar\HavingRanges;
|
||||
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Field\Date;
|
||||
use LogicException;
|
||||
|
||||
class Extractor
|
||||
{
|
||||
@@ -108,7 +109,7 @@ class Extractor
|
||||
}
|
||||
|
||||
for ($i = count($list) - 1; $i >= 0; $i--) {
|
||||
$pair = $list[$i];
|
||||
$pair = $list[$i] ?? throw new LogicException();
|
||||
|
||||
if ($to->isGreaterThan($pair[1]) || $to->isEqualTo($pair[1])) {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user