[RFC][VOTE] Parameter Type Widening

php.internals

Niklas Keller

9 years ago
Morning Internals, I just opened the vote on "Parameter Type Widening", initially named "Parameter No Type Variance". RFC: wiki dot php dot net/rfc/parameter-no-type-variance Voting will keep open for three weeks and close on 30th of January, probably in the evening of UTC. 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. ---- Kind Regards and Happy Voting, Niklas Keller P.S.: The mail setup is still broken and rejects php dot net URLs...

Niklas Keller

9 years ago
Resenting due to mailing list failure yesterday. ---- Morning Internals, I just opened the vote on "Parameter Type Widening", initially named "Parameter No Type Variance". RFC: http://wiki.php.net/rfc/parameter-no-type-variance Voting will keep open for three weeks and close on 30th of January, probably in the evening of UTC. 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. ---- Kind Regards and Happy Voting, Niklas Keller

Christoph Becker

9 years ago
On 10.01.2017 at 09:33, Niklas Keller wrote:
> I just opened the vote on "Parameter Type Widening", initially named > "Parameter No Type Variance". > > Voting will keep open for three weeks and close on 30th of January, > probably in the evening of UTC.
The RMs asked to postpone any votings for now, because of the current mailing list issues, see news DOT php DOT net SLAHS php DOT internals SLASH 97658.
-- Christoph M. Becker

Niklas Keller

9 years ago
> > On 10.01.2017 at 09:33, Niklas Keller wrote: > > > I just opened the vote on "Parameter Type Widening", initially named > > "Parameter No Type Variance". > > > > Voting will keep open for three weeks and close on 30th of January, > > probably in the evening of UTC. > > The RMs asked to postpone any votings for now, because of the current > mailing list issues, see news DOT php DOT net SLAHS php DOT internals > SLASH 97658.
I know, I wasn't really at my desktop until just now. I have stopped the voting for now, even if everything seems to be resolved since http://news.php.net/php.internals/97653. Regards, Niklas

Niklas Keller

9 years ago
Voting is now closed and the RFC has been accepted with 24:5 votes. Thanks for voting! There have been some comments on the proposed patch. While it works in the current way, it's cleaner to move it to the argument checking code instead of the common code for return types and arguments. I'll adjust the patch accordingly during the weekend. Regards, Niklas