Covariance and contravariance
Covariance and contravariance is one of those topics that once you have got your head around it, then it becomes quite intuitive – however, explaining it is somewhat challenging. The worst thing about covariance and contravariance is the words used to describe them. I admit to always forgetting which one is which!
You can have a look at the Wikipedia page, though you may end up more confused than you were before:
Covariance and contravariance (computer science) - Wikipedia
A much better idea, and, as you have probably gathered, something I generally encourage, is to hit the official PHP docs:
PHP: Covariance and Contravariance - Manual
https://www.php.net/manual/en/language.oop5.variance.php
Covariance and contravariance refer to the rules for what parameter and return types you are allowed to use when extending classes or implementing interfaces.
The following points are quoted from the official docs:
...