Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108588 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90513 invoked from network); 14 Feb 2020 20:15:54 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Feb 2020 20:15:54 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E08D11805A1 for ; Fri, 14 Feb 2020 10:30:33 -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-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) (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 ; Fri, 14 Feb 2020 10:30:33 -0800 (PST) Received: by mail-il1-f180.google.com with SMTP id t17so8815928ilm.13 for ; Fri, 14 Feb 2020 10:30:33 -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; bh=FxC+lu9GuP3Il3D3nGRwd6WVLgzYCN/nBpaBqtb9fyc=; b=NYmfPQAFXqB7eALpp862pJsZUM3nBL6bl6rV/3TY4dEAWuB6kVAfA4kXyL7Z8tWg3A jtbfkVPpIoPasTdY349gWwTjLmqWHnYW8oVsFjpr16+/hjpDmIQPbl5sdoBqEGitZPSY wq7fBCdsXWR4BS8h0q/rC+yQpzSOxBEhPMY8LoyGRWdEJC/JNDWSbkJYnnkaMcDxu5jW dDOC81HF/gNJfgMxy7DRyasjQmfMbDeZF3JHzumWCRiMC7Ar8DDNSemToNb1cGbF1oL3 90uUNUGoeUhhi/XfVzEoAf+j+lheC4Hfu3rdT2FqqYBqPdNZNIu5HIbd+rLQ6ic6tVP3 xymg== 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=FxC+lu9GuP3Il3D3nGRwd6WVLgzYCN/nBpaBqtb9fyc=; b=abHpo2Tt0Awgn7C4uoILk91GTo1Tu2z/YmVT1aGHBbCJVee+7j8DfJT6HbEY6L8KXH P9PsCLfDAidB3GQoQPmw/yinljQBf6cq73UMognzV1kLcVicoCqzECfmO4xiwT+MrHW0 uEBttCY5aoX3lnd21PGqxee5FYOK2mRGORsOViiM5GmyCKOvSUmuLjD11rtebrQrjyh3 zDUguqT30QzWL4XJjL6tS4jT0iHvTzm/+shdnS28g03AMsVs/TOUyRGHTBCbGoQvKRyh aQE/96czgih8tZtC/yuB+WMkQBTafXw1i4uqz5apSQCgVIJ4jcnuLj0KgPn6IsUtO8Pt 6Jsg== X-Gm-Message-State: APjAAAXW49Gsd10gZcKnA4s0yV3QPFOr6/OD7na27g7zanF1QSkuitgr r3kHhyKNXEO7E87x3Jw3f4iOlhYZNx26E+ieWOP9UA== X-Google-Smtp-Source: APXvYqz9JOZUL9aNtggOFFnRtfCsFIyk25W4AULQmbSFjFrFOqaez6Y2f00YOUPxFzUD3s2uGtCBfPdzJAwZyM5iRBY= X-Received: by 2002:a92:7606:: with SMTP id r6mr4126703ilc.120.1581705030270; Fri, 14 Feb 2020 10:30:30 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 14 Feb 2020 18:30:19 +0000 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="00000000000078027a059e8d66bf" Subject: Re: [PHP-DEV] [RFC] token_get_all() TOKEN_AS_OBJECT mode From: rowan.collins@gmail.com (Rowan Tommins) --00000000000078027a059e8d66bf Content-Type: text/plain; charset="UTF-8" On Fri, 14 Feb 2020 at 16:33, Nikita Popov wrote: > This constructor will initialize the corresponding properties. Now, the > behavior that would make most sense to me (if extension of the class is > allowed) is that MyPhpToken::getAll() is going to create the new tokens > based on "new MyPhpToken($id, $text, $line, $pos)". If we mark the > constructor final, then we could hardcode the construction behavior of the > base class without introducing any kind of weird rules, it would be just > the usual language semantics. > It's worth noting that this is how ext/simplexml works: the $class parameter of simplexml_load_string and simplexml_load_file must be the name of a class that inherits from SimpleXMLElement, and an instance of that class will be constructed for each element of the document. The constructor of SimpleXMLElement is final, so the internal initialisation logic doesn't have to actually call it, it can just initialise the private state directly. Regards, -- Rowan Tommins [IMSoP] --00000000000078027a059e8d66bf--