Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116831 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 79972 invoked from network); 6 Jan 2022 15:13:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Jan 2022 15:13:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BE3FD1804F8 for ; Thu, 6 Jan 2022 08:20:48 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 6 Jan 2022 08:20:48 -0800 (PST) Received: by mail-wr1-f50.google.com with SMTP id h23so5866370wrc.1 for ; Thu, 06 Jan 2022 08:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:user-agent:in-reply-to:references:message-id :mime-version:content-transfer-encoding; bh=inGHCOVFKy3yUBazOjYZQZ1tO4aNBAzNZoiejyVr4LQ=; b=US/WLLgGjrkym0s9TDu993ncG9kimFj/ZGCgtInnNcaacseGjFC8otgz/5/TyBmv+e Jsv9g2ox0e/iHyjJUSSgtyV64Iz6+RR/4KDLGsFwuLraOXhWs4lHhqRTCofDebzpphLA SApM1UZUmX+QqptNqrpFyh68FO3YvkYhdkm5Ff4dvAYP6dLZhnyUiFxeDC++yys7OLSg B4C4J6QRAm5WAmKC2Wy6a+lo3KGjjhTprQGvPjOtX7y9c0ny791AJsL4lAhRe1AwfLxx GVCNJpYNMgcReWx04Ovd2q+gj24exnEvIZPsGAHIg+jSM90VoWWClJt989uYylvajjyN dKlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:user-agent:in-reply-to :references:message-id:mime-version:content-transfer-encoding; bh=inGHCOVFKy3yUBazOjYZQZ1tO4aNBAzNZoiejyVr4LQ=; b=TluStN8+e7kAzukXrluKeMOkAY5VqlX6CsK8LAZZv137TZ50p+4dhcSOqJpQZlYUZ6 F42Y5YoASMVq4h2pBdGVcNwE7BW2gWSycKJcu5wRGxPAgHDdM1J57vE4K28yfNQqbmSX sd6kLjUH5J4lRTfHTxP8AtR2tFlUr/n8Wy2DgRA8Zy5o3A7QTCnxp6BD+Mc9nTDFq11l CIlubNNE8VRNR+mrXW2+MGtOvNJAR7FQeiECs/QEap1K2QGSbtYgtlZ5qMeLCE/EZfgh 6lWP2e0j01WdQZ9REI0Nty3LGSFPVJaXIyVDdVak7HsjbH6Mp94guEfm4qjujkEWbL+u nzRA== X-Gm-Message-State: AOAM532U5ciM+AO5uX0aOyxDcSKSd42zGwKOeQRfZZgGSL/Iu+4O+JGa STsY3LDgm7Gw1I8lvrM3YnGV1lb0KzY= X-Google-Smtp-Source: ABdhPJzCC07AaqU5l06bZJ2z9Ozxy0IdSUrjuUhTlLWyJbOIgpg/Ssx4zF6b2aHgX+F/LqXPpZGVxw== X-Received: by 2002:a5d:6488:: with SMTP id o8mr20909896wri.576.1641486047126; Thu, 06 Jan 2022 08:20:47 -0800 (PST) Received: from [127.0.0.1] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.gmail.com with ESMTPSA id t15sm2397955wrz.82.2022.01.06.08.20.46 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Jan 2022 08:20:46 -0800 (PST) Date: Thu, 06 Jan 2022 16:20:41 +0000 To: internals@lists.php.net User-Agent: K-9 Mail for Android In-Reply-To: <5a99809d-afda-546c-5a11-a4f0f821aa37@korulczyk.pl> References: <1641335738.195767637@f174.i.mail.ru> <5a4aebf8-e592-4517-8930-d18b112ef1fd@www.fastmail.com> <5a99809d-afda-546c-5a11-a4f0f821aa37@korulczyk.pl> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC: Trait expects interface From: rowan.collins@gmail.com (Rowan Tommins) On 6 January 2022 15:21:28 GMT, Robert Korulczyk wr= ote: > It should also make it easier for SCA tools to understand=20 >the code since they no longer need to know the whole project to understan= d that method from trait is implementation of method from interface (which = is=20 >really tricky right now since it depends on context - trait can at the sa= me implement and not implement the interface, because it depends on class= =20 >where it is used)=2E Your other points make sense, but I don't think this one does - there are = no implicit interfaces in PHP*, so all any tool cares about is: 1) Does the class declaration say that it implements an interface? 2) Does it actually contain the methods needed to do so, through any combi= nation of direct implementation, inheritance, and trait usage? Knowing that a particular trait *could be* used to implement a particular = interface without further code doesn't really tell the tool anything - it s= till has to resolve the list of methods on the class itself, and test those= against the "implements" clause=2E This is particularly true if the class = uses the "as" and "insteadOf" clauses when including the trait, which nulli= fy any promises the trait could make=2E * other than "Stringable", whose purpose and implementation continue to ba= ffle me Regards, --=20 Rowan Tommins [IMSoP]