Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115842 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45346 invoked from network); 25 Aug 2021 22:25:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Aug 2021 22:25:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 49FCF1804AD for ; Wed, 25 Aug 2021 15:59:34 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 25 Aug 2021 15:59:33 -0700 (PDT) Received: by mail-qk1-f170.google.com with SMTP id a10so1226577qka.12 for ; Wed, 25 Aug 2021 15:59:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=RzWttbxWb41gtaeo/dMEiEEhDocIpOXarAhmQ4znRuM=; b=Prv+Ew0me56n2/U0t5ArEh+/xt4uvjlqQsGD6Pjl35dEhK+GyQufofJUixU6yyh158 R27MK2vK1CUFIBz6gwbY1lUQHUDa+zvLHJdTsB5Ou08ZU48YAx4LY4zrwJioBCa5PfGo 5n5CkCBnZxlZuaRtIxhA1o7rsUBdN8/zSJxnH9y2xkhdnislfwESuaU4Kn8zjM2A7TOH k2lelx4OB/7f8yl1NrplV+2D54KdF2EoDq+OF3CFdyUjOnhYUHcKKRfkLsTQX/tOp9qv /wK22N2Zsc3AncKGEwcwN+8AEEUuTY7GyhtJ7JN+0NGG8a8hkLb9/IOq0Fs01aCAOOeO ikkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=RzWttbxWb41gtaeo/dMEiEEhDocIpOXarAhmQ4znRuM=; b=LWmc5i+6vcmJNsuV9Yu0zmwzh8GkzuX1a9pqlYxX71Vo4T9DXY7o+5ByJ9dER3V1hH Kb0ZHrkrYM87dBSG8YI29hhDXUOP+5t6vBYBlctf0BqAUtfHoz0W7RT+LitQMswVevHH N+ku8RKx9a3b7l04YlVHJ0qwu8Z9acjcpFN0z1DEb54a3V7ifU7o+rd2RiQNxbqT2qy2 EsP4QkNJerbB3wur+qRM1FEmamn3RXRu81YwoVKz/hoLojTSPD7VSFB9rfvGhl8CBhZB IXhFSF/B6VyG0AWfubFMqukkvxSMlCmrFbKCo1cuP7iR0Th8mXW24X2XClgxP6AoaioC 4AdA== X-Gm-Message-State: AOAM533GqtsTa9XAFWcD5L1coB+7Pb0hvfWBBhzXrpDKSUQ+PbjN7bPA 8Xhw4HA74AwyY13wG9G39vjkfjh+9mtKAWV0 X-Google-Smtp-Source: ABdhPJxO3I+XxvZ6OKcqgG9qvTiNLpjfMXKQkBQz5yXfeh0VbcYKVp5hK8sQdaD+6QVtudvMBX8LGA== X-Received: by 2002:a05:620a:1671:: with SMTP id d17mr947745qko.191.1629932372209; Wed, 25 Aug 2021 15:59:32 -0700 (PDT) Received: from [192.168.1.10] (c-24-98-254-8.hsd1.ga.comcast.net. [24.98.254.8]) by smtp.gmail.com with ESMTPSA id d68sm1103914qke.19.2021.08.25.15.59.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Aug 2021 15:59:31 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) In-Reply-To: <9bc86399-66d3-a6f3-f246-048be850369c@rhsoft.net> Date: Wed, 25 Aug 2021 18:59:31 -0400 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <763725c0-870b-e8c4-054b-1ea0481ef877@gmail.com> <476A4FAA-ACEB-428C-A3E8-990464F9F98C@newclarity.net> <9bc86399-66d3-a6f3-f246-048be850369c@rhsoft.net> To: "Reindl Harald (privat)" X-Mailer: Apple Mail (2.3608.120.23.2.7) Subject: Re: [PHP-DEV] [RFC] Deprecate dynamic properties From: mike@newclarity.net (Mike Schinkel) > On Aug 25, 2021, at 6:41 PM, Reindl Harald (privat) = wrote: > Am 26.08.21 um 00:37 schrieb Mike Schinkel: >> That said, I'd be really interested in seeing use-cases where having = dynamic properties is essential to an architecture and where it could = not be easily refactored. I cannot envision any, but I am sure that I = am just limited by the extent of my vision and so would like to know = what those use-cases would be. >=20 > public function __get(string $subclass) > { > $include_file =3D = "{$this->basedir}/modules/{$subclass}/api_{$subclass}.php"; > $class_name =3D "cl_{$subclass}"; > if(!include $include_file) > { > $this->misc->trigger_error("API-LOADER FAILED: '{$subclass}'"); > } > $this->$subclass =3D new $class_name; > $this->$subclass->cl_api =3D $this; > return $this->$subclass; > } Easily refactored: public function __get(string $subclass) { if (isset($this->subclasses[$subclass])) { return $this->subclasses[$subclass]; } $include_file =3D = "{$this->basedir}/modules/{$subclass}/api_{$subclass}.php"; $class_name =3D "cl_{$subclass}"; if(!include $include_file) { $this->misc->trigger_error("API-LOADER FAILED: '{$subclass}'"); } $this->subclasses[$subclass] =3D new $class_name; $this->subclasses[$subclass]->cl_api =3D $this; return $this->subclasses[$subclass]; } -Mike=