mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-01-11 15:28:40 +00:00
fix phpstan lvl 9 bugs
This commit is contained in:
parent
d7116a66ab
commit
d9e2804ab7
|
|
@ -224,8 +224,17 @@ final class ApiController extends Controller
|
|||
return;
|
||||
}
|
||||
|
||||
/** @var Profile $profile */
|
||||
$profile = (int) ($request->getData('profile') ?? ProfileMapper::get()->where('account', $request->getData('account'))->execute()->getId());
|
||||
$profile = 0;
|
||||
if ($request->hasData('profile')) {
|
||||
$profile = (int) ($request->getData('profile') ?? 0);
|
||||
} else {
|
||||
/** @var \Modules\Profile\Models\Profile $profileObj */
|
||||
$profileObj = ProfileMapper::get()
|
||||
->where('account', (int) ($request->getData('account') ?? 0))
|
||||
->execute();
|
||||
|
||||
$profile = $profileObj->getId();
|
||||
}
|
||||
|
||||
$contactElement = $this->createContactElementFromRequest($request);
|
||||
|
||||
|
|
@ -298,8 +307,17 @@ final class ApiController extends Controller
|
|||
return;
|
||||
}
|
||||
|
||||
/** @var Profile $profile */
|
||||
$profile = (int) ($request->getData('profile') ?? ProfileMapper::get()->where('account', $request->getData('account'))->execute()->getId());
|
||||
$profile = 0;
|
||||
if ($request->hasData('profile')) {
|
||||
$profile = (int) ($request->getData('profile') ?? 0);
|
||||
} else {
|
||||
/** @var \Modules\Profile\Models\Profile $profileObj */
|
||||
$profileObj = ProfileMapper::get()
|
||||
->where('account', (int) ($request->getData('account') ?? 0))
|
||||
->execute();
|
||||
|
||||
$profile = $profileObj->getId();
|
||||
}
|
||||
|
||||
$address = $this->createAddressFromRequest($request);
|
||||
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ final class BackendController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
/** @var \Model\Setting $profileImage */
|
||||
$profileImage = $this->app->appSettings->get(names: SettingsEnum::DEFAULT_PROFILE_IMAGE, module: 'Profile');
|
||||
|
||||
/** @var \Modules\Media\Models\Media $image */
|
||||
|
|
@ -172,8 +173,11 @@ final class BackendController extends Controller
|
|||
|
||||
$view->setData('media', $media);
|
||||
|
||||
/** @var \Model\Setting $profileImage */
|
||||
$profileImage = $this->app->appSettings->get(names: SettingsEnum::DEFAULT_PROFILE_IMAGE, module: 'Profile');
|
||||
$image = MediaMapper::get()->where('id', (int) $profileImage->content)->execute();
|
||||
|
||||
/** @var \Modules\Media\Models\Media $image */
|
||||
$image = MediaMapper::get()->where('id', (int) $profileImage->content)->execute();
|
||||
|
||||
$view->setData('defaultImage', $image);
|
||||
|
||||
|
|
|
|||
|
|
@ -95,10 +95,13 @@ class BaseView extends View
|
|||
*/
|
||||
public function render(mixed ...$data) : string
|
||||
{
|
||||
/** @var array{0:string, 1:string, 2:null|bool} $data */
|
||||
$this->id = $data[0];
|
||||
$this->name = $data[1];
|
||||
$this->isRequired = $data[2] ?? false;
|
||||
|
||||
$this->getData('popup')->setId($this->id);
|
||||
|
||||
return parent::render();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ class PopupView extends View
|
|||
*/
|
||||
public function render(mixed ...$data) : string
|
||||
{
|
||||
/** @var array{0: null|string} $data */
|
||||
$this->id = $data[0] ?? $this->id;
|
||||
return parent::render();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user