Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124099 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 7139C1A009C for ; Sun, 30 Jun 2024 14:31:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719757963; bh=G0g6iy0wb+2A0Evaep9eZiR8IuVBj3dTmoH5k3uH8LA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=oLlffdZL2q5/fA5RUPHtByxYDiLf8NOGecerS4YeTL7evHDXF02XxDaaUFOxTMwDx ilByuDd5Guk2HkPSQB14r41SzE5Bb2WJojQ5ArFoA1QHQnwsCNda68P0tyZit29A36 CdG/f+NugRk+BXOgULMiYaezZ957ywA+259uJoLEt75Uct8k0U3M+bdv2QtyvPfK0j /TkUfrKgcHZkZ+DF6atIrjTMJxh+jGsFL3uLClvsL1ZJ5npkHaAnFY8xjGsZggL57U jhsM+BAcGgd28cpRdj+Y+gAuuApYtjEjN4S7kM5oZxKGqig29uFWvQrqKGC54JmWS7 W1svRJjd3N4AQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 63BD41806D2 for ; Sun, 30 Jun 2024 14:32:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 30 Jun 2024 14:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1719757880; bh=nvVD9crTyWd/MpbIZsR7gnXlbVyskLxRi5I7GLv3URE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=WW63rBE0AE1YmG3hfonhe8dOseE1MyElmCNBrIpM5XK68+DJK62IHwp20J5e3zknO CZJ3eK7L1cHQqUwUiaSxhed4lB9c50/iCF71NPEpRBnqvr29yjwTC6ANBC/XHuaSYV 43mkXCBGOE8HeLBXMxDoiOe0CMOMKn/msHdDzBw1Iq0wdo0AA73cqFYXkQCwHlx5wQ H/BdFvN/38q21a5iVAlAHshc2YeDBnWiz6Ap88GHPOs6Rpt4joX9CLjvPM/l9EdhNE zeYqKii5PVN9yEtu9Q15K/Wa1fj1To0eNUZFnSUCo2w5NrPAOlbI9uGG9h4iXwGHs7 XouXnWglMl1uw== Message-ID: <26091fb5-3783-4099-bc8c-3bdc138e33b3@bastelstu.be> Date: Sun, 30 Jun 2024 16:31:19 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Subject: Re: [PHP-DEV] [RFC] Static class To: Bilge , Ayesh Karunaratne Cc: php internals References: <834e3a0f-19c2-4665-bd8e-c05c61e48231@scriptfusion.com> Content-Language: en-US In-Reply-To: <834e3a0f-19c2-4665-bd8e-c05c61e48231@scriptfusion.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi On 6/29/24 17:56, Bilge wrote: >> - Why is it a class-level flag and not an attribute (similar to the `#[Override]` attribute in PHP 8.3) ? > I believe Tim already answered this, and I understood his reasoning to > be that keywords are used when they modify behaviour in a way that is > meaningful for the consumer of that class. Or to put it another way, > attributes are purely informational. For me personally, introducing an You understood that correctly. The forward compatibility argument brought forward by the other participants is not really useful either, because consider the following: #[StaticClass] class Foo { public static function myFunc() { } } class Bar extends Foo { public function myNonStaticFunc() { } } This would work fine in PHP 8.3, but break when upgrading to PHP 8.4! By using a keyword it is guaranteed that the code only runs on PHP versions that will reliably enforce all the constraints, preventing this gotcha during a PHP version upgrade. Best regards Tim Düsterhus