Welcome! Log In Create A New Profile

Advanced

[PHP-DEV] [RFC][VOTE] Parameter Type Widening (Resume)

Posted by Niklas Keller 
Niklas Keller
[PHP-DEV] [RFC][VOTE] Parameter Type Widening (Resume)
January 11, 2017 12:40PM
Morning Internals,

I just resumed the vote on "Parameter Type Widening", initially named
"Parameter No Type Variance".

RFC: https://wiki.php.net/rfc/parameter-no-type-variance

Voting will keep open for three weeks counting from the initial opening on
the 9th of January and close on 30th of January, probably in the evening of
UTC, as originally planned.

You can find an excerpt of the RFC below.

----

PHP currently doesn't allow any variance of parameter types when checking
whether a method implemented in a class is compatible with the method
defined either in the parent class or interface.

This RFC proposes to allow omitting a type entirely in a subclass, as
dropping all parameter constraints is always valid according to the
contravariance rule.

Implementing this RFC would allow libraries to be upgraded to use type
declarations
in their method signatures. Currently adding types to a method of a class
in a library would break any code that extends that class.

This would provide an easier upgrade path for libraries to start using
scalar types, to replace manual checks being done inside the methods,
without requiring an update for all sub-classes.

----

I resumed the previous voting instead of resetting it, as the voting period
is still longer than two weeks from now.

Kind Regards and Happy Voting,
Niklas Keller
Sorry, only registered users may post in this forum.

Click here to login