Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123499 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 0D9711A009C for ; Mon, 3 Jun 2024 20:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1717447430; bh=CGF1f3c/hmN//Z5Yxeo2736iPBolf0zwSqM4NEu4KCo=; h=References:In-Reply-To:From:Date:Subject:To:From; b=Zsl2q+0l0i4GGL7Fa7m5efpHM77XvZURID9zfIj1ZVWwbz2yugQQIFkt2qpX0ClfJ GUTLMW2AR98PtcU2exZgUeO5MYIqiuONPVNP0Xu0sNrEZFWxRnQqp4lA7EQvAYfYV2 61nba397ePtLXCQxqjfYb+a8za/4+W1HUL8aVDBBJ6OHWWkpaJ2jowcmncr1pkuUqp tZ7VjKh86dgy1dOoQLklwGcOVSX/MtWWWGRKRgZvHJoT/ancEJOhNpq1BTPCqeEdKD u6aYLTvaOrJ8P2k+Sn4g9LM0gnwK8dqfAY/uUpM3tpD/dcXiJBkCpfd3MO8qvUGth2 8rOzsCdMpub8A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2F1B9180041 for ; Mon, 3 Jun 2024 20:43:48 +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: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) (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 ; Mon, 3 Jun 2024 20:43:47 +0000 (UTC) Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-6afbbc87967so9364186d6.2 for ; Mon, 03 Jun 2024 13:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717447363; x=1718052163; darn=lists.php.net; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CGF1f3c/hmN//Z5Yxeo2736iPBolf0zwSqM4NEu4KCo=; b=bigQ0uWad1TMxMeCRprZ0NxEG6583Jp05JKci/rIlT4cNXn/vEnuv9WKXnw6GSttul CTXyR6MX3sYoOXibVepOI5Q8TT2zQrYXawep/Uzpgh51NMOX2yhZ6domt126bytrD0VA ifvgNeSUp9ZAZm0guQaZtn03gGw54MIk6XXQOeL83gcq8JvfEaNuQ6gEcxMYZLXFp9NI QoasRnmmNi1t0mIERRdggi6JZm/HzRKqZ3o0USgwxQLa3n/50G9GAy/HP7pVwwUUowxM H7mylgets59dnT21vU7K/6raltdl6qHH/yiVCyBzezs/ZXcfXeLQnl9/FJJ/D18akakB IEAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717447363; x=1718052163; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CGF1f3c/hmN//Z5Yxeo2736iPBolf0zwSqM4NEu4KCo=; b=tkk9Eb+FxOWX2bRO/Ebr67DC5kaGn6UZ4u4ffmhEeBUFPu1/RQTI70RJCLU5EKJ4d9 SStBlTYoxb7X7YmarPEqRjSaZVbPJdR1gEWh7CfGj/ikR1bDfKWHx9HFiULUFYVexU6g SxSW7AoQZDBHrMiqhtYb07scTp031RdCVp13hT2wj+kKX2HkMRrEDNpnXpCDsVsdXv5E F7uz6LZq+x4kjB1k5jYb0xd+yFB4TLkxGjWEfrFatyLT6SkbMBumijDxQPmnmduXdnDo 1+5OkVANQxmlU6ByXG6VusOWyRknmW1FLewfsxaJPMAJAGhhhE4M50F6o2hYxLkD02Ln aQ7A== X-Gm-Message-State: AOJu0YyTzXruNRiusxJDEdFKGHrpek+rW9rDUct7aqNJ2GahcKYlCTf9 C0VOoIbum8+mhNfq7cKWRr8v739wyd4wUkd3YiVUJtzhKtt/g0k+kFCI0aFv8ghVNE6sPU8axpn kaal9tywmEEiOQlk7DX5wWkCI8fGwaqWW X-Google-Smtp-Source: AGHT+IG+8lpk+gwufssfWhwV6ZV5z9dp2UfB824BhoPZ8zPVXFm0jKAKkqvoaia+xrdSFCnFW2PP6BT/egKM/Q6IpzM= X-Received: by 2002:a05:6214:5344:b0:6ab:95ab:b00f with SMTP id 6a1803df08f44-6aecd6b40cemr103958366d6.32.1717447363000; Mon, 03 Jun 2024 13:42:43 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 3 Jun 2024 22:42:32 +0200 Message-ID: Subject: Re: [PHP-DEV] Fwd: Request for RFC Karma to Propose any_empty and all_empty Methods To: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi Elminson! On Mon, May 27, 2024 at 6:51=E2=80=AFPM Elminson De Oleo Baez wrote: > > I hope this message finds you well. I am writing to request RFC karma for= my wiki account in order to propose a new RFC. > > My proposal involves the introduction of two new methods, any_empty and a= ll_empty, for working with arrays. These methods are designed to provide bo= olean outputs indicating whether any of the elements in an array are empty,= or if all elements are empty, respectively. I believe these methods will b= e valuable additions to PHP=E2=80=99s array manipulation functionalities. > > Below is a brief overview of the proposed methods: > > any_empty(array $array): bool - This method will return true if any eleme= nt in the provided array is empty, and false otherwise. > all_empty(array $array): bool - This method will return true if all eleme= nts in the provided array are empty, and false otherwise. > These methods aim to simplify common array checks and improve code readab= ility and efficiency. > > I look forward to your approval and any guidance you can provide on movin= g forward with this proposal. I'm skeptical personally about these functions. empty() doesn't have the best semantics, and it's going to be rare that all your input types exactly follow these semantics. I think a deeper dive into common validation requirements might be good, to see whether they can be abstracted in some way. It's also worth noting that validation entails much more than just yielding true or false, e.g. coercion or graceful errors. Anyway, I granted you RFC karma. Good luck! Ilija