| 1 | <?php |
||
| 20 | class NewsItemForWidgetDataMapper { |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var NewsItemForWidgetDao $dao |
||
| 24 | */ |
||
| 25 | private $dao; |
||
| 26 | |||
| 27 | public function __construct(NewsItemForWidgetDao $dao) { |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return NewsItem[] |
||
| 33 | */ |
||
| 34 | public function fetchAll(Project $project) { |
||
| 35 | $rows = $this->dao->fetchAll($project->getID()); |
||
| 36 | |||
| 37 | $items = array(); |
||
| 38 | foreach ($rows as $row) { |
||
|
|
|||
| 39 | $items[] = new NewsItem($row); |
||
| 40 | } |
||
| 41 | |||
| 42 | return $items;; |
||
| 43 | } |
||
| 44 | |||
| 45 | public function updatePromotedItems(Project $project, $promoted_ids) { |
||
| 48 | } |
||
| 49 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.