Re: [PHP-DEV] Parameter type widening RFC

2017-05-28 Thread Dan Ackroyd
On 28 May 2017 at 14:25, Rasmus Schultz wrote: > > To me, that's a setback that leads to harder-to-debug errors, and increases > learning-curve. Everything is a trade-off. The type widening RFC makes it easier to move to parameter types for existing libraries. While I can see what you mean about

Re: [PHP-DEV] Parameter type widening RFC

2017-05-28 Thread li...@rhsoft.net
Am 28.05.2017 um 23:28 schrieb Dan Ackroyd: On 28 May 2017 at 18:06, Aidan Woods wrote: So, if I understand everything here correctly ... will be equivalent in 7.2? :( Not equivalent. Adding the Boo param type to an implementation, when it is only a comment in the parent gives an error. i

Re: [PHP-DEV] Parameter type widening RFC

2017-05-28 Thread Dan Ackroyd
On 28 May 2017 at 18:06, Aidan Woods wrote: > So, if I understand everything here correctly > ... > will be equivalent in 7.2? :( > Not equivalent. Adding the Boo param type to an implementation, when it is only a comment in the parent gives an error. interface Foo { /* * @param $Boo, prett

[PHP-DEV] [RFC][Discussion] Consistent callables

2017-05-28 Thread Dan Ackroyd
Hi, I'd like to introduce an RFC to cleanup the behaviour of callables and related functions in PHP. https://wiki.php.net/rfc/consistent_callables Note, this RFC targets PHP 8, with soft deprecations in PHP 7.3 and deprecation notices in 7.last. This means there is a lot of time for reading and

Re: [PHP-DEV] Parameter type widening RFC

2017-05-28 Thread Aidan Woods
So, if I understand everything here correctly ``` interface Foo { public function bar(Boo $Boo); } ``` and ``` interface Foo { /* * @param $Boo, pretty please accept type Boo here */ public function bar($Boo); } ``` will be equivalent in 7.2? :( Regards, Aidan On 28 May 2017 at 16

Re: [PHP-DEV] Parameter type widening RFC

2017-05-28 Thread Rowan Collins
On 28/05/2017 14:25, Rasmus Schultz wrote: With an explicit mixed type-hint, you can still achieve what you want You are making a valid point in general, but you clearly haven't read or understood the explanations you've been given why an explicit mixed type-hint will NOT achieve what the aut

Re: [PHP-DEV] Parameter type widening RFC

2017-05-28 Thread Rasmus Schultz
Alright, here's an example of code where a type-hint was accidentally left out. Before this change: https://gist.github.com/mindplay-dk/e988902ed2d587dc05a1d8cb164b88c4/4d03babff16883a67accfb51b50e3d1aefb13a8a And after this change: https://gist.github.com/mindplay-dk/e988902ed2d587dc05a1d8cb16

Re: [PHP-DEV] Parameter type widening RFC

2017-05-28 Thread Christoph M. Becker
On 28.05.2017 at 12:30, Rasmus Schultz wrote: > In my opinion, this will very likely lead to a large number of accidental > type-hint omissions - and a very, very small number of actually useful > solutions to real problems. > > In my opinion, we can do much better than that, by adding a mixed >

Re: [PHP-DEV] Parameter type widening RFC

2017-05-28 Thread Niklas Keller
2017-05-28 12:30 GMT+02:00 Rasmus Schultz : > > > So this breaks the expected behavior of interfaces. > > > > No it doesn't. It allows interfaces to use contravariance within PHP's > > type system, which is different from before, but it doesn't break > > anything. > > The RFC explicitly states tha

Re: [PHP-DEV] Parameter type widening RFC

2017-05-28 Thread Rasmus Schultz
> > So this breaks the expected behavior of interfaces. > > No it doesn't. It allows interfaces to use contravariance within PHP's > type system, which is different from before, but it doesn't break > anything. The RFC explicitly states that this is *not* contravariance. And if it's not clear, wh