Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122834 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 774751A009C for ; Sun, 31 Mar 2024 10:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1711881098; bh=Etux9j/LDE5BQysUrfdwnePakalQgxhV6f+6Y3I/PXA=; h=Date:From:Subject:To:From; b=kBgr87JTq0w9zTd7/yzsNn41eT4IVW1CbHhub2qxJ8MWD8X2T5156jjU74dPzKgIY 3dgU/A8fUX/yvvsYkzWIchnCwRLJ6EFsNAnULrT0Cz1pQZbS1GOU/Ap40iw8tcpbTB mAcHxCY22Ed+PlOJ291yHMg7dSyS6L3NB1hy7GLdBH4ZgojB357W11Wc3Uz/xWAiBs EhYjprNRKpqVP5J9Yv2nBNYiXl7x39h9ZyRMSrJcaDN10ShTAbpNUPeDEdfc7ual0L xUs8hPfSOMeE4+QK/UNQD7rCDB/Nbk/p+H9LhDgkAFxTz8x/bjZ+pmvr89kjC5R6aV 0mhw6BgneqbKw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 908BE18006F for ; Sun, 31 Mar 2024 10:31:35 +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.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HTML_MESSAGE,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-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 ; Sun, 31 Mar 2024 10:31:35 +0000 (UTC) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4154614b47eso15513815e9.1 for ; Sun, 31 Mar 2024 03:31:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scriptfusion-com.20230601.gappssmtp.com; s=20230601; t=1711881067; x=1712485867; darn=lists.php.net; h=content-language:to:subject:from:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=gIzRGvFD3zrmpc7U6sdQDs/KKZC/iZKs+X5dP4+CBao=; b=HAywFYKE7Qj72eetOMK7sxUsInI/0jPAiarQ23N1did2jUZ8gSgb/uej+Aq7RgGUpo ZDQD2XzJ8T3kh1ZZYeAkHksF5JLHGRo7ftVIyF5Raoh6aMeEy2PzEJf/n8ZaNHj64GmE QvyxEiYNA5RBclrdm6whstryAiQiHSezXTv9x5iauMqZQUqWQK8WZOVKy3R+uyFcWqe8 An5aml2Ew/BdbgKkLMLy09oeGtOqL6cyloD2MUlGq82xEcqsHTz/0sDHzkifpOwNVuTx F7Sb2zn7c4qTJ/VVTwdyvwdSQQ6IaheQJN0Ilzf4Gyi29n8l3tbVsQfEEAU3kT79jeGz D/Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711881067; x=1712485867; h=content-language:to:subject:from:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gIzRGvFD3zrmpc7U6sdQDs/KKZC/iZKs+X5dP4+CBao=; b=nvJGQQw16sFzZ7RF0+NIMD3Abwfx62M0QmGYfkMiblah7Hgl6bAOH4lukxDKGBRZXN 4fEciPUJ22ipdrB1PB/zpzouJJF8DpZieDagfwut7KA0UzEA4Jiu/8QMRr9cJ7mhmABo En21jgGcAnSRhyoi1KVOy5eY3/v0r3VvHdRe6aEKShQloAcpqbTyLI0XN0JEbsgYvb4b H7h2eN9OHeK8d9GY4reBwb5PONSumLPLKyuPmqUcKCLae327GxaH2DeViLaP2eGiGfDQ EBUE6ia10+GUa+fYpq/Wk15xr1WfN51O+uEhd2kilntcoRD2zIuqryj1iR546rvwuO9/ StNQ== X-Gm-Message-State: AOJu0YyqjGxqO/J4eL7/EN6WnSnmNUS0VI3FZH/E3GYblhj3aSjIIyLC OKEhDriE3+rRacIUK364X5j2blNpsTT6DnljvQjzwDHXcQX4mIogB9Bn2u+cptXfGBLcygfyiiZ exU0= X-Google-Smtp-Source: AGHT+IE/5rVWtnnFrOM8Rwr/lt5pU+mG9i1a6YtC0kx9xzvklemnREYbvlAPQC2YB8PMktP1NwkIOQ== X-Received: by 2002:a05:600c:1e0c:b0:415:6456:c53f with SMTP id ay12-20020a05600c1e0c00b004156456c53fmr181213wmb.14.1711881067000; Sun, 31 Mar 2024 03:31:07 -0700 (PDT) Received: from ?IPV6:2a01:4b00:bf09:5101:40f2:340a:8080:2984? ([2a01:4b00:bf09:5101:40f2:340a:8080:2984]) by smtp.googlemail.com with ESMTPSA id p3-20020a05600c204300b004148090cf86sm13269315wmg.0.2024.03.31.03.31.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 31 Mar 2024 03:31:06 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------mUHB462X2WWQSC26XD0qAXps" Message-ID: <31f7de10-a2dd-489e-bc2f-66987dc832aa@scriptfusion.com> Date: Sun, 31 Mar 2024 11:31:05 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PHP-DEV] First time contributor (DateTime::setDate PR) To: internals@lists.php.net Content-Language: en-GB From: bilge@scriptfusion.com (Bilge) This is a multi-part message in MIME format. --------------mUHB462X2WWQSC26XD0qAXps Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Internals, I created my first php-src PR yesterday and anticipate I may have to write an RFC for it. I created a wiki account under the handle, "bilge", and the howto told me to request RFC karma here. About the PR: I sometimes find it would be useful to only update part of the date. The PR makes all parameters to DateTime(Immutable)::setDate optional in a backwards-compatible manner such that we can elect to update only the day, month, year or any combination of the three (thanks, in part, to named parameters). Without this modification, we must always specify all of the day, month and year parameters to change the date. To change just one part of the date, StackOverflow users have found various novel ways to work around setDate()'s current limitation, which generally involves calling format() twice, to isolate the specific date parts that should remain constant, and feeding them back into setDate() so they are effectively unchanged. All this leads me to wonder why we can't just call setDate() with only the parameters we want to change. This is particularly useful when generating a collection of dates that only differ in one aspect (year, day) and/or when working in a templating environment, such as Twig, where doing all the format calls results in multiple statements and logic overhead that we should like to avoid in templating contexts. Looking forward to hearing your thoughts. Cheers, Bilge --------------mUHB462X2WWQSC26XD0qAXps Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi Internals,

I created my first php-src PR yesterday and anticipate I may have to write an RFC for it. I created a wiki account under the handle, "bilge", and the howto told me to request RFC karma here.

About the PR: I sometimes find it would be useful to only update part of the date. The PR makes all parameters to DateTime(Immutable)::setDate optional in a backwards-compatible manner such that we can elect to update only the day, month, year or any combination of the three (thanks, in part, to named parameters). Without this modification, we must always specify all of the day, month and year parameters to change the date.

To change just one part of the date, StackOverflow users have found various novel ways to work around setDate()'s current limitation, which generally involves calling format() twice, to isolate the specific date parts that should remain constant, and feeding them back into setDate() so they are effectively unchanged. All this leads me to wonder why we can't just call setDate() with only the parameters we want to change. This is particularly useful when generating a collection of dates that only differ in one aspect (year, day) and/or when working in a templating environment, such as Twig, where doing all the format calls results in multiple statements and logic overhead that we should like to avoid in templating contexts.

Looking forward to hearing your thoughts.

Cheers,
Bilge

--------------mUHB462X2WWQSC26XD0qAXps--