Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111126 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 32023 invoked from network); 22 Jul 2020 16:13:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Jul 2020 16:13:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2B15D1804F2 for ; Wed, 22 Jul 2020 08:08:17 -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,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 22 Jul 2020 08:08:16 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id h22so2844431lji.9 for ; Wed, 22 Jul 2020 08:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kUp//pIrQKM+2xfHp+XYM7yFwOKTs9RPvqtDLydJsDc=; b=XJgu69W0c26fkVd1uRJ1z4cmuHolvu4gOCtHqsDK2z5xUZe5aRQh8fnTNiz0qnA7O3 UbR5asMbcY4W1YwOeWdq+vNZX44WdBUeU1IOTAyv58z104+jVWewEkdncQh1gNKwkwRw Hg8YOa4XHST1GneGV++o0ttPvq1eGKiInWd4+E+Erz67XWyKy9JJKs7brot0XF9ILkxP 4A+YWhLYHYYSbhf3WZAIYa0MrW5ataqMA6rbwxG0BJvEz8bSOR3GUc7+Lyicq2J/fWl4 fh7fhtlDhsZL5hZ1a0T2Yh6AWiPGBMdccOBx21PxxWEt1xggiQx266uia+OOC9UVUncI sfYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kUp//pIrQKM+2xfHp+XYM7yFwOKTs9RPvqtDLydJsDc=; b=bQR3ByRDLM0u4feNud93giX1Vcw+6kfQCNj1EeIA0JvAAfjKDtoI6yBcmVXdHUCV0g 1s1uJTZ3Gs50ZvqM9vsSCJo3HWzKBgPAi7bLrdmfOXGqf2eMYOFJ3fMUEGVmmnXhdlga 1FCtEZyOtKzLFOJveeTp0pqAHRhy8A6PkDV/dWAwpEbNlNlxJqe+FphRsVYYcuU8aKtL PyuJ0zZNFVAb3LCC95Cbm1kJfA2u3xx8ysERPuh3EwXO7dTjr2z9n2yf+xVC9jAiSiqJ 8ThN5e/SR+OVnzKG74Y0t/gv8OyMRrZxHfjM0kRE/zwCaFcjPY67YddroxPmZSd78oR3 8R+Q== X-Gm-Message-State: AOAM531VG1U/mCIytU+zs2szQbj6F6rU9rKv1wOtoaTZEnZ4bEttPpPT dq1SCcJYOgTdnxy45O1uBVblU6jOyDvfL+mWq7o= X-Google-Smtp-Source: ABdhPJwK/fzUizmpdUFjGO6+b9SuSgMZJlY8+LrhN63ibTex5/c92OilMOFrfYr2GfoCWCfXFrgSRqubyumcqDTHFkY= X-Received: by 2002:a2e:8199:: with SMTP id e25mr14135535ljg.307.1595430491644; Wed, 22 Jul 2020 08:08:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 22 Jul 2020 17:07:55 +0200 Message-ID: To: Gabriel Caruso Cc: Levi Morrison , internals Content-Type: multipart/alternative; boundary="000000000000b7e8cc05ab091b6f" Subject: Re: [PHP-DEV] Changing default assertion mode to throw exceptions From: nikita.ppv@gmail.com (Nikita Popov) --000000000000b7e8cc05ab091b6f Content-Type: text/plain; charset="UTF-8" On Wed, Jul 22, 2020 at 5:05 PM Gabriel Caruso wrote: > On Mon, 13 Jul 2020 at 19:37, Levi Morrison wrote: > > > Hello everyone, > > > > I'd like to change the default mode of assertion failures to throw. > > The current default is to warn. In my opinion this is a bad strategy: > > the engine asserted that something that is expected to be true is not, > > so executing further is a bad idea. This leaves throwing or bailing > > out. I think throwing an exception is better than bailing out, so > > that's what I propose. > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: https://www.php.net/unsub.php > > > Hello Levi > > +1 on this one, I use assertions on my local development, and we also have > that > on `doctrine/coding-standard` ( > https://github.com/doctrine/coding-standard/pull/47). > > I think throwing an exception is indeed a better way to make the most out > of it. > I'm also +1 on this change. Throwing an AssertionError is clearly the better default experience, and changing back to the previous behavior is super simple. Nikita --000000000000b7e8cc05ab091b6f--