Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120432 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55361 invoked from network); 29 May 2023 18:29:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 May 2023 18:29:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 06721180089 for ; Mon, 29 May 2023 11:29:54 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 29 May 2023 11:29:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1685384991; bh=LYxkDBTEoDBz/LlYYYho3L9MKrBSPOEYIp12WsYSNVI=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=YRXCI5kY468gA6AHbw7akjPI67PV3CHxxh2WB7nZ7ixm4sac0R8VFanAJHtbO3+oE MWlzG75rbQnjWg/STNAo8NpyYs48wr0nMjP62XhRbwglkqEbdu81WF7fmIm08nUn+X 75g0ZGUoDleEFImJipG2hsBPVb5ZKiBesaq9ORguyBWLjrBtdLZtqPrQrQDvLR+BIJ w4i1GjIHuheDol7iMkrCP7vv/YCWt02Dd3TT3M1iAxkF+fezi7RGjv4+2rgJj/6Sto gor5ZLYInG+IFgXOCBcl/KczZ6dUfQ/oy30d9Vbe4jyNfekK4nbaopsk+8CB7qoz2S FwlfgqoTh7oNQ== Message-ID: Date: Mon, 29 May 2023 20:29:40 +0200 MIME-Version: 1.0 To: internals@lists.php.net References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] RFC [Discussion]: Marking overridden methods (#[\Override]) From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 5/24/23 01:32, David Gebler wrote: > where you're coming from, however I'd refer back to my earlier comment: any > attributes added in the engine should provide a tangible benefit which > *can't be achieved in userland*. > I think this is a flawed premise: Any sort of analysis that PHP itself performs can also be performed in userland. IDEs and static analysis tools already do that. In fact the probably most-requested feature for PHP, Generics, is already implemented in existing userland static analyzers. Ilija already explained the benefit of having the proposed #[\Override] attribute in the language and that benefit applies to all kinds of code analysis that could technically be (and already is) performed in userland: It's part of the language and thus will *always* be available. If it's not always available, then folks who switch jobs or contribute to various open source projects that made a different choice with regard to analyzers will possibly: - Be unable to rely on a specific check that they found useful in the past, because the new SA tool doesn't implement it. - Be unable to rely on a specific check working as they learned it, because the new SA tool implements it differently. Basically these developers are not working with PHP, but with PHP+Psalm, PHP+PHPStan or PHP+Phan or whatever new tool might come around or that I forgot about and they will need to (re)learn all the functionality/differences if a future endeavour makes a different choice. By having it as part of the language by definition it would work identically for everyone and it can also be documented as part of the language. Developers will naturally come across it while learning PHP and it might be included in tutorials and so even if they never heard about the userland analyzers they might use it in their own code and reap the benefits. As the proposal is a compile time check, the mistake would also be immediately apparent just by loading the class (e.g. as part of *any* kind of test), it is not necessary to actually execute the method in question. So it should be sufficiently visible and usable even in codebases that are in a less-than-stellar state. In short: It should not be required to combine PHP with another tool to make it a usable language. >> I'll put the email back on unread and hope to >> be able to give a more expanded and nuanced reply later. >> > > Do this if you feel it's beneficial to the wider audience of internals to > better understand the motivation and justification for your proposal, but > ultimately it's not me you need to persuade so certainly don't worry about > getting into further nuances on my account. Yes, I believe it is beneficial for the wider audience, because folks might share your opinion, but not publicly speak up on the list. > suggestion of try it as a plugin for PHPStan first I prefer to spend my time where I believe I can make the biggest impact. That is PHP itself and not the analyzer that I personally prefer. Best regards Tim Düsterhus