Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125748 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 DF08D1A00BD for ; Fri, 4 Oct 2024 14:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1728053451; bh=1POexMkzKYDrb2z/xyXZQbiof6f2C8pqjfNabUrWSL4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CpHX4Urjk2K2fU+csAGKisU06VMRr9ftmvQYdQOlivViOF48q25QVyJRP8nt+gvUG /aiKlU7xuT8PkoasNCtxwuTOlfnfEuaWF/qyU9jdELqaAPL8BzlqVQgst2BmZ2Bjki bpQKkHpBhbyeSWoRlx7LyDUslX/k2zWJb3zErrUba9t23nIFVhba2e8QHBrkUEGjBN 3R7OTgO5If505tZZ8oyRSqdmsmksMrEpWc+Ryyz3fwcRDkq7AjttC9yFMlIIFRoong odcsUfXn6W4jO1uTBslkVA+tC/YT02WwPi2P96BPNpDM9/0dXo2+yogsYE5Sx+d5HN rTPZHNgQrdiBQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 73F56180032 for ; Fri, 4 Oct 2024 14:50:50 +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 autolearn=no autolearn_force=no version=4.0.0 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 ; Fri, 4 Oct 2024 14:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1728053314; bh=Td7AneVJLNMwamcfNEA8iRBy+cF/h5EinqsJYpuu770=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=i0gdc7UGIRCCq6b8F1+yxSpyQXXRNgccDggFSR6BfgoTsGLcPeUoSlwL0P8VtLOHg 74kC1MBfuRUNlrejn7fMIX32GQA274vp2qAXPvM5er4Q80uf6gbCsTH6O0k9H8sUVp 5jPnj92WOHSgsgJox9uTjWPnnUqgZCfa4h3+eYBJp/6FEb3vajXoJz23GCGQJYoUCI 95T1IHudm2Sznjrs0Vzx40MZmvRQ5ZIK/NrmvBGbCTf9Lsce/WKABPTo2dV03OE5m1 I4SoOCGOrN4tz5vxZde8leLfneUUJ+rxoJEgZalcI/ei+3Hlpu6r4VTSzpgquS3kfX shQkmrr0pJNgA== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Fri, 04 Oct 2024 16:48:33 +0200 To: Valentin Udaltsov Cc: php internals Subject: Re: [PHP-DEV] Asymmetric visibility Reflection API problems In-Reply-To: References: Message-ID: 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 This thread is a good example why RFCs with a large impact should ideally be implemented well in advance of feature freeze. Am 2024-10-03 15:32, schrieb Valentin Udaltsov: > Here's why it works this way. Internally properties with symmetric > visibility do not have an asymmetric flag. That is > why `private private(set)` and `private` both have `isPrivateSet() = > false`. Readonly properties without explicit `set` > imply `protected(set)` [4] and thus they are symmetric when protected > and asymmetric otherwise. I personally don't > agree that Reflection API should stick to the internal implementation > details. On the contrary, it should hide them and > make it easier to study the facts about the code. I agree. The RFC specifies: > The ReflectionProperty object is given two new methods: > isProtectedSet(): bool and isPrivateSet(): bool. Their meaning should > be self-evident. Clearly it's not self-evident, and I would intuitively expect that a `protected Type $name` property is `isProtectedSet()`, because it clearly is protected set. > - `ReflectionProperty::isPublic()` returns `true` only if the property > is symmetrically public. For `public readonly $prop` > it will return `false`, because it's implicitly `public protected(set) > readonly $prop`. This is a BC break, but a > smaller one, given that libraries now take "readonly" into account. With this I disagree. The hydrator / code generation use case you mention is generally intimately tied to the capabilities of a given PHP version. Any new feature in PHP can affect the behavior of such code and thus needs to be evaluated to see if it needs to be taken into account to ensure correct behavior and asymmetric visibility is no different. I would not expect my Hydrator to work correctly with a new PHP version, unless specifically marked as compatible by the author. Best regards Tim Düsterhus