Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111268 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 40671 invoked from network); 30 Jul 2020 17:00:54 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Jul 2020 17:00:54 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B1B6418054C for ; Thu, 30 Jul 2020 08:57:21 -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,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (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, 30 Jul 2020 08:57:21 -0700 (PDT) Received: by mail-io1-f43.google.com with SMTP id l1so28699497ioh.5 for ; Thu, 30 Jul 2020 08:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=E+oobTE0Oy77BQlPigVfA0GDWTAHGWkADTqr4dLfC5g=; b=GgxuROxs1FZuT3poQTPcMxC9exsv2V0zLFBtx/NK2r1hcMl3FZxqHsJUonW1HRETKp Sg7hLTfi/TuknrCV2lGI+/47usKHxaCj+3P1WcItilmdVu3ECJ6IUkqSCF+BZjzV4VgS 6E8iypjxpPbZ4C/Ue2X+qj2m1S/6VW1Dyyry68IsxHNJPKQhmdBF89qIBBqQfwORqxfb TeSWyLIsJxIM26d45FqzWi/yiVfGCuWyX+vZaqna8sdn8tAQsOn64vv8u4jDGeH4Sz4C +p5tDIG2PzvFNrUuYzjLTWCZEOF6rkNgaIQQar0iGQlQK29S0IUKZBxquXSMg0VF+2ra yD6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=E+oobTE0Oy77BQlPigVfA0GDWTAHGWkADTqr4dLfC5g=; b=H2/MSZ68pFtyTKQXDPrNFTnzBNKpabsh920rZvEEzlR0fYDnvJc0g4weRl6VgtvCEs ugb5oKifmdtr+WSaYmb4GHHpkdEGcWcvkkRAugkoUQNIffJ78x0kQRuC5MLI+6E1+622 GZduczYmWnoeSplNpclbT6D0qSwupHOhAqZSwsw4et5V3+579PMFUcT/MOfQ6eryyjq3 57U63NVlf99ike45x3ckIY07AVqtvDRqRXYrSvsdmQFGk6yJbapySzmiMQVbhYwYuHZY JZexRxlGTSl9BAlJmcZkZtlpFl+QhMzpyr8nnDUjepxwPPP4BmQmKVcX8o12GbKVBP2D UuNA== X-Gm-Message-State: AOAM530n2YHtB8k1ZgmJkA43ZpjxiFzQCSE2Vi4yTJWZL3IbV7kVD7Yf xbCIxYU6xSbVZsi4+UJaVkyG5d0/8+GKF3YL6cZHYQ== X-Google-Smtp-Source: ABdhPJypx9+tBDaJVxUIz4mYxpA8vzPGyvIVOjeRTVZG4ihBokP7UPsh6INjz0PA/KnAwqGETgMXCKiFJRmFk/S0Iso= X-Received: by 2002:a05:6638:2164:: with SMTP id p4mr3999339jak.57.1596124638051; Thu, 30 Jul 2020 08:57:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 30 Jul 2020 16:57:06 +0100 Message-ID: To: PHP Developers Mailing List Content-Type: multipart/alternative; boundary="00000000000011811005abaaba87" Subject: Re: [PHP-DEV] [RFC] [Discussion] Shorter Attribute Syntax Change From: rowan.collins@gmail.com (Rowan Tommins) --00000000000011811005abaaba87 Content-Type: text/plain; charset="UTF-8" On Thu, 30 Jul 2020 at 14:28, Joe Ferguson wrote: > ... I'm still here wanting us to talk about the > impact of @@ on static analysis tools. Apparently, internals doesn't care > about these projects. > I don't think that's a reasonable summary of this thread at all. I've seen three main types of response: 1) "I haven't followed the discussion about PHPCS, please could you summarise the problem." 2) "I don't understand why tools running on PHP 7.x need to parse PHP 8.x syntax." 3) "I think #[] will cause as many problems for such tools as @@, just in different places." Maybe they weren't always as polite or succinct as that, but not agreeing with you is not the same as not caring. As far as I can make out, attributes that appear entirely on a single line with no other text are trivial to ignore in any parser whatever the syntax. That trivial case is slightly more trivial with #[] because a PHP 7 parser will treat it as a line comment; but add a rule to your parser to also treat "@@" as a line comment, and you're done. The problems come when you have a) an attribute definition spanning multiple lines, and/or b) an attribute definition inline with other code. As soon as you have that, you have no choice but to parse the code entirely according to the grammar of PHP 8, not as "PHP 7 with some warts". If detecting the end of annotation tokens is really that difficult, would it suffice to make the () mandatory (i.e. @@Deprecated() rather than @@Deprecated)? The rules for what could appear between @@ and ( are pretty simple, and finding the correct ending ) should be pretty much the same effort as finding the correct ending ], since both can occur in matching pairs inside the argument list. Regards, -- Rowan Tommins [IMSoP] --00000000000011811005abaaba87--