Problem/Motivation
In #3470913: Ensure getWidth()/getHeigth always return ?int we are using the issue to try and introduce a process to signal a native return type will be added to interface methods in next major release (and in #3470951: Add return typehints for getWidth()/getHeigth in interfaces we have the follow up to actually implement the change in the next major). The concept is that the intended type is indicated to extensions, and given return type covariance allows them to implement the type in advance of the change on interface/abstract/base class, we prod contrib/custom to do the change to be ready when next major (implementing the type) is out.
More or less the same intent in #3333824: Enable existing interfaces to add return type hints with a deprecation message for implementors.
There are discussion to support this through Symfony's DebugClassLoader - see [ErrorHandler] DebugClassloader: introduce an annotation to signal definite intent to add/change the return typehint of a method and a PR [ErrorHandler] Add support for @return-type-will-change
This issue explores an alternative approach, introducing a PHPStan custom rule to do the checking on static analysis rather than test time.