| 1 | <?php | ||
| 19 | class Post | ||
| 20 | { | ||
| 21 | private $tags; | ||
| 22 | |||
| 23 | private $postCategories; | ||
| 24 | |||
| 25 | public function __construct() | ||
| 30 | |||
| 31 | public function setTags(Collection $tags): void | ||
| 35 | |||
| 36 | public function getTags(): Collection | ||
| 40 | |||
| 41 | public function addTag(Tag $tag): void | ||
| 46 | |||
| 47 | public function removeTag(Tag $tag): void | ||
| 52 | |||
| 53 | public function setPostCategories(Collection $postCategories): void | ||
| 57 | |||
| 58 | public function getPostCategories(): Collection | ||
| 62 | |||
| 63 | public function addPostCategory(PostCategory $postCategory): void | ||
| 68 | |||
| 69 | public function removePostCategory(PostCategory $postCategory): void | ||
| 74 | } | ||
| 75 | 
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: