Skip to content

Commit

Permalink
Fix PHPStan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
radimvaculik authored and f3l1x committed Jul 16, 2024
1 parent edee4d6 commit 5affd4f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
11 changes: 8 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ parameters:
- src
- tests

checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false

ignoreErrors:
-
message: '/^Call to an undefined method Nette\\Bridges\\ApplicationLatte\\Template::add\(\)\.$/'
Expand Down Expand Up @@ -56,3 +53,11 @@ parameters:
message: '#string\\|Stringable#'
count: 2
path: src/Status/Option.php
-
identifier: missingType.generics
-
identifier: missingType.iterableValue
-
message: "#^Cannot access offset 'submit' on Nette\\\\ComponentModel\\\\IComponent\\.$#"
count: 3
path: src/Datagrid.php
3 changes: 3 additions & 0 deletions src/DataSource/ElasticsearchDataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Contributte\Datagrid\Utils\DateTimeHelper;
use Contributte\Datagrid\Utils\Sorting;
use Elastic\Elasticsearch\Client;
use Elastic\Elasticsearch\Response\Elasticsearch;
use RuntimeException;
use UnexpectedValueException;

Expand All @@ -35,6 +36,7 @@ public function __construct(private Client $client, string $indexName, ?callable

public function getCount(): int
{
/** @var Elasticsearch $searchResult */
$searchResult = $this->client->search($this->searchParamsBuilder->buildParams());

if (!isset($searchResult['hits'])) {
Expand All @@ -51,6 +53,7 @@ public function getCount(): int
*/
public function getData(): array
{
/** @var Elasticsearch $searchResult */
$searchResult = $this->client->search($this->searchParamsBuilder->buildParams());

if (!isset($searchResult['hits'])) {
Expand Down
1 change: 1 addition & 0 deletions src/Datagrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,7 @@ public function filterSucceeded(NetteForm $form): void
}

if ($edit['submit']->isSubmittedBy() || $edit['cancel']->isSubmittedBy()) {
/** @var string $id */
$id = $form->getHttpData(Form::DataLine, 'inline_edit[_id]');
$primaryWhereColumn = $form->getHttpData(Form::DataLine, 'inline_edit[_primary_where_column]');

Expand Down
1 change: 1 addition & 0 deletions src/GroupAction/GroupActionCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public function submitted(NetteForm $form): void
return;
}

/** @var array $httpIds */
$httpIds = $form->getHttpData(
Form::DataLine | Form::DataKeys,
strtolower($this->datagrid->getFullName()) . '_group_action_item[]'
Expand Down
4 changes: 3 additions & 1 deletion src/Utils/ItemDetailForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ private function getHttpData(): mixed

$path = explode(self::NameSeparator, $lookupPath);

$this->httpPost = Arrays::get($form->getHttpData(), $path, null);
/** @var array $httpData */
$httpData = $form->getHttpData();
$this->httpPost = Arrays::get($httpData, $path, null);
}

return $this->httpPost;
Expand Down

0 comments on commit 5affd4f

Please sign in to comment.