fix errors in Object namespace

This commit is contained in:
Art4 2024-11-17 21:43:06 +00:00
parent 9638113244
commit 36484309d1
2 changed files with 8 additions and 7 deletions

View file

@ -62,7 +62,7 @@ class User extends BaseDataTransferObject
protected $default_profile; protected $default_profile;
/** @var bool */ /** @var bool */
protected $default_profile_image; protected $default_profile_image;
/** @var Status */ /** @var array */
protected $status; protected $status;
/** @var array */ /** @var array */
protected $withheld_in_countries; protected $withheld_in_countries;
@ -117,12 +117,12 @@ class User extends BaseDataTransferObject
* @param array $publicContact Full contact table record with uid = 0 * @param array $publicContact Full contact table record with uid = 0
* @param array $apcontact Optional full apcontact table record * @param array $apcontact Optional full apcontact table record
* @param array $userContact Optional full contact table record with uid != 0 * @param array $userContact Optional full contact table record with uid != 0
* @param null $status * @param array $status
* @param bool $include_user_entities Whether to add the entities property * @param bool $include_user_entities Whether to add the entities property
* *
* @throws InternalServerErrorException * @throws InternalServerErrorException
*/ */
public function __construct(array $publicContact, array $apcontact = [], array $userContact = [], $status = null, bool $include_user_entities = true) public function __construct(array $publicContact, array $apcontact = [], array $userContact = [], ?array $status = null, bool $include_user_entities = true)
{ {
$uid = $userContact['uid'] ?? 0; $uid = $userContact['uid'] ?? 0;
@ -156,7 +156,7 @@ class User extends BaseDataTransferObject
$this->default_profile = false; $this->default_profile = false;
$this->default_profile_image = false; $this->default_profile_image = false;
if (!empty($status)) { if (is_array($status)) {
$this->status = $status; $this->status = $status;
} else { } else {
unset($this->status); unset($this->status);

View file

@ -771,7 +771,7 @@ class Image
public function getBlurHash(): string public function getBlurHash(): string
{ {
$image = New Image($this->asString(), $this->getType(), $this->filename, false); $image = New Image($this->asString(), $this->getType(), $this->filename, false);
if (empty($image) || !$this->isValid()) { if (!$this->isValid()) {
return ''; return '';
} }
@ -827,6 +827,7 @@ class Image
{ {
$scaled = Images::getScalingDimensions($width, $height, 90); $scaled = Images::getScalingDimensions($width, $height, 90);
$pixels = Blurhash::decode($blurhash, $scaled['width'], $scaled['height']); $pixels = Blurhash::decode($blurhash, $scaled['width'], $scaled['height']);
$draw = null;
if ($this->isImagick()) { if ($this->isImagick()) {
$this->image = new Imagick(); $this->image = new Imagick();
@ -839,7 +840,7 @@ class Image
for ($y = 0; $y < $scaled['height']; ++$y) { for ($y = 0; $y < $scaled['height']; ++$y) {
for ($x = 0; $x < $scaled['width']; ++$x) { for ($x = 0; $x < $scaled['width']; ++$x) {
[$r, $g, $b] = $pixels[$y][$x]; [$r, $g, $b] = $pixels[$y][$x];
if ($this->isImagick()) { if ($draw !== null) {
$draw->setFillColor("rgb($r, $g, $b)"); $draw->setFillColor("rgb($r, $g, $b)");
$draw->point($x, $y); $draw->point($x, $y);
} else { } else {
@ -848,7 +849,7 @@ class Image
} }
} }
if ($this->isImagick()) { if ($draw !== null) {
$this->image->drawImage($draw); $this->image->drawImage($draw);
$this->width = $this->image->getImageWidth(); $this->width = $this->image->getImageWidth();
$this->height = $this->image->getImageHeight(); $this->height = $this->image->getImageHeight();