no please no "mixed" keyword

my idea to this is having something like this:

class Foo { public function test (int $a) : int { return $a; } }
class Bar extends Foo { override public function test (string $a) :
string { return $a; } }
class FooBar extends Foo { override public function test ($a) { return
$a; } }

or maybe this too
class Bar extends Foo { override private function test (string $a) :
string { return $a; } }

so you have to mark the override explicitly
if you leave the override keyword it still throws a fatal error

dunno if this is a good idea or not, just my 2 cents

Regards,
Jan Altensen (Stricted)

Am 26.11.2016 um 16:54 schrieb Niklas Keller:
> 2016-11-21 12:59 GMT+01:00 Christoph M. Becker <cmbecke...@gmx.de>:
> 
>> On 21.11.2016 at 10:39, Niklas Keller wrote:
>>
>>> 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 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.
>>
>> Have you considered that instead of simply omitting the type
>> declaration, one would have to mark the omission explicitly, to still
>> get a compile time warning in case of unintended omission
>>
> 
> No, not really. While we could use "mixed" there, those signatures _are_
> compatible without it and shouldn't throw a warning.
> 
> Anyone else interested in the usage of "mixed" as an explicit type
> declaration?
> 


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to