Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121853 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 93343 invoked from network); 29 Nov 2023 08:36:41 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Nov 2023 08:36:41 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 34E31180031 for ; Wed, 29 Nov 2023 00:36:47 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from forward502b.mail.yandex.net (forward502b.mail.yandex.net [178.154.239.146]) (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 ; Wed, 29 Nov 2023 00:36:46 -0800 (PST) Received: from mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:25a5:0:640:d0a8:0]) by forward502b.mail.yandex.net (Yandex) with ESMTP id 31F295EF12 for ; Wed, 29 Nov 2023 11:36:36 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id ZaQ4LnTxPmI0-9aooOsjm; Wed, 29 Nov 2023 11:36:35 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=php.watch; s=mail; t=1701246995; bh=KOm+qBYMQf+cwfPBsPPOeM2KWXmfjmfHiG1XS0PRIXE=; h=To:Subject:Message-ID:References:Date:From:In-Reply-To:Cc; b=G2giD4RAUETLADd76ah1fZaPY1mDSLPeJ2rUz63be+1HPYoJMUlW/NslcO6tdf7iW QPYfqpUTr/cAcMYRgLzQVEY+9FAf4TafOOUGZx6W4vE35ctv/rFsuhxMsA6GCckTqp esnsExS5sBB2pi9vEwaSWtANIvXr3TTohKeGu8Bk= Authentication-Results: mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net; dkim=pass header.i=@php.watch Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-50bc57d81f4so417020e87.2 for ; Wed, 29 Nov 2023 00:36:35 -0800 (PST) X-Gm-Message-State: AOJu0YwN9PZJvXIXsuFLbcFIz02ESuR82MrAwa0ZffC2ZKHQEg/mZpjn 2YVkFgijulqXWsnsGzYwebcUz7SyVpyCGhId4wg= X-Google-Smtp-Source: AGHT+IEf/z1/iMbRPk5kCmQ/J1UV/MtZk/N5tSkEpiiqc4MT9mQd/PtaWNmAip3SUF25n5lLnyLE4PdZ127Jo00GApQ= X-Received: by 2002:a05:6512:144:b0:50b:ad92:24ed with SMTP id m4-20020a056512014400b0050bad9224edmr6850426lfo.2.1701246995325; Wed, 29 Nov 2023 00:36:35 -0800 (PST) MIME-Version: 1.0 References: <6566989F.7010305@adviesenzo.nl> <34dada8e-7f2a-4d94-b7df-d9d3c7b2f3ce@app.fastmail.com> In-Reply-To: Date: Wed, 29 Nov 2023 15:36:07 +0700 X-Gmail-Original-Message-ID: Message-ID: To: Robert Landers Cc: Stephen Reay , php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] What is the prevailing sentiment about extract() and compact() ? From: ayesh@php.watch (Ayesh Karunaratne) > > try { > // do stuff > } catch(Throwable $exception) { > $this->logger->error("failed to do stuff", compact('exception')); > throw $exception; > } > I wonder why not just create an array with the key... ```php try { // do stuff } catch(Throwable $exception) { $this->logger->error("failed to do stuff", ['exception' => $exception])); throw $exception; } ``` It's a few more characters of course, but I would pick the readability and simplicity over the potential typos (which the IDE should point out) and a few key presses it saves.I