Skip to content

Commit

Permalink
style: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
neilime committed Dec 20, 2023
1 parent 86b67b6 commit a5e41c7
Show file tree
Hide file tree
Showing 84 changed files with 291 additions and 291 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
->setRules([
'@PSR12' => true,
'array_indentation' => true,
'@PHP81Migration' => true,
'@PHP83Migration' => true,
])
->setFinder($finder)
->setUsingCache(true)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"twitter/bootstrap": "Twitter bootstrap assets"
},
"require": {
"php": "~8.1.0 || ~8.2.0",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"laminas/laminas-escaper": "^2.12",
"laminas/laminas-form": "^3.4",
"laminas/laminas-i18n": "^2.17",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ private function __construct(\Documentation\Generator\Configuration $configurati
public static function getInstance(
\Documentation\Generator\Configuration $configuration
): \Documentation\Generator\UsagePage\Prettifier\PhpPrettifier {
if (static::$instance === null) {
static::$instance = new static($configuration);
if (self::$instance === null) {
self::$instance = new self($configuration);
}

return static::$instance;
return self::$instance;
}

public function prettify($source)
Expand Down
4 changes: 2 additions & 2 deletions src/Documentation/Test/Snapshots/Drivers/Unified.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ protected function renderChangedExtent(Differ $differ, int $oldIndex, int $newIn

static $mbOld, $mbNew;

$mbOld = $mbOld ?? new MbString();
$mbNew = $mbNew ?? new MbString();
$mbOld ??= new MbString();
$mbNew ??= new MbString();

$mbOld->set($oldValue);
$mbNew->set($newValue);
Expand Down
10 changes: 5 additions & 5 deletions src/TwbsHelper/Form/View/Helper/FormRows.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected function getElementRowRendering(

$rowRendering['helper'] = [
$this->getHtmlElementHelper(),
'__invoke'
'__invoke',
];

$rowAttributes = $this->getHtmlattributesHelper()->__invoke([
Expand All @@ -168,7 +168,7 @@ protected function getElementRowRendering(
$rowRendering['helper_params'] = [
'div',
$rowAttributes,
'%content%'
'%content%',
];

return $rowRendering;
Expand Down Expand Up @@ -202,12 +202,12 @@ protected function renderButtonGroup(
'content' => [$button],
'helper' => [
$this->getButtonGroupHelper(),
'__invoke'
'__invoke',
],
'helper_params' => [
'%content%',
['attributes' => ['class' => $rowClass]]
]
['attributes' => ['class' => $rowClass]],
],
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/TwbsHelper/View/Helper/Blockquote.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __invoke(
$escape
);

$footerAttributes['tag'] = $footerAttributes['tag'] ?? 'figcaption';
$footerAttributes['tag'] ??= 'figcaption';
$footerContent = $this->renderFooter(
$footer,
$htmlattributesHelper->__invoke($footerAttributes),
Expand Down
8 changes: 4 additions & 4 deletions src/TwbsHelper/View/Helper/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Card extends \TwbsHelper\View\Helper\AbstractHtmlElement
self::CARD_IMG_TOP => 'renderCardImgTop',
self::CARD_IMG_BOTTOM => 'renderCardImgBottom',
self::CARD_OVERLAY => 'renderCardOverlay',
self::CARD_LIST_GROUP => 'renderCardListGroup'
self::CARD_LIST_GROUP => 'renderCardListGroup',
];

/**
Expand Down Expand Up @@ -191,7 +191,7 @@ protected function renderCardColumn($content, iterable $attributes, bool $escape
$attributes = $this->getView()->plugin('htmlattributes')
->__invoke($attributes)
->merge([
'class' => $this->getView()->plugin('htmlClass')->plugin('column')->getClassesFromOption($column)
'class' => $this->getView()->plugin('htmlClass')->plugin('column')->getClassesFromOption($column),
]);

$content = $this->renderCardContainerContent($content, [], $escape);
Expand Down Expand Up @@ -370,7 +370,7 @@ protected function renderCardListGroup(iterable $arguments, bool $escape): strin
->__invoke($arguments[1] ?? [])
->merge(['class' => ['list-group-flush']])->getArrayCopy();

$arguments[2] = $arguments[2] ?? $escape;
$arguments[2] ??= $escape;

return $this->getView()->plugin('listGroup')->__invoke(...$arguments);
}
Expand Down Expand Up @@ -429,7 +429,7 @@ protected function renderCardItem($type, $typeContent, bool $escape): string
$blockquoteAttributes = $typeContent[2] ?? ['class' => 'mb-0'];
$blockquoteContentAttributes = $typeContent[3] ?? [];
$blockquoteFooterAttributes = $typeContent[4] ?? [];
$blockquoteFooterAttributes['tag'] = $blockquoteFooterAttributes['tag'] ?? 'footer';
$blockquoteFooterAttributes['tag'] ??= 'footer';
$blockquoteFigureAttributes = $typeContent[5] ?? [];
$blockquoteEscape = $typeContent[6] ?? $escape;

Expand Down
4 changes: 2 additions & 2 deletions src/TwbsHelper/View/Helper/Collapse.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ protected function prepareTriggersSpec($triggers): iterable

$triggers['items'] = $triggerItems;

$triggers['tag'] = $triggers['tag'] ?? 'p';
$triggers['attributes'] = $triggers['attributes'] ?? [];
$triggers['tag'] ??= 'p';
$triggers['attributes'] ??= [];

return $triggers;
}
Expand Down
2 changes: 1 addition & 1 deletion src/TwbsHelper/View/Helper/DescriptionList.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function renderListItem(

if (is_string($itemValue)) {
$detailOptionsAndAttributes = [
'data' => $itemValue
'data' => $itemValue,
];
} elseif (is_array($itemValue)) {
if (!empty($itemValue['term'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/TwbsHelper/View/Helper/Dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Dropdown extends \TwbsHelper\View\Helper\AbstractHtmlElement
* @var array
*/
protected static $directions = [
'down', 'up', 'start', 'end'
'down', 'up', 'start', 'end',
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/TwbsHelper/View/Helper/GridColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected function prepareAttributes(iterable $optionsAndAttributes): iterable
}

$attributes['class']->merge([
$this->getView()->plugin('htmlClass')->getPrefixedClass($order, 'order')
$this->getView()->plugin('htmlClass')->getPrefixedClass($order, 'order'),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/TwbsHelper/View/Helper/HtmlElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class HtmlElement extends \Laminas\View\Helper\AbstractHtmlElement
'figure',
'ul',
'fieldset',
'nav'
'nav',
];

/**
Expand Down
4 changes: 2 additions & 2 deletions src/TwbsHelper/View/Helper/HtmlList.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ protected function prepareItemSpec($item, iterable $optionsAndAttributes): itera
$item['attributes'] = $this->getView()->plugin('htmlattributes')
->__invoke($item['attributes'] ?? [])
->merge([
'class' => $this->getListItemClassesFromOptionsAndAttributes($optionsAndAttributes)
'class' => $this->getListItemClassesFromOptionsAndAttributes($optionsAndAttributes),
]);

return $item;
Expand All @@ -182,7 +182,7 @@ protected function prepareItemSpec($item, iterable $optionsAndAttributes): itera
protected function getListItemClassesFromOptionsAndAttributes(iterable $optionsAndAttributes): array
{
$classes = [];
$inline = isset($optionsAndAttributes['inline']) ? $optionsAndAttributes['inline'] : false;
$inline = $optionsAndAttributes['inline'] ?? false;
if ($inline) {
$classes[] = 'list-inline-item';
}
Expand Down
2 changes: 1 addition & 1 deletion src/TwbsHelper/View/Helper/ListGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected function prepareItemSpec($item, iterable $optionsAndAttributes): itera
'class' => [
'd-flex',
'justify-content-between',
$isNumbered ? 'align-items-start' : 'align-items-center'
$isNumbered ? 'align-items-start' : 'align-items-center',
],
]);
}
Expand Down
6 changes: 3 additions & 3 deletions src/TwbsHelper/View/Helper/Modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function preparePartFromContent(string $type, $content): iterable

case is_iterable($content):
$part = $content;
$part['type'] = $part['type'] ?? $type;
$part['type'] ??= $type;
$parts[] = $part;
break;

Expand Down Expand Up @@ -260,7 +260,7 @@ protected function renderParts(
return join(PHP_EOL, array_filter([
$this->renderHeaderPart($headerPart, $optionsAndAttributes, $escape),
$this->renderBodyPart($bodyPart, $optionsAndAttributes, $escape),
$this->renderFooterPart($footerPart, $escape)
$this->renderFooterPart($footerPart, $escape),
]));
}

Expand Down Expand Up @@ -434,7 +434,7 @@ protected function renderPartList(
'content' => $partItem,
];
}
$partItem['type'] = $partItem['type'] ?? $type;
$partItem['type'] ??= $type;
return $that->renderPart($partItem, $escape);
}, \Laminas\Stdlib\ArrayUtils::iteratorToArray($part))
);
Expand Down
2 changes: 1 addition & 1 deletion src/TwbsHelper/View/Helper/Offcanvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ protected function renderContainer(
}

$attributes['class']->merge([
$this->getView()->plugin('htmlClass')->getPrefixedClass($placement, 'offcanvas')
$this->getView()->plugin('htmlClass')->getPrefixedClass($placement, 'offcanvas'),
]);

return $this->getView()->plugin('htmlElement')->__invoke(
Expand Down
2 changes: 1 addition & 1 deletion src/TwbsHelper/View/Helper/Placeholder.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected function prepareAttributesForSize(
'class' => $this->getView()->plugin('htmlClass')->plugin('size')->getClassesFromOption(
$optionsAndAttributes['size'],
'placeholder'
)
),
]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function testRemoveDirShouldRemoveTheGivenDIrectory()

\org\bovigo\vfs\vfsStream::create([
'test' => [
'test.txt' => 'test'
]
'test.txt' => 'test',
],
], $this->root);

$dirPath = $this->root->url() . DIRECTORY_SEPARATOR . 'test';
Expand All @@ -49,8 +49,8 @@ public function testRemoveDirShouldThrowsAnExceptionWhenDirPathIsInvalid()

\org\bovigo\vfs\vfsStream::create([
'test' => [
'test.txt' => 'test'
]
'test.txt' => 'test',
],
], $this->root);

$dirPath = $this->root->url() . DIRECTORY_SEPARATOR . 'wrong';
Expand All @@ -70,7 +70,7 @@ public function testFileExistsShouldReturnTrueWhenFileExists()
$fileName = 'test.txt';
$filePath = $this->root->url() . DIRECTORY_SEPARATOR . $fileName;
\org\bovigo\vfs\vfsStream::create([
$fileName => 'test'
$fileName => 'test',
], $this->root);
$this->assertTrue($this->file->fileExists($filePath));
}
Expand All @@ -87,7 +87,7 @@ public function testReadFile()
$fileContent = 'test content';
$filePath = $this->root->url() . DIRECTORY_SEPARATOR . $fileName;
\org\bovigo\vfs\vfsStream::create([
$fileName => $fileContent
$fileName => $fileContent,
], $this->root);
$this->assertEquals($fileContent, $this->file->readFile($filePath));
}
Expand Down Expand Up @@ -127,7 +127,7 @@ public function testAppendFile()
$filePath = $this->root->url() . DIRECTORY_SEPARATOR . $fileName;
$content = 'test content';
\org\bovigo\vfs\vfsStream::create([
$fileName => $content
$fileName => $content,
], $this->root);

$newContent = 'test new content';
Expand All @@ -145,7 +145,7 @@ public function testRemoveFile()
$filePath = $this->root->url() . DIRECTORY_SEPARATOR . $fileName;
$content = 'test content';
\org\bovigo\vfs\vfsStream::create([
$fileName => $content
$fileName => $content,
], $this->root);

$this->assertTrue($this->root->hasChild($fileName));
Expand Down
4 changes: 2 additions & 2 deletions tests/TestSuite/Documentation/Test/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public function testFromArrayShouldHandleTestChildren()
[
'title' => 'test',
'tests' => [
['title' => 'child']
]
['title' => 'child'],
],
],
);

Expand Down
4 changes: 2 additions & 2 deletions tests/TestSuite/Documentation/Tests/Components/Accordion.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@
'always_open' => true,
]);
},
]
],
],
]
],
],
];
10 changes: 5 additions & 5 deletions tests/TestSuite/Documentation/Tests/Components/Badges.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
echo '<h5>Example heading ' . $view->badge('New') . '</h5>' . PHP_EOL;
// H6
echo '<h6>Example heading ' . $view->badge('New') . '</h6>';
}
},
],
[
'title' => 'Buttons',
Expand All @@ -38,7 +38,7 @@
'variant' => 'primary',
],
]);
}
},
],
[
'title' => 'Positioned',
Expand All @@ -54,7 +54,7 @@
'positioned' => true,
'type' => 'pill',
'hidden_content' => 'unread messages',
]
],
],
'variant' => 'primary',
],
Expand All @@ -72,12 +72,12 @@
'positioned' => true,
'type' => 'pill',
'hidden_content' => 'New alerts',
]
],
],
'variant' => 'primary',
],
]);
}
},
],
[
'title' => 'Background colors',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
'attributes' => [
'class' => 'active',
'aria-current' => 'page',
'href' => '#'
'href' => '#',
],
],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@
],
]);
},
]
]
],
],
];
Loading

0 comments on commit a5e41c7

Please sign in to comment.