Skip to content
Draft

6.x #4124

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^8.2",
"craftcms/cms": "^5.6.0",
"php": "^8.5",
"craftcms/cms": "6.x-dev",
"dompdf/dompdf": "^2.0.2",
"ibericode/vat": "^1.2.2",
"iio/libmergepdf": "^4.0",
Expand All @@ -35,8 +35,6 @@
"codeception/module-phpbrowser": "^3.0.0",
"codeception/module-rest": "^3.3.2",
"codeception/module-yii2": "^1.1.9",
"craftcms/ckeditor": "^4.0.0",
"craftcms/redactor": "*",
"craftcms/ecs": "dev-main",
"craftcms/phpstan": "dev-main",
"fakerphp/faker": "^1.19.0",
Expand Down
11,292 changes: 6,748 additions & 4,544 deletions composer.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
use craft\elements\Address;
use craft\elements\db\UserQuery;
use craft\elements\User as UserElement;
use craft\enums\CmsEdition;
use CraftCms\Cms\Edition as CmsEdition;
use craft\events\DefineBehaviorsEvent;
use craft\events\DefineConsoleActionsEvent;
use craft\events\DefineEditUserScreensEvent;
Expand Down Expand Up @@ -167,6 +167,7 @@
use craft\utilities\ClearCaches;
use craft\web\Application;
use craft\web\twig\variables\CraftVariable;
use CraftCms\Cms\Updates\Updates;
use Exception;
use Illuminate\Support\Collection;
use yii\base\Event;
Expand Down Expand Up @@ -822,7 +823,7 @@ function(DefineBehaviorsEvent $event) {
});

