Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130671 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 17AB91A00BC for ; Mon, 20 Apr 2026 09:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1776677543; bh=HuiNIcM6Ei/Zr7s2xfiBeobZjd1VBmmBG4zJ0gMb4nY=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=mlY1dp0SLWj5m6XDHnVcoLPjK/nAiaZCsJZQhMxtGUyC+nPCpFTn1SoCvvo/Q5HQN FMD7oBbk//CUbImpTMEBXaQKGJZ5pgh7YnlkCtBd7WEQImMdzhmWOBnzAhSrgsQxxm Ukv5W5LKVdLV++wSwksnBJ8jl6pm6mYcwdw/4PrMWYxpYqLjLHqtGC1k9OQsKr3FAA FhBJYzMrCeB8OIDCzb2RtmxMK7aJ1p25AKab/DbXcVfb/U6dgsYyAsYBYDbjVhp+a1 WbpW5cJpLTfnjDbnk+WKsJYV8pxXD6Ut56emlLuXAAZMwtLfjIrhWZBlFt7tkPKgGN eviEOC3zE+hHg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 177A81801D5 for ; Mon, 20 Apr 2026 09:32:23 +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,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 ; Mon, 20 Apr 2026 09:32:22 +0000 (UTC) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-48896199cbaso29956945e9.1 for ; Mon, 20 Apr 2026 02:32:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776677536; x=1777282336; darn=lists.php.net; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=z2y2GYIofORMFvEzGtlRlAsRo3ccpasusONon0nfpo4=; b=U/7jG/q7kUh/UrMp4aDnhroq7vTg6LzXE5DKdxD+7k2ubuaK6n2j+L6VWEE1PwjKp0 WpY9GaObHpfqNGo2agRGTkNykFL3/BZPMDQylthM8qnKMDE8mn2XEzYAnQve5s8eObrq G8hw1ele7Eq7kwXANnJCsQc+jXqs33rEDH+ErhQHwHcMsA28gmPR8CJSoyK/nIkRwbjL 9HdJYEK0KcWgWd2LhHv3BZDADWse09wJDmIKs6BkODoAHNXJZgCg6M2ljuGNTxqjeJLh 8VvOYem5Okfm269ZW+82XNtB1NQHUdCTI6z+k+TFsvkPDrFFyG7vvLJGY7LLZ6d1DlqU 7V3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776677536; x=1777282336; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=z2y2GYIofORMFvEzGtlRlAsRo3ccpasusONon0nfpo4=; b=FqD/tBt0/cN0sXM/59tlrO5UTkq0YsTtlOEPYzVCEpqlr8its2dYli4dWJ1C46T2i0 ke3yYQJ83xwVfkqxOzueBOuKzjukTK+gWWfqIvZCm84CIpujojx9O+Zui3aRuQ484szY rTky7ed9AJHjRHRjHyAP7Ynk9c53uDl3XCo6J2xS4daef8pQDw9h8jgg4gfMmpgGefXE 8Fsy6nUokzpBKfO6S/DgCBEOwCq/XEMke5l1goIuf83KEgAyfLbfYKubGGTzV4I5N7y7 FEEyD66U61nT7J+qmqh4GmT7E64SeX/YGJXfw3afGmbHhSpo7dZcDVjEFhVw40DPbSC8 VRBg== X-Gm-Message-State: AOJu0YxXw10KkPEGuvPTvDqc9Pg4oL9zK8ZIj5qGTosG8y67lH4SipmJ 4dER+1ifKGkSV6nLc4ALrWPJdqJsCj+bhuo2Vs5wrN/jHnwDgQjvymaE X-Gm-Gg: AeBDiesMTUMw9q/EDmhmhh4WlP0QHcrG0YW0VFQlAuwPuY1IYOR70x0snq1ojRz6bVK jkkVqkZ63Hfag95RJhAkVxQeiu6PlmYeqThSaIZvl93/TnQgHvNR8RMIURmeugV/VQN8q1Vk30x fXelF/RPLaWn4y9EQsY9f04R+19wDLMclnYye6LqWvtZeQkA510OZWuGWB7LSRRAPTq00abpkg9 d7swyadZx/kHHTECzJMXx7KvmWDoaLZWsPH4gDt/2VsW0tRrP9v1PbLD4YFW4EPMsjwE9OdDzPt PPYITzwzurNr4ss5qimM6x1syKvWnXvEokkD6mNwv1vNGsU6Tji08aAt1Z0SjBqg+XgptBCtT9o 1e9NeLSVL3aJKeCsupQOYLsziCW2Kxq6cO8aLhVexT6C4YqdzBwdicYQuKNZmpwyx7GH/j9IE5w DohXbWOURp35P8bRmyStxf9+Z5yDadgyFDMcS28Y2r90pdjtoFE1eDOh63 X-Received: by 2002:a05:600c:1554:b0:488:9bf8:7f17 with SMTP id 5b1f17b1804b1-488fb77810bmr187162245e9.14.1776677535224; Mon, 20 Apr 2026 02:32:15 -0700 (PDT) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7aa593sm86870755e9.24.2026.04.20.02.32.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2026 02:32:14 -0700 (PDT) Message-ID: <0AC29ACC-3CC5-4285-B5AF-093DD022253B@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_85F25545-7616-403A-AC7F-4E615F4545B5" Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: [PHP-DEV] [IDEA for RFC] class_uses and optionally returning traits for parent classes Date: Mon, 20 Apr 2026 11:32:03 +0200 In-Reply-To: Cc: internals@lists.php.net To: Robert Humphries References: X-Mailer: Apple Mail (2.3864.400.21) From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_85F25545-7616-403A-AC7F-4E615F4545B5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 19 avr. 2026 =C3=A0 21:01, Robert Humphries = a =C3=A9crit : >=20 > I think this is > the strongest argument for making such a change to `class_uses` - > currently it is inconsistent with the other SPL functions (and I > wouldn't say that modifying the function is going to cause millions of > developers to start using the function, it is more about making the > behaviour a little more consistent). I think that `class_uses()` should never have been implemented, because = it gives a false sense of symmetry with `class_implements()` and = `class_parents()`. Implemented interfaces and parent classes can be used = as types on the corresponding object (and types are inherited), while = used traits cannot. Those are fundamentally different concepts. If, for some reason, you want to =E2=80=9Ccheat=E2=80=9D and use traits = as if they were inherited types, you are free to do that, but I don=E2=80=99= t think that PHP should provide a built-in function that goes beyond = what traits are intended for. >=20 > (As a quick side note, what I am really looking for proposal 2 from > https://wiki.php.net/rfc/traits-with-interfaces (or a form of `trait` > that does this) and then using traits with interfaces for composition, > however from what I can see on activity such as GH-11435 technical > reasons mean this isn't likely to proceed). See also https://wiki.php.net/rfc/interface-default-methods, which is, I = think, what is really needed. =E2=80=94Claude= --Apple-Mail=_85F25545-7616-403A-AC7F-4E615F4545B5 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Le 19 avr. 2026 =C3=A0 21:01, Robert Humphries = <contact@developer-rob.co.uk> a =C3=A9crit :

I think this is
the strongest argument for making such a = change to `class_uses` -
currently it is inconsistent with the other = SPL functions (and I
wouldn't say that modifying the function is = going to cause millions of
developers to start using the function, it = is more about making the
behaviour a little more = consistent).

I = think that `class_uses()` should never have been implemented, because it = gives a false sense of symmetry with `class_implements()` and = `class_parents()`. Implemented interfaces and parent classes can be used = as types on the corresponding object (and types are inherited), while = used traits cannot. Those are fundamentally different = concepts.

If, for some reason, you want to = =E2=80=9Ccheat=E2=80=9D and use traits as if they were inherited types, = you are free to do that, but I don=E2=80=99t think that PHP should = provide a built-in function that goes beyond what traits are intended = for.


(As a quick side note, what I am really = looking for proposal 2 from
https://wiki.php.net/rfc/traits-with-interfaces (or a form of = `trait`
that does this) and then using traits with = interfaces for composition,
however from what I can see on activity = such as GH-11435 technical
reasons mean this isn't likely to = proceed).

See also https://wiki.p= hp.net/rfc/interface-default-methods, which is, I think, what = is really needed.

=E2=80=94Claude
= --Apple-Mail=_85F25545-7616-403A-AC7F-4E615F4545B5--