Skip to content

Commit 3e078c9

Browse files
committed
Fix method signatures
1 parent 36d2838 commit 3e078c9

5 files changed

Lines changed: 25 additions & 25 deletions

File tree

src/elements/Order.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,31 +1370,31 @@ public function __toString(): string
13701370
/**
13711371
* @inheritdoc
13721372
*/
1373-
public function canSave(User $user): bool
1373+
public function canSave(\CraftCms\Cms\User\Elements\User $user): bool
13741374
{
13751375
return parent::canSave($user) || $user->can('commerce-editOrders');
13761376
}
13771377

13781378
/**
13791379
* @inheritdoc
13801380
*/
1381-
public function canView(User $user): bool
1381+
public function canView(\CraftCms\Cms\User\Elements\User $user): bool
13821382
{
13831383
return parent::canView($user) || $user->can('commerce-manageOrders');
13841384
}
13851385

13861386
/**
13871387
* @inheritdoc
13881388
*/
1389-
public function canDuplicate(User $user): bool
1389+
public function canDuplicate(\CraftCms\Cms\User\Elements\User $user): bool
13901390
{
13911391
return false;
13921392
}
13931393

13941394
/**
13951395
* @inheritdoc
13961396
*/
1397-
public function canDelete(User $user): bool
1397+
public function canDelete(\CraftCms\Cms\User\Elements\User $user): bool
13981398
{
13991399
return parent::canDelete($user) || $user->can('commerce-deleteOrders');
14001400
}

src/elements/Product.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ public function getDefaultPrice(): ?float
835835
return $this->_defaultPrice ?? $this->getDefaultVariant()?->price;
836836
}
837837

