$key of type integer|true is incompatible with the type Doctrine\Common\Collections\TKey|null expected by parameter $offset of Doctrine\Common\Collecti...Collection::offsetSet().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
The expression return $it->key() could return the type double|null|string which is incompatible with the type-hinted return boolean|integer. Consider adding an additional type-check to rule them out.