This is an old revision of the document!
PHP RFC: Your Title Here
- Version: 0.1
- Date: 2016-11-21
- Author: Niklas Keller email@example.com
- Status: Draft
- First Published at: http://wiki.php.net/rfc/parameter-no-type-variance
PHP doesn't currently allow variance for parameters as checking these for compatibility isn't possible on compile time. This limitation is caused by autoloading and doesn't allow widening the accepted parameters.
This RFC proposes to allow ommiting the type entirely in a subclass, as dropping all parameter constraints is always valid according to the LSP principle.
Backward Incompatible Changes
Proposed PHP Version(s)
Next minor version, currently 7.2.
To Existing Extensions
In the future there might be support for contra-variance / co-variance for parameters / return types.
Proposed Voting Choices
Requires a 2/3 majority.
Patches and Tests