838-
public function canCreateDrafts(User $user): bool
838+
public function canCreateDrafts(\CraftCms\Cms\User\Elements\User $user): bool
839839
{
840840
// Everyone with view permissions can create drafts
841841
return true;
@@ -926,7 +926,7 @@ public function __toString(): string
926926
/**
927927
* @inheritdoc
928928
*/
929-
public function canView(User $user): bool
929+
public function canView(\CraftCms\Cms\User\Elements\User $user): bool
930930
{
931931
if (parent::canView($user)) {
932932
return true;
@@ -944,7 +944,7 @@ public function canView(User $user): bool
944944
/**
945945
* @inheritdoc
946946
*/
947-
public function canSave(User $user): bool
947+
public function canSave(\CraftCms\Cms\User\Elements\User $user): bool
948948
{
949949
if (parent::canSave($user)) {
950950
return true;
@@ -962,7 +962,7 @@ public function canSave(User $user): bool
962962
/**
963963
* @inheritdoc
964964
*/
965-
public function canDuplicate(User $user): bool
965+
public function canDuplicate(\CraftCms\Cms\User\Elements\User $user): bool
966966
{
967967
if (parent::canDuplicate($user)) {
968968
return true;
@@ -980,7 +980,7 @@ public function canDuplicate(User $user): bool
980980
/**
981981
* @inheritdoc
982982
*/
983-
public function canDelete(User $user): bool
983+
public function canDelete(\CraftCms\Cms\User\Elements\User $user): bool
984984
{
985985
if (parent::canDelete($user)) {
986986
return true;
@@ -998,7 +998,7 @@ public function canDelete(User $user): bool
998998
/**
999999
* @inheritdoc
10001000
*/
1001-
public function canDeleteForSite(User $user): bool
1001+
public function canDeleteForSite(\CraftCms\Cms\User\Elements\User $user): bool
10021002
{
10031003
return Craft::$app->getElements()->canDelete($this, $user);
10041004
}

src/elements/Subscription.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ public function __toString(): string
210210
return Craft::t('commerce', 'Subscription to “{plan}”', ['plan' => $plan->name ?? '']);
211211
}
212212

213-
public function canView(User $user): bool
213+
public function canView(\CraftCms\Cms\User\Elements\User $user): bool
214214
{
215215
return parent::canView($user) || $user->can('commerce-manageSubscriptions');
216216
}
217217

218-
public function canSave(User $user): bool
218+
public function canSave(\CraftCms\Cms\User\Elements\User $user): bool
219219
{
220220
return parent::canView($user) || $user->can('commerce-manageSubscriptions');
221221
}

src/elements/Transfer.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ protected function route(): array|string|null
531531
/**
532532
* @inheritdoc
533533
*/
534-
public function canView(User $user): bool
534+
public function canView(\CraftCms\Cms\User\Elements\User $user): bool
535535
{
536536
if (parent::canView($user)) {
537537
return true;
@@ -543,7 +543,7 @@ public function canView(User $user): bool
543543
/**
544544
* @inheritdoc
545545
*/
546-
public function canSave(User $user): bool
546+
public function canSave(\CraftCms\Cms\User\Elements\User $user): bool
547547
{
548548
if (parent::canSave($user)) {
549549
return true;
@@ -555,15 +555,15 @@ public function canSave(User $user): bool
555555
/**
556556
* @inheritdoc
557557
*/
558-
public function canDuplicate(User $user): bool
558+
public function canDuplicate(\CraftCms\Cms\User\Elements\User $user): bool
559559
{
560560
return false;
561561
}
562562

563563
/**
564564
* @inheritdoc
565565
*/
566-
public function canDelete(User $user): bool
566+
public function canDelete(\CraftCms\Cms\User\Elements\User $user): bool
567567
{
568568
$canDelete = false;
569569

@@ -581,7 +581,7 @@ public function canDelete(User $user): bool
581581
/**
582582
* @inheritdoc
583583
*/
584-
public function canCreateDrafts(User $user): bool
584+
public function canCreateDrafts(\CraftCms\Cms\User\Elements\User $user): bool
585585
{
586586
return false;
587587
}
@@ -605,7 +605,7 @@ public function getPostEditUrl(): ?string
605605
/**
606606
* @inheritdoc
607607
*/
608-
public function prepareEditScreen(Response $response, string $containerId): void
608+
public function prepareEditScreen(Response|\CraftCms\Cms\Http\Responses\CpScreenResponse $response, string $containerId): void
609609
{
610610
$view = Craft::$app->getView();
611611
$view->registerAssetBundle(TransfersAsset::class);
@@ -743,7 +743,7 @@ public function getFieldLayout(): ?FieldLayout
743743
/**
744744
* @inheritdoc
745745
*/
746-
public function beforeValidate()
746+
public function beforeValidate(): bool
747747
{
748748
if ($this->transferStatus === null) {
749749
$this->transferStatus = TransferStatusType::DRAFT;

src/elements/Variant.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public function behaviors(): array
239239
return $behaviors;
240240
}
241241

242-
public function safeAttributes()
242+
public function safeAttributes(): array
243243
{
244244
$attributes = parent::safeAttributes();
245245
$attributes[] = 'productId';
@@ -324,7 +324,7 @@ public function getTitleTranslationKey(): string
324324
/**
325325
* @inheritdoc
326326
*/
327-
public function canSave(User $user): bool
327+
public function canSave(\CraftCms\Cms\User\Elements\User $user): bool
328328
{
329329
if (parent::canSave($user)) {
330330
return true;
@@ -341,15 +341,15 @@ public function canSave(User $user): bool
341341
/**
342342
* @inheritdoc
343343
*/
344-
public function canCopy(User $user): bool
344+
public function canCopy(\CraftCms\Cms\User\Elements\User $user): bool
345345
{
346346
return true;
347347
}
348348

349349
/**
350350
* @inheritdoc
351351
*/
352-
public function canDelete(User $user): bool
352+
public function canDelete(\CraftCms\Cms\User\Elements\User $user): bool
353353
{
354354
if (parent::canDelete($user)) {
355355
return true;
@@ -382,7 +382,7 @@ public function setDeletedWithProduct($value): void
382382
/**
383383
* @inheritdoc
384384
*/
385-
public function canDuplicate(User $user): bool
385+
public function canDuplicate(\CraftCms\Cms\User\Elements\User $user): bool
386386
{
387387
if (parent::canDuplicate($user)) {
388388
return true;
@@ -733,7 +733,7 @@ protected function cacheTags(): array
733733
/**
734734
* @inheritdoc
735735
*/
736-
public function canView(User $user): bool
736+
public function canView(\CraftCms\Cms\User\Elements\User $user): bool
737737
{
738738
if (parent::canView($user)) {
739739
return true;

0 commit comments

Comments
 (0)