Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129178 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 lists.php.net (Postfix) with ESMTPS id 7F5E11A00BC for ; Sun, 9 Nov 2025 19:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1762718140; bh=RA+LQbPoaz8bO4g3g5Vd99jVmcOdnt7iH945MfrWF2o=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=EU/f74v3PyA0ATYLPH0GX+gIBv5LQ2w5gdFlA4Nkhsr6ScFjlxQ2k3hTr78ExgCrK YxcZv/EAauUpfanDxdiRaz4E7JNrzDZEfii1mRt+UWeP7LB0/ewewHYNDiqa4gTjnr uqCowZmfCTMGTYXPiUFXVYeABV/kU0dTN/TWonXc2O2WfJXOeVLqp7sXDJKBcOOBVK 5Bmfs5Ctpdbkg9qQp3/HGPvqT2eOfid7IKCat9JOioL+ZMG4RXM/4vfAs8bvpxVt86 5Fg5ic9GxK3nhMEimDJ6uO7oVc3IfWngj5DN5/pOQRGUpRz0GKiD2jN8kwU+phWoH1 yeHPjwK0Ui1WQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4727A18002E for ; Sun, 9 Nov 2025 19:55:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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 autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No 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, 9 Nov 2025 19:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1762718132; bh=YrvCypIiCkk2RFFC6d4eIczvxd2+XMy6tlyMEARyREw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=lbgwellvsj83ornPjjs0Wuei21mKeBWomD2zsuVJlOFnGpDu9ivGexUPgxWdvxpoA T0dNIS/B/pWMPmjJ/wYZ35+0oTxl7k6ZyYolxiVR/FcDIaAjHO7NuvMZqhyXwrQUjd Kccrk5ioywCT4wXi1fC/YL744BB4YD1ImKYoZODOGKvcjpwql8FFEff5WWRk8x/ugi aQ9TX2JOVgJ+vbBUWec+NrhaGfQh+DavsIHzgZgT7Uo4jd53QHuHggaMAfprwiVQ5i 5eKH0X/3elJ6elrWGMv8Og3iV60zRQEL0dYkpx1Tf6JdHPSC0ml6ii0KrvLsQVMpDM qhB2Eq2HUrh1A== Message-ID: <475570ea-ff3f-4eb2-bbe6-8f86760ac5e3@bastelstu.be> Date: Sun, 9 Nov 2025 20:55:31 +0100 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Subject: Re: [PHP-DEV] RFC: Namespace-Scoped Visibility for Methods and Properties To: Rob Landers , =?UTF-8?B?QWxleGFuZHJ1IFDEg3RyxINuZXNj?= =?UTF-8?Q?u?= Cc: PHP internals References: <7e17ab87-294f-450d-9afc-d23a5b919cc5@app.fastmail.com> Content-Language: en-US In-Reply-To: <7e17ab87-294f-450d-9afc-d23a5b919cc5@app.fastmail.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 11/9/25 20:41, Rob Landers wrote: > class P { > private(namespace) function x() {} > } > > class C extends P { > protected function x() {} > } > > This behaves the same as overriding a private method with a protected/public one today: the parent’s method is private to its declaring class, so the second example is allowed. This is unsound. As we have established, neither `private(namespace)` nor `protected` is a subset of each other. Specifically allowing this breaks the following (everything is declared in the same namespace): class P { private(namespace) function x() { } } class C extends P { protected function x() { } } function f(P $p) { $p->x(); // legal, because f is in the same namespace as P. } f(new C()); // breaks, because C::x() is protected and thus not legal to access from f / the global scope. Best regards Tim Düsterhus