- PHP RFC: Parameter Type Widening
- PHP RFC: Return Type Declarations
- https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)
- https://en.wikipedia.org/wiki/Liskov_substitution_principle
- https://en.wikipedia.org/wiki/Type_system
- https://en.wikipedia.org/wiki/Top_type
- https://en.wikipedia.org/wiki/Bottom_type
- PHP types hierarchy - nomnoml diagram
- https://blog.mariusschulz.com/2016/11/18/typescript-2-0-the-never-type
- PHP #externals: [RFC] Parameter No Type Variance
- PHP #externals: Parameter type widening RFC
- https://proandroiddev.com/understanding-generics-and-variance-in-kotlin-714c14564c47
- https://phpstan.org/r/5554c17159b690ae226419cec4e1c28b - example of method parameter covariance problem
- https://phpstan.org/r/a77db2e22a4daf7833e6d28c8cc812f8 - example of parametr incompatibility problem (kind of method overload)
- https://phpstan.org/r/59ba52fe399d2ae2ae5d46611bdd3d3e - with native types, contravariant/incompatible
@param
s are correctly ignored but not reported - return type covariance works well with both
@return
and@method
- https://phpstan.org/r/1d8417d93a8b7242f99eaa57203caead - with return types only in PhpDoc
- https://phpstan.org/r/c12459708c9c390c9f1e06504b3bdbbf - with native return type + PhpDoc
- https://phpstan.org/r/72edb34bc365edc5d88e53e53a713c4f -
@method
annotation allows to completely change method singature (so according PHPStan correct code will not actually run at all: https://3v4l.org/a45q7), as well as cause problems with parametr covariance and return type contravariance
- https://3v4l.org/MEqDv - Method overloading doesn't work really