Skip to content

Commit

Permalink
Fix formatting and code style
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeholder committed Jul 11, 2023
1 parent 964bab3 commit 1003bab
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 4 additions & 6 deletions src/elements/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
use craft\commerce\records\Transaction as TransactionRecord;
use craft\commerce\validators\StoreCountryValidator;
use craft\db\Query;
use craft\elements\Address;
use craft\elements\Address as AddressElement;
use craft\elements\Address as AddressElement;
use craft\elements\User;
use craft\errors\ElementNotFoundException;
Expand Down Expand Up @@ -2873,7 +2871,7 @@ public function getAdjustmentsTotal(): float
public function getShippingAddress(): ?AddressElement
{
if (!isset($this->_shippingAddress) && $this->shippingAddressId) {
/** @var Address|null $address */
/** @var AddressElement|null $address */
$address = AddressElement::find()->ownerId($this->id)->id($this->shippingAddressId)->one();
$this->_shippingAddress = $address;
}
Expand Down Expand Up @@ -2932,7 +2930,7 @@ public function removeShippingAddress(): void
public function getEstimatedShippingAddress(): ?AddressElement
{
if (!isset($this->_estimatedShippingAddress) && $this->estimatedShippingAddressId) {
/** @var Address|null $address */
/** @var AddressElement|null $address */
$address = AddressElement::find()->owner($this)->id($this->estimatedShippingAddressId)->one();
$this->_estimatedShippingAddress = $address;
}
Expand Down Expand Up @@ -2967,7 +2965,7 @@ public function setEstimatedShippingAddress(AddressElement|array|null $address):
public function getBillingAddress(): ?AddressElement
{
if (!isset($this->_billingAddress) && $this->billingAddressId) {
/** @var Address|null $address */
/** @var AddressElement|null $address */
$address = AddressElement::find()->ownerId($this->id)->id($this->billingAddressId)->one();
$this->_billingAddress = $address;
}
Expand Down Expand Up @@ -3090,7 +3088,7 @@ public function hasMatchingAddresses(?array $attributes = null): bool
public function getEstimatedBillingAddress(): ?AddressElement
{
if (!isset($this->_estimatedBillingAddress) && $this->estimatedBillingAddressId) {
/** @var Address|null $address */
/** @var AddressElement|null $address */
$address = AddressElement::find()->owner($this)->id($this->estimatedBillingAddressId)->one();
$this->_estimatedBillingAddress = $address;
}
Expand Down
12 changes: 7 additions & 5 deletions src/elements/conditions/products/ProductTypeConditionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function getLabel(): string
protected function options(): array
{
return collect(Plugin::getInstance()->getProductTypes()->getAllProductTypes())
->map(fn(ProductType $productType) => ['value' => $productType->uid , 'label' => $productType->name])
->map(fn(ProductType $productType) => ['value' => $productType->uid, 'label' => $productType->name])
->all();
}

Expand All @@ -58,13 +58,15 @@ public function getExclusiveQueryParams(): array
*/
public function modifyQuery(ElementQueryInterface $query): void
{
/** @var ProductQuery $query */
$productTypes = Plugin::getInstance()->getProductTypes()->getAllProductTypes();

/** @var ProductQuery $query */
$query->type($this->paramValue(function(string $value) use ($productTypes) {
/** @var string[] $value */
$value = $this->paramValue(function(string $value) use ($productTypes) {
return ArrayHelper::firstWhere($productTypes, 'uid', $value)?->handle;
}));
});

/** @var ProductQuery $query */
$query->type($value);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/elements/db/ProductQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ public function defaultSku(mixed $value): ProductQuery
* ->all();
* ```
*
* @param string|string[]|ProductType|null $value The property value
* @param ProductType|string|null|array<string> $value The property value
* @return static self reference
*/
public function type(mixed $value): ProductQuery
Expand Down

0 comments on commit 1003bab

Please sign in to comment.