Fix null param value on PHP 8.1 (#6000)

This commit is contained in:
Yuriy Bakhtin 2022-12-30 15:14:13 +04:00 committed by GitHub
parent 2e3e3d92ba
commit 13ab5a3dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,7 +176,7 @@ class Birthday extends BaseType
public function getUserValue(User $user, $raw = true): ?string public function getUserValue(User $user, $raw = true): ?string
{ {
$internalName = $this->profileField->internal_name; $internalName = $this->profileField->internal_name;
$birthdayDate = \DateTime::createFromFormat('Y-m-d', $user->profile->$internalName, $birthdayDate = \DateTime::createFromFormat('Y-m-d', $user->profile->$internalName ?? '',
new \DateTimeZone(Yii::$app->formatter->timeZone)); new \DateTimeZone(Yii::$app->formatter->timeZone));
$internalNameHideAge = $this->profileField->internal_name . '_hide_year'; $internalNameHideAge = $this->profileField->internal_name . '_hide_year';