Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108414 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 28738 invoked from network); 6 Feb 2020 15:42:01 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Feb 2020 15:42:01 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E2180180210 for ; Thu, 6 Feb 2020 05:54:38 -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=-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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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 Feb 2020 05:54:38 -0800 (PST) Received: by mail-lj1-f171.google.com with SMTP id a13so6169639ljm.10 for ; Thu, 06 Feb 2020 05:54:38 -0800 (PST) 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 :cc; bh=bhU4GFbyTtuzRMuW/CBenYq2CUfl2zJhEwcVZNZyPJg=; b=ACc9GTv91LlttAxmBOvXq/Uv4Q4Uss7d0s128yqaWTaoM0CKL1X8rMv/BFU27UdiV9 kU1FE4353Tpd09xOW/dCWZmv23Ay+xEFpIpdcTLllD1InM+Qw34jE0/BXl15/rkQJYFE E89thT7vFWpSFO54McomCxUWABJDXsMSOHnawaWLjsMr7YUnxC9LGr7O4y8PzqFQ0ZJj swRZgXr2R7rkjMRb7P6VCTbTnMIUD/XE5Um8ViTZgdnP5sxAaDAwDBFST9r2RdsIzY9g 3vsubgdVTixRJ8+qtjSa330zR56LWRYKNmy0uuIggLomteSm541GFr+gxvs+ghtQA2tk UmZA== 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:cc; bh=bhU4GFbyTtuzRMuW/CBenYq2CUfl2zJhEwcVZNZyPJg=; b=J84JDcoOyMDDGPXJtdXbKulDaWCYnK9cuIvUpuKT2yP+Ipr0GGwM4KAaVvLVzsUEV7 hTEhSPVsA7vK4Yq8ou8Mc6oUhnlff+A4Yc4bs2ZFvMCwu1xtb0Mkpum2uc8GPqWBgAPF Wxrfowy2aaHLu/ut6tOrFauwQQLQIRjQthr8Zwck4LMOfWBqFEB0QZh7FBXuaR+O2buY 1YncaAOVsXAvVVD53YjIvGa/vvl6FC1Pfgkh/LOiW0epxj3dROsY/8ODnfmmya7b7feH L0MOlx9RyIZQ4PFOsT3U81rjPMvIAIoPXERjel9kSpxLXVtPnBIWOUVw5F0mKMdEAO9v 9/pQ== X-Gm-Message-State: APjAAAVszJjWMpRueo/L6OHiFky11fEpKvn2aQOOVxzC5pXYl9mrSbLc /iRmkS8V/d6DejLUSWX+GSfItMez9wc7+ijeOxc= X-Google-Smtp-Source: APXvYqwjChdUDss2naL6oqcjSwdO7x+S7Ip1mAMdjbAnh5Lx/BG6drI9Kmc9XY+KVYyRyp+x+hlzgfdquXvO3EZain8= X-Received: by 2002:a2e:a408:: with SMTP id p8mr2189446ljn.145.1580997275369; Thu, 06 Feb 2020 05:54:35 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 6 Feb 2020 14:54:19 +0100 Message-ID: To: "Kingsquare.nl - Robin Speekenbrink" Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000fd462a059de89c80" Subject: Re: [PHP-DEV] Changing the generated name for anon classes From: nikita.ppv@gmail.com (Nikita Popov) --000000000000fd462a059de89c80 Content-Type: text/plain; charset="UTF-8" On Thu, Feb 6, 2020 at 2:45 PM Kingsquare.nl - Robin Speekenbrink < robin@kingsquare.nl> wrote: > Nikita, > > Just to chime in here: would it be wise to add an interface instead? (this > would automatically be added by the engine) so that the consumer of a > generated class could *really* know based on the interface that it's a > generated anonymous class instead of string type checking the classname? > Relying on some interface seems te be more future proof than just > changing the string to look up ;) > "Being an anonymous class" is not a contract, so it should not be represented by an interface. We already have a reliable way to detect anonymous classes via isAnonymous() in reflection -- people who do string matching probably do so specifically because they are dealing with class strings, which may require special post-processing for anonymous classes (in particular, dropping everything after the "\0"). Nikita > Op do 6 feb. 2020 om 12:21 schreef Nikita Popov : > >> Hi internals, >> >> Based on a suggestion by Nicolas Grekas, >> https://github.com/php/php-src/pull/5153 changes the generated name for >> anonymous classes to include the name of the parent class or first >> interface. So instead of just class@anonymous, you'll see something like >> EventHandler@anonymous in error messages, for example. >> >> There's a minor BC break here, for code checking for a "class@anonymous" >> prefix, which should be easy to rectify by checking for "@anonymous" >> instead. >> >> What do people think about doing this change? >> >> Regards, >> Nikita >> > --000000000000fd462a059de89c80--