Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ parameters:
paths:
- src/
ignoreErrors:
-
identifier: missingType.iterableValue
36 changes: 36 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="7.0.0-rc2@20339e3fe5b8d03bcd8061030eb2a83ad50e5783">
<file src="src/Command/CopyLayoutsCommand.php">
<InternalClass>
<code><![CDATA[new Filesystem()]]></code>
</InternalClass>
<InternalMethod>
<code><![CDATA[copyDir]]></code>
</InternalMethod>
</file>
<file src="src/Command/InstallCommand.php">
<ForbiddenCode>
<code><![CDATA[shell_exec($command)]]></code>
</ForbiddenCode>
<InternalClass>
<code><![CDATA[new Filesystem()]]></code>
<code><![CDATA[new Filesystem()]]></code>
<code><![CDATA[new Filesystem()]]></code>
<code><![CDATA[new Filesystem()]]></code>
</InternalClass>
<InternalMethod>
<code><![CDATA[deleteDir]]></code>
<code><![CDATA[findRecursive]]></code>
<code><![CDATA[findRecursive]]></code>
<code><![CDATA[mkdir]]></code>
</InternalMethod>
</file>
<file src="src/View/Helper/BreadcrumbsHelper.php">
<MoreSpecificImplementedParamType>
<code><![CDATA[$crumbs]]></code>
<code><![CDATA[$url]]></code>
<code><![CDATA[$url]]></code>
<code><![CDATA[$url]]></code>
</MoreSpecificImplementedParamType>
</file>
</files>
5 changes: 3 additions & 2 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0"?>
<psalm
errorLevel="5"
errorLevel="4"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
autoloader="tests/bootstrap.php"
findUnusedBaselineEntry="false"
findUnusedBaselineEntry="true"
findUnusedCode="false"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src" />
Expand Down
2 changes: 1 addition & 1 deletion src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected function deleteNodeModules(): bool
/**
* Runs the NPM install command.
*
* @param array $output The variable to write the output to.
* @param array<int, string> $output The variable to write the output to.
* @param int $return The variable to write the return status code to.
* @param bool $useLatest Whether to install the latest minor versions.
* @return void
Expand Down
22 changes: 17 additions & 5 deletions src/View/Helper/BreadcrumbsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class BreadcrumbsHelper extends CoreBreadcrumbsHelper
/**
* Default attributes for the templates
*
* @var array
* @var array<string, array<string, string>>
*/
protected array $defaultAttributes = [
'class' => [
Expand All @@ -47,7 +47,10 @@ public function render(array $attributes = [], array $separator = []): string
}

/**
* @inheritDoc
* {@inheritDoc}
*
* @param array<string, mixed>|string|null $url URL of the crumb.
* @param array<string, mixed> $options Array of options. These options will be used as HTML attributes of the crumb.
*/
public function add(string $content, array|string|null $url = null, array $options = []): static
{
Expand All @@ -59,7 +62,10 @@ public function add(string $content, array|string|null $url = null, array $optio
}

/**
* @inheritDoc
* {@inheritDoc}
*
* @param array<array{content?: string, url?: array<string, mixed>|string|null, options?: array<string, mixed>}> $crumbs Array of crumbs to add.
* @param array<string, mixed> $options Shared options for all crumbs.
*/
public function addMany(array $crumbs, array $options = []): static
{
Expand All @@ -79,7 +85,10 @@ public function addMany(array $crumbs, array $options = []): static
}

/**
* @inheritDoc
* {@inheritDoc}
*
* @param array<string, mixed>|string|null $url URL of the crumb.
* @param array<string, mixed> $options Array of options. These options will be used as HTML attributes of the crumb.
*/
public function prepend(string $content, array|string|null $url = null, array $options = []): static
{
Expand All @@ -91,7 +100,10 @@ public function prepend(string $content, array|string|null $url = null, array $o
}

/**
* @inheritDoc
* {@inheritDoc}
*
* @param array<string, mixed>|string|null $url URL of the crumb.
* @param array<string, mixed> $options Array of options. These options will be used as HTML attributes of the crumb.
*/
public function insertAt(int $index, string $content, array|string|null $url = null, array $options = []): static
{
Expand Down
2 changes: 1 addition & 1 deletion src/View/Helper/FlashHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class FlashHelper extends Helper
* "BootstrapUI." is prepended to the name so that the element is used from this plugin.
*
* @param string $key The [Flash.]key you are rendering in the view.
* @param array $options Additional options to use for the creation of this flash message.
* @param array<string, mixed> $options Additional options to use for the creation of this flash message.
* Supports the 'params', and 'element' keys that are used in the helper.
* @return string|null Rendered flash message or null if flash key does not exist
* in session.
Expand Down
84 changes: 44 additions & 40 deletions src/View/Helper/FormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class FormHelper extends CoreFormHelper
/**
* Form alignment types.
*
* @var array
* @var array<int, string>
*/
public const ALIGN_TYPES = [self::ALIGN_DEFAULT, self::ALIGN_HORIZONTAL, self::ALIGN_INLINE];

Expand Down Expand Up @@ -118,7 +118,7 @@ class FormHelper extends CoreFormHelper
/**
* Set on `Form::create()` to tell grid type.
*
* @var array|null
* @var array<array-key, mixed>|null
*/
protected ?array $grid = null;

Expand All @@ -132,7 +132,7 @@ class FormHelper extends CoreFormHelper
/**
* Default Bootstrap string templates.
*
* @var array
* @var array<string, string>
*/
protected array $templates = [
'error' =>
Expand Down Expand Up @@ -221,7 +221,7 @@ class FormHelper extends CoreFormHelper
/**
* Templates set per alignment type
*
* @var array
* @var array<string, array<string, string>>
*/
protected array $templateSet = [
'default' => [
Expand Down Expand Up @@ -317,7 +317,7 @@ class FormHelper extends CoreFormHelper
/**
* Default Bootstrap widgets.
*
* @var array
* @var array<string, mixed>
*/
protected array $widgets = [
'button' => 'BootstrapUI\View\Widget\ButtonWidget',
Expand Down Expand Up @@ -533,8 +533,8 @@ public function control(string $fieldName, array $options = []): string
* Modify options and templates based on spacing.
*
* @param string $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function spacingOptions(string $fieldName, array $options): array
{
Expand Down Expand Up @@ -562,8 +562,8 @@ protected function spacingOptions(string $fieldName, array $options): array
* Modify the options for container templates.
*
* @param string|null $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function containerOptions(?string $fieldName, array $options): array
{
Expand Down Expand Up @@ -602,8 +602,8 @@ protected function containerOptions(?string $fieldName, array $options): array
* Modify options for checkbox controls.
*
* @param string $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function checkboxOptions(string $fieldName, array $options): array
{
Expand Down Expand Up @@ -641,8 +641,8 @@ protected function checkboxOptions(string $fieldName, array $options): array
* Modify options for radio controls.
*
* @param string $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function radioOptions(string $fieldName, array $options): array
{
Expand Down Expand Up @@ -692,8 +692,8 @@ protected function radioOptions(string $fieldName, array $options): array
* Modify options for select controls.
*
* @param string $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function selectOptions(string $fieldName, array $options): array
{
Expand Down Expand Up @@ -762,8 +762,8 @@ protected function selectOptions(string $fieldName, array $options): array
* Modify options for range controls.
*
* @param string $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function rangeOptions(string $fieldName, array $options): array
{
Expand All @@ -784,8 +784,8 @@ protected function rangeOptions(string $fieldName, array $options): array
* Modify the options for labels.
*
* @param string|null $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function labelOptions(?string $fieldName, array $options): array
{
Expand Down Expand Up @@ -823,7 +823,7 @@ protected function labelOptions(?string $fieldName, array $options): array
}

if ($labelClasses) {
$options['label'] = $this->injectClasses($labelClasses, (array)$options['label']);
$options['label'] = $this->injectClasses($labelClasses, $options['label']);
}
}

Expand All @@ -834,8 +834,8 @@ protected function labelOptions(?string $fieldName, array $options): array
* Modify templates based on error style.
*
* @param string $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function feedbackStyleOptions(string $fieldName, array $options): array
{
Expand Down Expand Up @@ -871,8 +871,8 @@ protected function feedbackStyleOptions(string $fieldName, array $options): arra
* Modify options for aria attributes.
*
* @param string $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function ariaOptions(string $fieldName, array $options): array
{
Expand Down Expand Up @@ -921,8 +921,8 @@ protected function ariaOptions(string $fieldName, array $options): array
* Modify options for placeholders.
*
* @param string $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function placeholderOptions(string $fieldName, array $options): array
{
Expand Down Expand Up @@ -955,8 +955,8 @@ protected function placeholderOptions(string $fieldName, array $options): array
* Modify options for control's help.
*
* @param string $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function helpOptions(string $fieldName, array $options): array
{
Expand Down Expand Up @@ -993,8 +993,8 @@ protected function helpOptions(string $fieldName, array $options): array
* Modify options for control's tooltip.
*
* @param string $fieldName Field name.
* @param array $options Options. See `$options` argument of `control()` method.
* @return array
* @param array<string, mixed> $options Options. See `$options` argument of `control()` method.
* @return array<string, mixed>
*/
protected function tooltipOptions(string $fieldName, array $options): array
{
Expand All @@ -1019,8 +1019,8 @@ protected function tooltipOptions(string $fieldName, array $options): array
*
* @param string $html The form element HTML.
* @param string|null $fieldName The field name.
* @param array $options The element generation options (see `$options` argument for `button()`, `submit()`, and
* `control()`).
* @param array<string, mixed> $options The element generation options (see `$options` argument for `button()`,
* `submit()`, and `control()`).
* @return string
* @see button()
* @see submit()
Expand Down Expand Up @@ -1070,8 +1070,8 @@ public function multiCheckbox(string $fieldName, iterable $options, array $attri
/**
* Set options for radio and multi checkbox inputs.
*
* @param array $attributes Attributes
* @return array
* @param array<string, mixed> $attributes Attributes
* @return array<string, mixed>
*/
protected function multiInputAttributes(array $attributes): array
{
Expand All @@ -1094,7 +1094,7 @@ protected function multiInputAttributes(array $attributes): array
* Creates a color input.
*
* @param string $fieldName The field name.
* @param array $options Array of options or HTML attributes.
* @param array<string, mixed> $options Array of options or HTML attributes.
* @return string
*/
public function color(string $fieldName, array $options = []): string
Expand Down Expand Up @@ -1124,7 +1124,7 @@ public function end(array $secureAttributes = []): string
* in a hidden input. Defaults to true.
*
* @param string $fieldName Name of a field, like this "modelname.fieldname"
* @param array $options Array of HTML attributes.
* @param array<string, mixed> $options Array of HTML attributes.
* @return string An HTML text input element.
*/
public function staticControl(string $fieldName, array $options = []): string
Expand Down Expand Up @@ -1169,7 +1169,11 @@ public function staticControl(string $fieldName, array $options = []): string
}

/**
* @inheritDoc
* {@inheritDoc}
*
* @param array<string, mixed> $options The options for the input element.
* @return array<string, mixed>|string The generated input element, or an array of input markup if `checkbox()`
* is called with the `hiddenField` option set to `_split`.
*/
protected function getInput(string $fieldName, array $options): array|string
{
Expand Down Expand Up @@ -1236,8 +1240,8 @@ protected function parseOptions(string $fieldName, array $options): array
*
* Handles per-form scoped tasks like form alignment detection/switching.
*
* @param array $options Options.
* @return array Modified options.
* @param array<string, mixed> $options Options.
* @return array<string, mixed> Modified options.
*/
protected function processFormOptions(array $options): array
{
Expand Down Expand Up @@ -1364,7 +1368,7 @@ protected function gridClass(int $columnIndex, bool $offset = false): string
/**
* Detects the form alignment when possible.
*
* @param array $options Options.
* @param array<string, mixed> $options Options.
* @return string Form alignment type. One of `default`, `horizontal` or `inline`.
*/
protected function detectFormAlignment(array $options): string
Expand Down
Loading
Loading