Hi all,

On Thu, Mar 17, 2016 at 8:30 AM, Johannes Schlüter
<johan...@schlueters.de> wrote:
> On Wed, 2016-03-16 at 15:29 -0400, Phil Sturgeon wrote:
>> > What's expected here:
>> >
>> > class A {
>> >   public int $i;
>> > }
>> >
>> > $a = new A();
>> > $r = &$a->i;
>> > $r = "foobar";
>
>> I put your code into 3v4l so you could see what would happen:
>>
>> https://3v4l.org/taC8D
>>
>> Fatal error: Uncaught TypeError: Typed property A::$i must not be referenced
>>
>> Is that what you expect? If not, what would you expect?

I expect work like parameter type hint.

[yohgaki@dev github-php-src]$ ./php-bin  -a
Interactive shell

php > declare(strict_types=1);
php > function foo(int $i) { $i='abc'; var_dump($i); }
php > foo(123);
string(3) "abc"

PHP is not strongly typed language (at least now).

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net

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

Reply via email to