Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104635 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 797 invoked from network); 11 Mar 2019 00:07:17 -0000 Received: from unknown (HELO mail-wm1-f42.google.com) (209.85.128.42) by pb1.pair.com with SMTP; 11 Mar 2019 00:07:17 -0000 Received: by mail-wm1-f42.google.com with SMTP id f3so2444845wmj.4 for ; Sun, 10 Mar 2019 13:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=kGMkkEVxR044XHEJuFgK7Z8e1ssttqbuSFl77q6R2dY=; b=DXEv1O15IHGJocROm7rOQk1aV5HAkzlOSROJsuserpod3k96CHIQCe+0RQ14+Uj3hA RxmimOPu9G0A3hn4wFKEFACtKUHO91pA4Xu9SpXhBW+keWHuI35h/TEvHlwUvQzix8kf o4sLk1iUzVGTmFs52fxZAEOJLgKf8yzUmHonkFgmlQVS5wVLvT5HhHwjBODKguE8rSFA x+fel84eBR00evef8H8GPe94aosjBoU2TMM2x7wTUSeo8KmFybIdZ37oMYI6dJSngmPW dcx7KnSYnO52uK01MFFdc48kiYsOJBg3UeaM1TL7kdDObvR5+IMeuq+dVY3P1RekKgaV XXAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=kGMkkEVxR044XHEJuFgK7Z8e1ssttqbuSFl77q6R2dY=; b=pEAbGPbX+wzIXZJSCSqNuVkCQDOZyKCqsTbSe7Jayv5CCU4fNV88PhcJ5hcuXdWmt5 T0snMylSung6urR14vDHD6kIg7vHOlfYLWqN+jn7tReOWBL5+n0hG7KLawtKLYugW9a4 /4pWIs9Z/UtkIMsRj0pKjEq7iQU+4aCxdjS9ttTwmodFARm/AMM9vc7CHFbeW6NqhqY/ L0IxYMVYXOfDZ8ODR5xNMtXULAOPxj5sRnV6Ou54Tv/+TOX6Qmi7ijg5CX+2cFeBiOpl 1jzA7jgTN0w+Jm2DfcGOZpAsXQVcu/z4BNZwGMJOCdim+ZiF1WpRzXdbxrANQu3IN33+ P6qA== X-Gm-Message-State: APjAAAXdPddLill6kw6aYRuyl8T4T45g+d623e15vqzPbe2gB1Wb6av1 PYEliFaz6UA3ka51bNTkrM7P3GZa X-Google-Smtp-Source: APXvYqw19akZ26bMgZgPqdmI7ijLZjbx64qemKRWeD4A8wFOGszbKbI5iMUQgF62DF6b/HDQEA/wGw== X-Received: by 2002:a1c:7610:: with SMTP id r16mr15124726wmc.139.1552251404607; Sun, 10 Mar 2019 13:56:44 -0700 (PDT) Received: from [192.168.0.16] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id g3sm8463588wmk.32.2019.03.10.13.56.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Mar 2019 13:56:44 -0700 (PDT) To: PHP Internals References: <2c497732-96f8-3ef0-bc18-912220fbff4d@gmail.com> Message-ID: <78aa28fb-28dc-0ecc-23bc-b0b8806d1e46@gmail.com> Date: Sun, 10 Mar 2019 20:56:43 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [PHP-DEV] RFC: Locked Classes From: rowan.collins@gmail.com (Rowan Collins) On 10/03/2019 20:19, Dan Ackroyd wrote: > trait LockedClass > { > public function __set($name, $value) > { > throw new \Exception("Property [$name] doesn't exist for class [" . > get_class($this) . "] so can't set it"); > } > public function __get($name) > { > throw new \Exception("Property [$name] doesn't exist for class [" . > get_class($this) . "] so can't get it"); > } > } Incidentally, this isn't quite equivalent to the current RFC, because it will also intercept access to private or protected properties from out of scope. It doesn't make much difference other than making the error messages less helpful, but it's an example of how a nice userland implementation isn't quite as trivial as it first looks. Regards, -- Rowan Collins [IMSoP]