Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118536 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 34487 invoked from network); 29 Aug 2022 09:19:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Aug 2022 09:19:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A526D1804AB for ; Mon, 29 Aug 2022 02:19:22 -0700 (PDT) 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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-vk1-f179.google.com (mail-vk1-f179.google.com [209.85.221.179]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 29 Aug 2022 02:19:22 -0700 (PDT) Received: by mail-vk1-f179.google.com with SMTP id j11so1482176vkl.12 for ; Mon, 29 Aug 2022 02:19:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc; bh=+I0RBwlTknD/y/+3+MycChvoBs4d6o65OPPmBoB9GPM=; b=h5bgrLSkw566KHqzkOHrUaXa4XxzN1ZGPjR1Zk/tLqxbwcOdqCbTsOHEmrDZbQKFnB GichKYuxIDcBo8d/MBFpxd9mppz6++a6C3qXY07pmzRG1DgVPwdHxdiN7CEip60TnBTS XJ21rfogr8jaEg3DchNRwBe08LncZoH9OrNKCFkKQhuOrZWZC4JlN2VoJF8M1IKO19WD 5hw+vd+kAStIzE5TZP41L/7Z+uw9pr+FcssZue069crykPrAoveGp1PjwE3cDFhVlwzl N+PxD/ALi5l5MNEUfB1Iv2TJ/v+GleknN5vbq1ECSxDroxByLv3L1zc3O0auMAAkZid4 8qjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc; bh=+I0RBwlTknD/y/+3+MycChvoBs4d6o65OPPmBoB9GPM=; b=IGjxDrJ5+3FFR55YvV5+biOEYyRTiUxHM96vi80k77htjeHzjuDrRMf0gODg9zU4Pv JH3GbxN6+wqzYUQ4ddyrZi3cg7aRZsi+3r/raK93eeRSGAc+0aWRqHhkz2XPbfyR3YPN jR7dGN42atFmK63aRJTa//Y2npG/cNMdSrwCbVtiN/p/wTr11dF+al+Lo7jICD7f4Xl3 BIw6cjn4eBKL8uU8VN0ZkGR7Xzztfi3TIFgE1hFBZascguryqdS1rYkMWSGwiSVZE0hl dmgZby6xYeEwqiFlaJLJnX13t7R9CYmIdUYyPbpmVC3GjtT4PXwMbp94NGnuWUDaiDxW uqwA== X-Gm-Message-State: ACgBeo2T5n3iNSPGMK89PhGl92Gfj/vz2wqHtXQzOjCKM7CFIegNFBqH DAZG2yx8tJAidwHdXR8zplbZLmzLKSITHAObfOI= X-Google-Smtp-Source: AA6agR63Dcpswlss+pcqK2wEl52Wjuat00AQlWcVvvfom7q8reYzB36kx+Ea6sf/57yWyKK0fd6Ov5OsfXu1HAc3zeg= X-Received: by 2002:a1f:258f:0:b0:377:500f:8e59 with SMTP id l137-20020a1f258f000000b00377500f8e59mr2681747vkl.11.1661764761732; Mon, 29 Aug 2022 02:19:21 -0700 (PDT) MIME-Version: 1.0 References: <8D53AD5B-7CFC-4820-9EE4-FEB365D327A8@woofle.net> In-Reply-To: Date: Mon, 29 Aug 2022 11:19:10 +0200 Message-ID: To: Deleu , PHP Internals List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC json_validate() - status: Under Discussion From: dev.juan.morales@gmail.com (juan carlos morales) El lun, 29 ago 2022 a las 11:06, Deleu () escribi=C3=B3= : > > Has the option of returning a Result object been discussed/considered? Ca= n it be an option? I imagine that if `json_validate(): JsonValidationResult= ` always returns a `JsonValidationResult` which contains a `public readonly= bool $valid` and a `public readonly ?string $error` it would be better tha= n both options on the table right now. The option of returning CLI-like res= ults means that we will need a `if (! json_validate())` to treat a valid JS= ON (really awkward) and the option of using `json_last_error()` relies on a= n internal state instead of an immutable structure. Effectively, what we ne= ed is to return a complex structure which can contain a boolean and a strin= g and that is a class/object. > Interesting, it was not considered. I still think BOOLEAN is my preferred choice, but can you provide an example about how the code would look like with your approach? Imagine you have the feature like in your suggestion ... how a developer would write the code?