[PHP-DEV] [RFC] Parameter No Type Variance

2016-11-21 Thread Niklas Keller
Morning Internals, I'd like to announce a RFC to allow omitting the type declarations for parameters in subclasses: https://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 limi

Re: [PHP-DEV] [RFC] Parameter No Type Variance

2016-11-21 Thread Josh Di Fabio
On Mon, Nov 21, 2016 at 9:40 AM Niklas Keller wrote: > Morning Internals, > > I'd like to announce a RFC to allow omitting the type declarations for > parameters in subclasses: > https://wiki.php.net/rfc/parameter-no-type-variance > > PHP doesn't currently allow variance for parameters as checkin

Re: [PHP-DEV] [RFC] Parameter No Type Variance

2016-11-21 Thread Daniel Morris
What happens if the method signature is defined within an interface? I would consider that method signature a contract and one that should not be able to be overwritten. -- Daniel Morris dan...@honestempire.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http:/

Re: [PHP-DEV] [RFC] Parameter No Type Variance

2016-11-21 Thread Niklas Keller
2016-11-21 11:00 GMT+01:00 Daniel Morris : > What happens if the method signature is defined within an interface? Just the same as for every class. Having other rules for interfaces doesn't make sense. Imagine the following example: interface I { function foo(array $foo); } class C1 implements

Re: [PHP-DEV] [RFC] Parameter No Type Variance

2016-11-21 Thread Fleshgrinder
On 11/21/2016 10:39 AM, Niklas Keller wrote: > Morning Internals, > > I'd like to announce a RFC to allow omitting the type declarations for > parameters in subclasses: > https://wiki.php.net/rfc/parameter-no-type-variance > > PHP doesn't currently allow variance for parameters as checking these

Re: [PHP-DEV] [RFC] Parameter No Type Variance

2016-11-29 Thread Rasmus Schultz
But this leads to code that can't pass static inspections? interface Joiner { public function join(array $array): string; } class WideJoiner implements Joiner { public function join($iterable): string { $array = is_array($iterable) ? $array : iterable_to_array($iterable);

Re: [PHP-DEV] [RFC] Parameter No Type Variance

2016-11-29 Thread Niklas Keller
> > But this leads to code that can't pass static inspections? > No. > interface Joiner { > public function join(array $array): string; > } > > class WideJoiner implements Joiner { > public function join($iterable): string { > $array = is_array($iterable) ? $array : > iterable_to

Re: [PHP-DEV] [RFC] Parameter No Type Variance

2016-11-29 Thread Nikita Popov
On Mon, Nov 21, 2016 at 10:39 AM, Niklas Keller wrote: > Morning Internals, > > I'd like to announce a RFC to allow omitting the type declarations for > parameters in subclasses: > https://wiki.php.net/rfc/parameter-no-type-variance > > PHP doesn't currently allow variance for parameters as check