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

Fetch item class for each row of the data #231

Merged
merged 1 commit into from
Sep 24, 2024
Merged
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
18 changes: 15 additions & 3 deletions src/Common/BaseItemList.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,24 @@
{
}

/**
* Create a list item for the given data
*
* @param object $data
*
* @return BaseListItem|BaseTableRowItem
*/
protected function createListItem(object $data)
{
$className = $this->getItemClass();

return new $className($data, $this);

Check failure on line 76 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Method ipl\Web\Common\BaseItemList::createListItem() should return ipl\Web\Common\BaseListItem|ipl\Web\Common\BaseTableRowItem but returns object.

Check failure on line 76 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Method ipl\Web\Common\BaseItemList::createListItem() should return ipl\Web\Common\BaseListItem|ipl\Web\Common\BaseTableRowItem but returns object.

Check failure on line 76 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Method ipl\Web\Common\BaseItemList::createListItem() should return ipl\Web\Common\BaseListItem|ipl\Web\Common\BaseTableRowItem but returns object.

Check failure on line 76 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Method ipl\Web\Common\BaseItemList::createListItem() should return ipl\Web\Common\BaseListItem|ipl\Web\Common\BaseTableRowItem but returns object.

Check failure on line 76 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Method ipl\Web\Common\BaseItemList::createListItem() should return ipl\Web\Common\BaseListItem|ipl\Web\Common\BaseTableRowItem but returns object.

Check failure on line 76 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Method ipl\Web\Common\BaseItemList::createListItem() should return ipl\Web\Common\BaseListItem|ipl\Web\Common\BaseTableRowItem but returns object.

Check failure on line 76 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Method ipl\Web\Common\BaseItemList::createListItem() should return ipl\Web\Common\BaseListItem|ipl\Web\Common\BaseTableRowItem but returns object.
nilmerg marked this conversation as resolved.
Show resolved Hide resolved
}

protected function assemble(): void
{
$itemClass = $this->getItemClass();
foreach ($this->data as $data) {
/** @var BaseListItem|BaseTableRowItem $item */
$item = new $itemClass($data, $this);
$item = $this->createListItem($data);

Check failure on line 82 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 82 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 82 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 82 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 82 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 82 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.

Check failure on line 82 in src/Common/BaseItemList.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Parameter #1 $data of method ipl\Web\Common\BaseItemList::createListItem() expects object, mixed given.
$this->emit(self::BEFORE_ITEM_ADD, [$item, $data]);
$this->addHtml($item);
$this->emit(self::ON_ITEM_ADD, [$item, $data]);
Expand Down
Loading