Re: [RFC][Vote] Typed Properties
| From: | Bob Weinand | Date: | Fri, 10 Jun 2016 14:12:34 +0000 |
| Subject: | Re: [RFC][Vote] Typed Properties | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93866@lists.php.net to get a copy of this message | ||
> Am 10.06.2016 um 16:00 schrieb Niklas Keller <me@kelunik.com>:
>
> 2016-06-10 15:50 GMT+02:00 Bob Weinand <bobwei9@hotmail.com
> <mailto:bobwei9@hotmail.com>>:
>
>> Am 10.6.2016 um 15:34 schrieb Niklas Keller <me@kelunik.com
>> <mailto:me@kelunik.com>>:
>>
>>>
>>> Top-posting, since I'm taking off now.
>>>
>>> From outside the class, properties are not visible at all, so their types
>>> are un-important from outer scopes.
>>>
>>> echo $foo->bar; is not the same in instance method body or outside of the
>>> class.
>>>
>> From outside it works just fine and doesn't throw:
>> https://3v4l.org/L8CqF/rfc#rfc-typed_properties
>> <https://3v4l.org/L8CqF/rfc#rfc-typed_properties>
>
> This is an intermittent bug in the implementation.
> the RFC is explicitly mentioning that it should throw and throwing also is the correct behavior
> here.
>
> I don't think this is and should be a bug. I think it is the right behavior if we choose
> to throw at all.
In this case a definite -1 on the RFC from me. I don't want "surprises" regarding the
type if a property is declared to return a certain type.
Bob