Skip to content

Commit

Permalink
pint
Browse files Browse the repository at this point in the history
  • Loading branch information
markhuot committed Nov 2, 2023
1 parent 7786efd commit 9e6adea
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 17 deletions.
2 changes: 0 additions & 2 deletions src/Keystone.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
use markhuot\keystone\listeners\RegisterKeystoneFieldType;
use markhuot\keystone\listeners\RegisterTwigExtensions;

use function markhuot\keystone\helpers\event\listen;

class Keystone extends Plugin
{
protected function getListeners(): array

Check failure on line 29 in src/Keystone.php

View workflow job for this annotation

GitHub Actions / Run PHPStan

Method markhuot\keystone\Keystone::getListeners() return type has no value type specified in iterable type array.
Expand Down
1 change: 0 additions & 1 deletion src/actions/NormalizeFieldDataForComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Craft;
use markhuot\keystone\base\InlineEditData;
use markhuot\keystone\fields\Condition;
use markhuot\keystone\listeners\AttachFieldBehavior;
use markhuot\keystone\models\Component;

Expand Down
3 changes: 1 addition & 2 deletions src/attributes/Border.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public function getCssRules(): Collection
$widths = $widths->map(fn ($_) => $style);

return $collection->merge($widths)->forget(['border-style']);
})
;
});
}
}
1 change: 0 additions & 1 deletion src/attributes/Custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace markhuot\keystone\attributes;

use Illuminate\Support\Collection;
use markhuot\keystone\base\Attribute;

class Custom extends Attribute
Expand Down
3 changes: 2 additions & 1 deletion src/attributes/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public function getCssRules(): Collection
{
return collect($this->value)
->mergeKeys(['grid-template-columns', 'grid-template-widths'], function ($cols, $widths) {
$cols = collect(range(0, $cols-1));
$cols = collect(range(0, $cols - 1));

return ['grid-template-columns' => $cols->map(fn ($index) => $widths[$index] ?? '1fr')->join(' ')];
});
}
Expand Down
5 changes: 2 additions & 3 deletions src/base/CssRuleBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ public function addDeclaration($value, $key, $selector = null)
return $this->addRule($key.':'.$value, $selector);
}

public function addRule(string $rule, ?string $selector = null)
public function addRule(string $rule, string $selector = null)
{
$hash = hash('sha1', $rule.$selector);

if (isset($this->rules[$hash])) {
return 'c'.array_search($hash, array_keys($this->rules));
}
else {
} else {
$this->rules[$hash] = [
'rule' => $rule,
'selector' => $selector,
Expand Down
1 change: 1 addition & 0 deletions src/base/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace markhuot\keystone\base;

use yii\base\Event;

use function markhuot\keystone\helpers\event\listen;

class Plugin extends \craft\base\Plugin
Expand Down
1 change: 0 additions & 1 deletion src/behaviors/CssRuleBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use craft\web\View;
use markhuot\keystone\base\CssRuleBag;
use yii\base\Behavior;
use yii\helpers\Html;

/**
* @property View $owner;
Expand Down
6 changes: 3 additions & 3 deletions src/fields/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

class Condition extends Field implements FieldInterface
{
protected function inputHtml(mixed $value, ?ElementInterface $element = null): string
protected function inputHtml(mixed $value, ElementInterface $element = null): string
{
if (empty($value)) {
$value = ['class' => EntryCondition::class];
$value = ['class' => EntryCondition::class];
}
if ($value instanceof Query) {
$value = $value->getCondition();
Expand All @@ -33,7 +33,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s
]);
}

public function normalizeValue(mixed $value, ?ElementInterface $element = null): mixed
public function normalizeValue(mixed $value, ElementInterface $element = null): mixed
{
$condition = Craft::$app->getConditions()->createCondition($value);

Expand Down
1 change: 0 additions & 1 deletion src/listeners/RegisterDefaultComponentTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace markhuot\keystone\listeners;

use markhuot\keystone\components\ElementQuery;
use markhuot\keystone\events\RegisterComponentTypes;

class RegisterDefaultComponentTypes
Expand Down
2 changes: 1 addition & 1 deletion src/models/ComponentData.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function offsetExists(mixed $offset): bool
return true;
}

public function get(mixed $offset, bool $raw=false): mixed
public function get(mixed $offset, bool $raw = false): mixed
{
if ($this->hasAttribute($offset)) {
return $this->getAttribute($offset);
Expand Down
2 changes: 1 addition & 1 deletion tests/AttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

expect($component->render())->toContain('c0');

$css = (string)Craft::$app->getView()->getCssRules();
$css = (string) Craft::$app->getView()->getCssRules();
expect($css)
->not->toBeNull()
->toContain('.c0{background-color:#000000}');
Expand Down
1 change: 1 addition & 0 deletions tests/attributes/SpaceBetweenAttributeTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use markhuot\keystone\attributes\SpaceBetween;

use function markhuot\craftpest\helpers\test\dd;

it('skips when empty', function () {
Expand Down

0 comments on commit 9e6adea

Please sign in to comment.