Skip to content

Commit

Permalink
Fix stan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Sep 17, 2024
1 parent 474b39a commit a8eb2a7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 32 deletions.
22 changes: 1 addition & 21 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parameters:
path: src/Listener/ViewListener.php

-
message: "#^Parameter \\#1 \\$field of method CrudView\\\\Listener\\\\ViewListener\\:\\:_deriveFieldFromContext\\(\\) expects string, array\\<string\\>\\|string\\|null given\\.$#"
message: "#^Parameter \\#1 \\$field of method CrudView\\\\Listener\\\\ViewListener\\:\\:_deriveFieldFromContext\\(\\) expects string, array\\<int, string\\>\\|string\\|null given\\.$#"
count: 1
path: src/Listener/ViewListener.php

Expand All @@ -24,23 +24,3 @@ parameters:
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:searchManager\\(\\)\\.$#"
count: 1
path: src/Listener/ViewSearchListener.php

-
message: "#^Binary operation \"\\+\" between string and non\\-empty\\-array results in an error\\.$#"
count: 1
path: src/View/Widget/DateTimeWidget.php

-
message: "#^Offset 'name' does not exist on array\\<string\\>\\|string\\|null\\.$#"
count: 1
path: src/View/Widget/DateTimeWidget.php

-
message: "#^Offset 'templateVars' does not exist on array\\<string\\>\\|string\\|null\\.$#"
count: 2
path: src/View/Widget/DateTimeWidget.php

-
message: "#^Parameter \\#1 \\$options of method Cake\\\\View\\\\StringTemplate\\:\\:formatAttributes\\(\\) expects array\\<string, mixed\\>\\|null, array\\<string\\>\\|string\\|null given\\.$#"
count: 1
path: src/View/Widget/DateTimeWidget.php
6 changes: 0 additions & 6 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.23.1@8471a896ccea3526b26d082f4461eeea467f10a4">
<file src="src/View/Widget/DateTimeWidget.php">
<PossiblyNullArrayAccess>
<code><![CDATA[$data['name']]]></code>
<code><![CDATA[$data['templateVars']]]></code>
</PossiblyNullArrayAccess>
</file>
</files>
2 changes: 1 addition & 1 deletion src/View/Cell/TablesListCell.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function display(?array $tables = null, ?array $blacklist = null): void
$connection = ConnectionManager::get('default');
$schema = $connection->getSchemaCollection();
$tables = $schema->listTables();
ksort($tables);
sort($tables);

/** @psalm-suppress RiskyTruthyFalsyComparison */
if (!empty($blacklist)) {
Expand Down
6 changes: 2 additions & 4 deletions src/View/Widget/DateTimeWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public function render(array $data, ContextInterface $context): string
$this->_templates->add(['datetimePicker' => $this->defaultTemplate]);
}

/** @var array $data */
$data = $this->_templates->addClass($data, 'form-control');
$wrap = $datetimePicker['data-wrap'] === 'true';
if ($wrap) {
Expand All @@ -136,13 +137,10 @@ public function render(array $data, ContextInterface $context): string
}
} else {
$data += $datetimePicker;
/** @var array $data */
$data = $this->_templates->addClass($data, 'flatpickr');
}

/**
* @psalm-suppress PossiblyInvalidArrayOffset
* @psalm-suppress PossiblyInvalidArgument
*/
$input = $this->_templates->format('input', [
'name' => $data['name'],
'type' => 'text',
Expand Down

0 comments on commit a8eb2a7

Please sign in to comment.