| Conditions | 1 |
| Paths | 1 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 38 | protected function getLastUpdatedDate(Collection $items, string $format) : string |
||
| 39 | { |
||
| 40 | $lastItem = $items |
||
| 41 | ->sortBy(function (FeedItem $feedItem) { |
||
| 42 | return $feedItem->getFeedItemUpdated()->format('YmdHis'); |
||
| 43 | }) |
||
| 44 | ->last(); |
||
| 45 | |||
| 46 | return $lastItem->getFeedItemUpdated()->format($format); |
||
| 47 | } |
||
| 48 | } |
||
| 49 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: