Am 12.01.2017 um 08:11 schrieb Tim Bezhashvyly:
> Disallow explicit call of __construct method

I am baffled that this (still) works:

$ cat /tmp/t.php
<?php
class C
{
    public function __construct()
    {
        print __METHOD__ . PHP_EOL;
    }
}

$o = new C;
$o->__construct();


$ php /tmp/t.php
C::__construct
C::__construct


$ php --version
PHP 7.1.0 (cli) (built: Dec  1 2016 07:39:00) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies

I am in favor of an RFC to disallow explicit invocation of interceptor
methods such as __construct().

Can we do this in PHP 7.2 or does this have to wait for PHP 8?

> Polymorphic dispatch

You mean dynamic dispatch of polymorphic methods, right?

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

Reply via email to