Skip to content

Commit

Permalink
Fetch item class for each row of the data
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Sep 19, 2024
1 parent 492336f commit df5da6e
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Common/BaseItemList.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,23 @@ protected function init(): void
{
}

/**
* 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 75 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.

Check failure on line 75 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 75 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 75 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 75 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 75 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 75 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.
}

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 81 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.

Check failure on line 81 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 81 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 81 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 81 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 81 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 81 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.
$this->emit(self::BEFORE_ITEM_ADD, [$item, $data]);
$this->addHtml($item);
$this->emit(self::ON_ITEM_ADD, [$item, $data]);
Expand Down

0 comments on commit df5da6e

Please sign in to comment.