On 10/24/2016 7:10 PM, David Rodrigues wrote:
> Hello, folks.
> 
> I'm thinking about a debug function to allow us to create "zero cost
> declarations" in production code, as assert() does.
> 
> From what I understand, if I have something like assert(method()),
> method() will not be called in production, only in development.
> 
> This behaviour is great because we can help the PHPUnit, for instance,
> to capture messages in specific places to check if some process have
> generated the correct value without test it alone.
> 
> For instance:
> 
> // On test()'ed method:
> debug(TestStack::put($varValue));
> 
> // On test method:
> test();
> static::assertSame(123, TestStack::pop());
> 
> How it should be a debug code, should be important that it not be
> generated and executed in production.
> 
> Could I use assert() to do that, in all case? Then I could consider it
> as "already implemented".
> 
> Bye!
> 

You can already use assert in exactly this manner.

-- 
Richard "Fleshgrinder" Fussenegger

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to