Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123192 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 8E7341ADA76 for ; Tue, 23 Apr 2024 19:25:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1713900354; bh=tZnrxtsuPzns4+V6USF+d0Ejf5efkYLayIXCJZRt27o=; h=Date:From:Subject:To:References:In-Reply-To:From; b=DWLaNnIS4azMGbT/TlhsgUwA+ZqXsbTlqpTz+XB6TxaPQYzRN76RHS1pu2rzZepdE EwrMyg2H/lWcLReqWsA45iNhpVr7HrD4NOlao1fUhjBSP4z2f6M7vCzr+hLJbGdDWg 8aaUG8ZlP4KjXVJao98CxhyrgIh7UjWTOkqt99bOaibxcyln9dPH3fAwPybD3TMc3Y FlnNoa60+KLtfUyV6x8yKndw4WRXpGtG+AO/yFrBuud341N3DNa2BxVfgN9wiHKj8B sa9ymypuvcut74m/7I8zY1loElBHzwMjJUiZgu50mOqJ4YFbsihk2poETggpwosBik dDU4cvb40TbAg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 828F91801E5 for ; Tue, 23 Apr 2024 19:25:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-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,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 23 Apr 2024 19:25:50 +0000 (UTC) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4187c47405aso41341175e9.3 for ; Tue, 23 Apr 2024 12:25:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713900309; x=1714505109; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=zZgLhb9K0g14r6gULL2+QsOVnxHgCNX5WHX3zsaBzYA=; b=my3fJdskWz5nC3zflMLYIzpvvUO03IerEhyFOwpELmaFa6RTPVzZAlVwYP0kZMjmM7 iehPBNuxQk8i2oDaZ+Tt7L/3fcH2F7FsuXJxoN2UkqGHG5pZJcTP2vmEyV7rLTsdg7GN nxiqIHQAg6Jx6F5FTcI/WXvoArax7bes0rFTMd3lkf3cO+lWdgbAhN3ff7+qf59ucGhU oYFPCOHRXG3GLIpPd1gFT8cNfuIA8Fs0gytpvgGBf+yvDQ2fF8PP25rMOP2GJjIdNu+z zIrGAdFBXM71s5POVDdEAmemktx+AqqHdbAM+2VKriWbcwsgMdAazaKmq/CCrsuZBdA2 1EOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713900309; x=1714505109; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zZgLhb9K0g14r6gULL2+QsOVnxHgCNX5WHX3zsaBzYA=; b=Hubb882Sh0C4Pz1i6fQdocXRJ+gv2G8AHuFMO5WB7AW+5XhKw9k6/B7lmN9/JmCoZn eRsLhP10hZM+u5TsZNAZUC1RLoiqytRcieqIXL7MKmYxUpv1Eo3hDV+L1Vc1DTDDsx9P /4GRFzAQp8jjHWzP8J7l5KFSB0GAJfJKGSSTSWNY2NG6IUKFh/X6tnZz0Aefy63vgFRX Jzyxq9+IsQeJh7xqSkQruoirP1ULv6E9TGPchp0OakM/WaxGPsGE9mVmy113g9InI+Hj 0fySucuMQjFckghHcUbHurawJVU7wk3UgqY7luIAkOx0FZR9d/GcEx+fGTHOHWultNfu vz2g== X-Gm-Message-State: AOJu0Yz2ujavPa36/Nk2iCZfI12TqlFosaS4H/QVhA7CWTa6xG8PJXkx IcJX73L61hBsWKYsdFVXZwIOrQ1X1Wwuzawx516hdecE6G0TmVyYpIkk6w== X-Google-Smtp-Source: AGHT+IHKSxCTmM+uXnLgonXzVOvG/gci3HJDamPbHUaC/63dJNcl/WSdT7LuLJAkd8Ki/TBMePwviw== X-Received: by 2002:a05:600c:34cb:b0:419:d1d5:64b3 with SMTP id d11-20020a05600c34cb00b00419d1d564b3mr186904wmq.4.1713900308733; Tue, 23 Apr 2024 12:25:08 -0700 (PDT) Received: from [192.168.0.102] (178-117-134-240.access.telenet.be. [178.117.134.240]) by smtp.gmail.com with ESMTPSA id g9-20020a05600c310900b0041a9fc2a6b5sm4581802wmo.20.2024.04.23.12.25.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Apr 2024 12:25:08 -0700 (PDT) Message-ID: <1deaa188-3b2c-4527-b3c3-fd5df1ee1757@gmail.com> Date: Tue, 23 Apr 2024 21:23:13 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] [Discussion] Add openStream() to XML{Reader,Writer} To: internals@lists.php.net References: <056a0e77-688e-40a9-86de-0bf71548c933@app.fastmail.com> Content-Language: en-US In-Reply-To: <056a0e77-688e-40a9-86de-0bf71548c933@app.fastmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit From: dossche.niels@gmail.com (Niels Dossche) On 22/04/2024 21:53, Larry Garfield wrote: > On Mon, Apr 22, 2024, at 6:41 PM, Niels Dossche wrote: >> Hi internals >> >> I'm opening the discussion for my RFC "Add openStream() to XML{Reader,Writer}". >> RFC link: https://wiki.php.net/rfc/xmlreader_writer_streams >> >> Kind regards >> Niels > > This seems quite reasonable to me overall. My one question is regarding the writer version. Why is that not a static method, too? I would have expected that to be a "named constructor" just like the reader. > > --Larry Garfield Hi Larry XMLReader already had these static methods that act as named constructors, but XMLWriter has no named constructors at the moment. The XMLWriter::openMemory() and XMLWriter::openUri() functions are instance methods that must be called after doing "new XMLWriter". If these two existing functions were static methods instead, I would've made XMLWriter::openStream() static too. So IOW, for consistency I followed the model of the existing XMLWriter methods. While it is possible to do the magic trick that XMLReader uses to have the open methods on XMLWriter both static and non-static, this is quite hacky and was only done to XMLReader for BC reasons. Kind regards Niels