// Don't attach behavior if Craft is in the middle of an update
if (!Craft::$app->getUpdates()->getIsCraftUpdatePending()) {
if (! app(Updates::class)->isCraftUpdatePending()) {
// Site models are instantiated early meaning we have to manually attach the behavior alongside using the event
$sites = Craft::$app->getSites()->getAllSites(true);
foreach ($sites as $site) {
Expand Down
8 changes: 4 additions & 4 deletions src/elements/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -1370,31 +1370,31 @@ public function __toString(): string
/**
* @inheritdoc
*/
public function canSave(User $user): bool
public function canSave(\CraftCms\Cms\User\Elements\User $user): bool
{
return parent::canSave($user) || $user->can('commerce-editOrders');
}

/**
* @inheritdoc
*/
public function canView(User $user): bool
public function canView(\CraftCms\Cms\User\Elements\User $user): bool
{
return parent::canView($user) || $user->can('commerce-manageOrders');
}

/**
* @inheritdoc
*/
public function canDuplicate(User $user): bool
public function canDuplicate(\CraftCms\Cms\User\Elements\User $user): bool
{
return false;
}

/**
* @inheritdoc
*/
public function canDelete(User $user): bool
public function canDelete(\CraftCms\Cms\User\Elements\User $user): bool
{
return parent::canDelete($user) || $user->can('commerce-deleteOrders');
}
Expand Down
12 changes: 6 additions & 6 deletions src/elements/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ public function getDefaultPrice(): ?float
return $this->_defaultPrice ?? $this->getDefaultVariant()?->price;
}

public function canCreateDrafts(User $user): bool
public function canCreateDrafts(\CraftCms\Cms\User\Elements\User $user): bool
{
// Everyone with view permissions can create drafts
return true;
Expand Down Expand Up @@ -926,7 +926,7 @@ public function __toString(): string
/**
* @inheritdoc
*/
public function canView(User $user): bool
public function canView(\CraftCms\Cms\User\Elements\User $user): bool
{
if (parent::canView($user)) {
return true;
Expand All @@ -944,7 +944,7 @@ public function canView(User $user): bool
/**
* @inheritdoc
*/
public function canSave(User $user): bool
public function canSave(\CraftCms\Cms\User\Elements\User $user): bool
{
if (parent::canSave($user)) {
return true;
Expand All @@ -962,7 +962,7 @@ public function canSave(User $user): bool
/**
* @inheritdoc
*/
public function canDuplicate(User $user): bool
public function canDuplicate(\CraftCms\Cms\User\Elements\User $user): bool
{
if (parent::canDuplicate($user)) {
return true;
Expand All @@ -980,7 +980,7 @@ public function canDuplicate(User $user): bool
/**
* @inheritdoc
*/
public function canDelete(User $user): bool
public function canDelete(\CraftCms\Cms\User\Elements\User $user): bool
{
if (parent::canDelete($user)) {
return true;
Expand All @@ -998,7 +998,7 @@ public function canDelete(User $user): bool
/**
* @inheritdoc
*/
public function canDeleteForSite(User $user): bool
public function canDeleteForSite(\CraftCms\Cms\User\Elements\User $user): bool
{
return Craft::$app->getElements()->canDelete($this, $user);
}
Expand Down
4 changes: 2 additions & 2 deletions src/elements/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ public function __toString(): string
return Craft::t('commerce', 'Subscription to “{plan}”', ['plan' => $plan->name ?? '']);
}

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

public function canSave(User $user): bool
public function canSave(\CraftCms\Cms\User\Elements\User $user): bool
{
return parent::canView($user) || $user->can('commerce-manageSubscriptions');
}
Expand Down
14 changes: 7 additions & 7 deletions src/elements/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ protected function route(): array|string|null
/**
* @inheritdoc
*/
public function canView(User $user): bool
public function canView(\CraftCms\Cms\User\Elements\User $user): bool
{
if (parent::canView($user)) {
return true;
Expand All @@ -543,7 +543,7 @@ public function canView(User $user): bool
/**
* @inheritdoc
*/
public function canSave(User $user): bool
public function canSave(\CraftCms\Cms\User\Elements\User $user): bool
{
if (parent::canSave($user)) {
return true;
Expand All @@ -555,15 +555,15 @@ public function canSave(User $user): bool
/**
* @inheritdoc
*/
public function canDuplicate(User $user): bool
public function canDuplicate(\CraftCms\Cms\User\Elements\User $user): bool
{
return false;
}

/**
* @inheritdoc
*/
public function canDelete(User $user): bool
public function canDelete(\CraftCms\Cms\User\Elements\User $user): bool
{
$canDelete = false;

Expand All @@ -581,7 +581,7 @@ public function canDelete(User $user): bool
/**
* @inheritdoc
*/
public function canCreateDrafts(User $user): bool
public function canCreateDrafts(\CraftCms\Cms\User\Elements\User $user): bool
{
return false;
}
Expand All @@ -605,7 +605,7 @@ public function getPostEditUrl(): ?string
/**
* @inheritdoc
*/
public function prepareEditScreen(Response $response, string $containerId): void
public function prepareEditScreen(Response|\CraftCms\Cms\Http\Responses\CpScreenResponse $response, string $containerId): void
{
$view = Craft::$app->getView();
$view->registerAssetBundle(TransfersAsset::class);
Expand Down Expand Up @@ -743,7 +743,7 @@ public function getFieldLayout(): ?FieldLayout
/**
* @inheritdoc
*/
public function beforeValidate()
public function beforeValidate(): bool
{
if ($this->transferStatus === null) {
$this->transferStatus = TransferStatusType::DRAFT;
Expand Down
12 changes: 6 additions & 6 deletions src/elements/Variant.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function behaviors(): array
return $behaviors;
}

public function safeAttributes()
public function safeAttributes(): array
{
$attributes = parent::safeAttributes();
$attributes[] = 'productId';
Expand Down Expand Up @@ -324,7 +324,7 @@ public function getTitleTranslationKey(): string
/**
* @inheritdoc
*/
public function canSave(User $user): bool
public function canSave(\CraftCms\Cms\User\Elements\User $user): bool
{
if (parent::canSave($user)) {
return true;
Expand All @@ -341,15 +341,15 @@ public function canSave(User $user): bool
/**
* @inheritdoc
*/
public function canCopy(User $user): bool
public function canCopy(\CraftCms\Cms\User\Elements\User $user): bool
{
return true;
}

/**
* @inheritdoc
*/
public function canDelete(User $user): bool
public function canDelete(\CraftCms\Cms\User\Elements\User $user): bool
{
if (parent::canDelete($user)) {
return true;
Expand Down Expand Up @@ -382,7 +382,7 @@ public function setDeletedWithProduct($value): void
/**
* @inheritdoc
*/
public function canDuplicate(User $user): bool
public function canDuplicate(\CraftCms\Cms\User\Elements\User $user): bool
{
if (parent::canDuplicate($user)) {
return true;
Expand Down Expand Up @@ -733,7 +733,7 @@ protected function cacheTags(): array
/**
* @inheritdoc
*/
public function canView(User $user): bool
public function canView(\CraftCms\Cms\User\Elements\User $user): bool
{
if (parent::canView($user)) {
return true;
Expand Down
Loading