Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PHPStan issues #1139

Merged
merged 1 commit into from
Jul 16, 2024
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
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
Loading