From 3f6578d7e6fbc963176d368622f3f9081744c78c Mon Sep 17 00:00:00 2001 From: markhuot Date: Thu, 30 Nov 2023 10:01:08 -0500 Subject: [PATCH] pint --- src/Keystone.php | 1 - src/base/AttributeBag.php | 4 +++- src/fields/Keystone.php | 3 +-- src/helpers/base.php | 5 +++-- src/helpers/event.php | 4 ++-- src/listeners/AttachPerRequestBehaviors.php | 1 + src/models/Component.php | 12 +++++------- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Keystone.php b/src/Keystone.php index a8f00f8..409c605 100644 --- a/src/Keystone.php +++ b/src/Keystone.php @@ -4,7 +4,6 @@ use craft\base\Element; use craft\db\Query; -use craft\elements\Asset; use craft\fields\PlainText; use craft\services\Fields; use craft\web\Application as WebApplication; diff --git a/src/base/AttributeBag.php b/src/base/AttributeBag.php index 33ae88c..4dc14d8 100644 --- a/src/base/AttributeBag.php +++ b/src/base/AttributeBag.php @@ -8,6 +8,7 @@ class AttributeBag implements \ArrayAccess, \Iterator { /** @var Collection, mixed> */ protected Collection $attributes; + protected int $index = 0; public function __construct(Collection|array|null $attributes = []) @@ -93,7 +94,8 @@ public function offsetUnset(mixed $offset): void $this->attributes->forget([$offset]); } - public function current(): mixed{ + public function current(): mixed + { return $this->attributes[$this->attributes->keys()[$this->index]]; } diff --git a/src/fields/Keystone.php b/src/fields/Keystone.php index 1c1f058..c05b294 100644 --- a/src/fields/Keystone.php +++ b/src/fields/Keystone.php @@ -2,15 +2,14 @@ namespace markhuot\keystone\fields; -use Craft; use craft\base\ElementInterface; use craft\base\Field; use markhuot\keystone\actions\DuplicateComponentTree; use markhuot\keystone\actions\GetComponentType; use markhuot\keystone\models\Component; use markhuot\keystone\models\ComponentData; + use function markhuot\keystone\helpers\base\app; -use function markhuot\keystone\helpers\base\throw_if; /** * @property int|null $id remove string from the type hint because php will coerce it to an int diff --git a/src/helpers/base.php b/src/helpers/base.php index d54d344..d815dd0 100644 --- a/src/helpers/base.php +++ b/src/helpers/base.php @@ -3,8 +3,8 @@ namespace markhuot\keystone\helpers\base; use Craft; -use craft\helpers\App; use craft\elements\User; +use craft\helpers\App; use yii\web\UnauthorizedHttpException; function app(): \craft\web\Application|\craft\console\Application @@ -17,7 +17,8 @@ function app(): \craft\web\Application|\craft\console\Application /** * @template T - * @param class-string $className + * + * @param class-string $className * @return T */ function resolve(string $className) diff --git a/src/helpers/event.php b/src/helpers/event.php index 970e7f7..938b5f0 100644 --- a/src/helpers/event.php +++ b/src/helpers/event.php @@ -7,11 +7,11 @@ use ReflectionClass; use ReflectionParameter; use yii\base\Event; + use function markhuot\keystone\helpers\base\resolve; -use function markhuot\keystone\helpers\base\throw_if; /** - * @param array{class-string, string, class-string}|callable():array{class-string, string, class-string} ...$events + * @param array{class-string, string, class-string}|callable():array{class-string, string, class-string} ...$events */ function listen(array|callable ...$events): void { diff --git a/src/listeners/AttachPerRequestBehaviors.php b/src/listeners/AttachPerRequestBehaviors.php index 55a4696..3a19b9c 100644 --- a/src/listeners/AttachPerRequestBehaviors.php +++ b/src/listeners/AttachPerRequestBehaviors.php @@ -4,6 +4,7 @@ use markhuot\keystone\behaviors\BodyParamObjectBehavior; use markhuot\keystone\behaviors\CssRuleBehavior; + use function markhuot\keystone\helpers\base\app; class AttachPerRequestBehaviors diff --git a/src/models/Component.php b/src/models/Component.php index 056356f..8b11d7d 100644 --- a/src/models/Component.php +++ b/src/models/Component.php @@ -20,8 +20,6 @@ use yii\db\conditions\OrCondition; use function markhuot\keystone\helpers\base\app; -use function markhuot\keystone\helpers\base\currentUserOrFail; -use function markhuot\keystone\helpers\base\throw_if; /** * @property int $id @@ -197,7 +195,7 @@ public function setSlotted(Collection $components): self } /** - * @param Collection $components + * @param Collection $components */ public function afterPopulateTree(Collection $components): void { @@ -216,7 +214,7 @@ public function getSlotted(): ?Collection } /** - * @param array $context + * @param array $context */ public function setContext(array $context): self { @@ -226,7 +224,7 @@ public function setContext(array $context): self } /** - * @param array $context + * @param array $context */ public function mergeContext(array $context): self { @@ -266,7 +264,7 @@ public function rules(): array } /** - * @param string|array|null $path + * @param string|array|null $path */ public function setPath(string|array|null $path): void { @@ -291,7 +289,7 @@ public function setSlot(?string $slot): void } /** - * @param array $props + * @param array $props */ public function render(array $props = []): string {