Re: [PHP-DEV] Changing default assertion mode to throw exceptions

This is only part of a thread. view whole thread
  111126
July 22, 2020 15:07 nikita.ppv@gmail.com (Nikita Popov)
On Wed, Jul 22, 2020 at 5:05 PM Gabriel Caruso <carusogabriel34@gmail.com>
wrote:

> On Mon, 13 Jul 2020 at 19:37, Levi Morrison <levim@php.net> 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