Re: RE: RFC: expectations/assertions

From: Date: Wed, 05 Feb 2014 22:21:47 +0000
Subject: Re: RE: RFC: expectations/assertions
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  Groups: php.internals 
Request: Send a blank email to internals+get-72302@lists.php.net to get a copy of this message
Hi all, Sorry for multiple posts. On Thu, Feb 6, 2014 at 6:17 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: > On Thu, Feb 6, 2014 at 6:10 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: > >> On Thu, Feb 6, 2014 at 5:49 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: >> >>> I agree, some thing like this is needed to call closure or pass >>> arguments to assert() then call. >> >> >> If we allow to pass arguments, it would be something like >> >> assert( >> function($arg1, $arg2) { >> return $arg1 > $arg2; >> }, >> 'Do not pass bad value', >> [$arg1, $arg2] >> ) >> > > Since we don't have 3 parameters signature for assert() now > > assert( > [$arg1, $arg2], > function($arg1, $arg2) { > return $arg1 > $arg2; > }, > 'Do not pass bad value' > ); > > is possible. Could we have this? > Or another function for callback? assert_callback(array $args, callable $callback [, string $description]); assert_callback( [$arg1, $arg2], function($arg1, $arg2) { return $arg1 > $arg2; } ); It seems this is cleanest among feasible options. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.internals (#72302) next »