diff --git a/src/Object/Api/Twitter/User.php b/src/Object/Api/Twitter/User.php index ba376263c1..7a3a2b4622 100644 --- a/src/Object/Api/Twitter/User.php +++ b/src/Object/Api/Twitter/User.php @@ -62,7 +62,7 @@ class User extends BaseDataTransferObject protected $default_profile; /** @var bool */ protected $default_profile_image; - /** @var Status */ + /** @var array */ protected $status; /** @var array */ protected $withheld_in_countries; @@ -117,12 +117,12 @@ class User extends BaseDataTransferObject * @param array $publicContact Full contact table record with uid = 0 * @param array $apcontact Optional full apcontact table record * @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 * * @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; @@ -156,7 +156,7 @@ class User extends BaseDataTransferObject $this->default_profile = false; $this->default_profile_image = false; - if (!empty($status)) { + if (is_array($status)) { $this->status = $status; } else { unset($this->status); diff --git a/src/Object/Image.php b/src/Object/Image.php index 256de2f284..8a06b37fbd 100644 --- a/src/Object/Image.php +++ b/src/Object/Image.php @@ -771,7 +771,7 @@ class Image public function getBlurHash(): string { $image = New Image($this->asString(), $this->getType(), $this->filename, false); - if (empty($image) || !$this->isValid()) { + if (!$this->isValid()) { return ''; } @@ -827,6 +827,7 @@ class Image { $scaled = Images::getScalingDimensions($width, $height, 90); $pixels = Blurhash::decode($blurhash, $scaled['width'], $scaled['height']); + $draw = null; if ($this->isImagick()) { $this->image = new Imagick(); @@ -839,7 +840,7 @@ class Image for ($y = 0; $y < $scaled['height']; ++$y) { for ($x = 0; $x < $scaled['width']; ++$x) { [$r, $g, $b] = $pixels[$y][$x]; - if ($this->isImagick()) { + if ($draw !== null) { $draw->setFillColor("rgb($r, $g, $b)"); $draw->point($x, $y); } else { @@ -848,7 +849,7 @@ class Image } } - if ($this->isImagick()) { + if ($draw !== null) { $this->image->drawImage($draw); $this->width = $this->image->getImageWidth(); $this->height = $this->image->getImageHeight();