Skip to content

Commit

Permalink
pint
Browse files Browse the repository at this point in the history
  • Loading branch information
markhuot committed Nov 30, 2023
1 parent c86619c commit 3f6578d
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/Keystone.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/base/AttributeBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class AttributeBag implements \ArrayAccess, \Iterator
{
/** @var Collection<class-string<Attribute>, mixed> */
protected Collection $attributes;

protected int $index = 0;

public function __construct(Collection|array|null $attributes = [])
Expand Down Expand Up @@ -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]];
}

Expand Down
3 changes: 1 addition & 2 deletions src/fields/Keystone.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/helpers/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,7 +17,8 @@ function app(): \craft\web\Application|\craft\console\Application

/**
* @template T
* @param class-string<T> $className
*
* @param class-string<T> $className
* @return T
*/
function resolve(string $className)
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<ListenerInterface>}|callable():array{class-string, string, class-string<ListenerInterface>} ...$events
* @param array{class-string, string, class-string<ListenerInterface>}|callable():array{class-string, string, class-string<ListenerInterface>} ...$events
*/
function listen(array|callable ...$events): void
{
Expand Down
1 change: 1 addition & 0 deletions src/listeners/AttachPerRequestBehaviors.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use markhuot\keystone\behaviors\BodyParamObjectBehavior;
use markhuot\keystone\behaviors\CssRuleBehavior;

use function markhuot\keystone\helpers\base\app;

class AttachPerRequestBehaviors
Expand Down
12 changes: 5 additions & 7 deletions src/models/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -197,7 +195,7 @@ public function setSlotted(Collection $components): self
}

/**
* @param Collection<array-key, Component> $components
* @param Collection<array-key, Component> $components
*/
public function afterPopulateTree(Collection $components): void
{
Expand All @@ -216,7 +214,7 @@ public function getSlotted(): ?Collection
}

/**
* @param array<mixed> $context
* @param array<mixed> $context
*/
public function setContext(array $context): self
{
Expand All @@ -226,7 +224,7 @@ public function setContext(array $context): self
}

/**
* @param array<mixed> $context
* @param array<mixed> $context
*/
public function mergeContext(array $context): self
{
Expand Down Expand Up @@ -266,7 +264,7 @@ public function rules(): array
}

/**
* @param string|array<string|int>|null $path
* @param string|array<string|int>|null $path
*/
public function setPath(string|array|null $path): void
{
Expand All @@ -291,7 +289,7 @@ public function setSlot(?string $slot): void
}

/**
* @param array<mixed> $props
* @param array<mixed> $props
*/
public function render(array $props = []): string
{
Expand Down

0 comments on commit 3f6578d

Please sign in to comment.