Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97951 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90723 invoked from network); 25 Jan 2017 07:30:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jan 2017 07:30:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=inefedor@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=inefedor@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.49 as permitted sender) X-PHP-List-Original-Sender: inefedor@gmail.com X-Host-Fingerprint: 209.85.215.49 mail-lf0-f49.google.com Received: from [209.85.215.49] ([209.85.215.49:33620] helo=mail-lf0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A4/5C-00729-30458885 for ; Wed, 25 Jan 2017 02:30:11 -0500 Received: by mail-lf0-f49.google.com with SMTP id x1so37271932lff.0 for ; Tue, 24 Jan 2017 23:30:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=cO1p+wX0rbMDQCTxCc6EY4VVUWwjGavE7HEZTWimAw0=; b=U1fX0ckjoHMlxXyky8z66Y1NyifJ9Er8D5jFUtmstcUeq/Qmp5F687pXYq7E3lhz4R HG3DtFy74QLBmLh20Fk2JVUVaMhpGKs/U9SLbgln9OcKTcpAkTzlYQj146Ep2ZckzUlZ +uAVcopo3vZgfP1805mPSWHK7bHlo46grcf9kYZgRZvUC1N+1FUgI2GIDJ2I6AR8O60k oHqZBokHyCOzAa0JDz1GWyH9rBAgub9qQ+n0tGX/Iz6plNZr32yqs8b5KCmL+8VdZtoL FWZuyLfXw3GoOARabn1qzGXbaw3/Fnutvh+Zi9eSee5Q1BKVrvRI8gs4Px0cYc8Vt85N lh+g== 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=cO1p+wX0rbMDQCTxCc6EY4VVUWwjGavE7HEZTWimAw0=; b=AR4VheVWgx65bdTpf2ovHOYNwKJT+dSMPpZoMePh8GVk/TNtbIrDQIs34THn5zOSEz iaplnCXtVvkCza+SHd5VA4ZzCF9ho69Qg+4dMgVRKaNp/1c8wL/tLCYiv28htIchzmy4 lkZKHB+8zYeuCSRG58DV6UE7Z8kwIhM3q6OIsCvLR0kZEDqqA0yJWX6FQRSbFwJ9VyMv 3UsNTaEN/r2nDrT/Qa5HKfEyte4l+cF+6HN9nGIBjS0UOylv7S1nMns3D5tmzmlyA6mR wP+UXYfX0gd5M6JkJpqlXdGBWcgIBTPFOJa+hxQIRrDI4zbS29Y2Ol4aoLTf1GqaJAtX ejMQ== X-Gm-Message-State: AIkVDXJekOev+KQPddKa0fDnnDQTebTz8gMmKWLrgZbO1Y4oEzhKKiVd8RlhcJR7hCIlGw== X-Received: by 10.46.22.15 with SMTP id w15mr14644483ljd.35.1485329407628; Tue, 24 Jan 2017 23:30:07 -0800 (PST) Received: from [192.168.88.252] (broadband-95-84-178-41.moscow.rt.ru. [95.84.178.41]) by smtp.gmail.com with ESMTPSA id i1sm8059103ljb.15.2017.01.24.23.30.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 23:30:06 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) X-Mailer: iPhone Mail (14C92) In-Reply-To: Date: Wed, 25 Jan 2017 10:30:06 +0300 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <7B68DE87-4622-4209-A0B6-6AFDFBC3AC38@gmail.com> References: To: Scott Arciszewski Subject: Re: [PHP-DEV] Class Constant Finalization From: inefedor@gmail.com (Nikita Nefedov) > On 25 Jan 2017, at 09:48, Scott Arciszewski wrote: >=20 > All, >=20 > Given that we can now declare a class constant as public, protected, or > private, can we also declare them final in 7.2? >=20 > https://3v4l.org/rJG0V >=20 > Ideally, this code would error on line 18 rather than 15. >=20 > Scott Arciszewski > Chief Development Officer > Paragon Initiative Enterprises In my book, ideally, there would be no class constant inheritance as inherit= ed constants don't really make sense when they are known at compile time. Pe= ople often use this feature in order to get things like this to work: class LibLevelClass { const FOO =3D "default"; public function doSomething() { echo "the value of FOO is: " . static::FOO; } } class ExtensionClass { const FOO =3D "custom"; } But this approach is error prone due to untyped nature of constants (one cou= ld override the constant with an array value). In the end this inheritance i= s always unnecessary.