Re: [PHP-DEV] Strict typing and callback vs declare()

2015-02-26 Thread Pierre Joye
On Thu, Feb 26, 2015 at 2:10 AM, Dmitry Stogov wrote: > Hi Anthony, > > What do you think about using a user level callback for strict type checks > instead of declare(). It won't allow changing behavior per file, but this > has its own cons and pros. > > set_strict_type_checker(function ($class_

Re: [PHP-DEV] Strict typing and callback vs declare()

2015-02-26 Thread Lester Caine
On 26/02/15 11:34, Benjamin Eberlei wrote: >> You 'll have to think about each file anyway. To add or not to add >> > declare(strict_types=1). >> > > Yes, but It has only exactly one ruleset to keep in mind. With your > approach the ruleset space is infinite. Much more complex. Currently the rule

Re: [PHP-DEV] Strict typing and callback vs declare()

2015-02-26 Thread Dmitry Stogov
On Thu, Feb 26, 2015 at 2:34 PM, Benjamin Eberlei wrote: > > > On Thu, Feb 26, 2015 at 12:24 PM, Dmitry Stogov wrote: > >> >> >> On Thu, Feb 26, 2015 at 2:09 PM, Benjamin Eberlei >> wrote: >> >>> >>> >>> On Thu, Feb 26, 2015 at 11:56 AM, Dmitry Stogov wrote: >>> On Thu, Feb 26,

Re: [PHP-DEV] Strict typing and callback vs declare()

2015-02-26 Thread Benjamin Eberlei
On Thu, Feb 26, 2015 at 12:24 PM, Dmitry Stogov wrote: > > > On Thu, Feb 26, 2015 at 2:09 PM, Benjamin Eberlei > wrote: > >> >> >> On Thu, Feb 26, 2015 at 11:56 AM, Dmitry Stogov wrote: >> >>> >>> >>> On Thu, Feb 26, 2015 at 1:34 PM, Benjamin Eberlei >>> wrote: >>> On Thu, Feb 2

Re: [PHP-DEV] Strict typing and callback vs declare()

2015-02-26 Thread Dmitry Stogov
On Thu, Feb 26, 2015 at 2:09 PM, Benjamin Eberlei wrote: > > > On Thu, Feb 26, 2015 at 11:56 AM, Dmitry Stogov wrote: > >> >> >> On Thu, Feb 26, 2015 at 1:34 PM, Benjamin Eberlei >> wrote: >> >>> >>> >>> On Thu, Feb 26, 2015 at 11:10 AM, Dmitry Stogov wrote: >>> Hi Anthony, What

Re: [PHP-DEV] Strict typing and callback vs declare()

2015-02-26 Thread Dmitry Stogov
On Thu, Feb 26, 2015 at 1:43 PM, Joe Watkins wrote: > > The implementation should be simpler and more efficient than using > declare(). > > This can't really be correct, if a call to > > function mine(int $one, double $two) { > > } > > results in three function calls then that's going to cost con

Re: [PHP-DEV] Strict typing and callback vs declare()

2015-02-26 Thread Benjamin Eberlei
On Thu, Feb 26, 2015 at 11:56 AM, Dmitry Stogov wrote: > > > On Thu, Feb 26, 2015 at 1:34 PM, Benjamin Eberlei > wrote: > >> >> >> On Thu, Feb 26, 2015 at 11:10 AM, Dmitry Stogov wrote: >> >>> Hi Anthony, >>> >>> What do you think about using a user level callback for strict type >>> checks >>>

Re: [PHP-DEV] Strict typing and callback vs declare()

2015-02-26 Thread Dmitry Stogov
On Thu, Feb 26, 2015 at 1:34 PM, Benjamin Eberlei wrote: > > > On Thu, Feb 26, 2015 at 11:10 AM, Dmitry Stogov wrote: > >> Hi Anthony, >> >> What do you think about using a user level callback for strict type checks >> instead of declare(). It won't allow changing behavior per file, but this >>

Re: [PHP-DEV] Strict typing and callback vs declare()

2015-02-26 Thread Joe Watkins
> The implementation should be simpler and more efficient than using declare(). This can't really be correct, if a call to function mine(int $one, double $two) { } results in three function calls then that's going to cost considerably. I don't like the idea of user function being called, but d

Re: [PHP-DEV] Strict typing and callback vs declare()

2015-02-26 Thread Benjamin Eberlei
On Thu, Feb 26, 2015 at 11:10 AM, Dmitry Stogov wrote: > Hi Anthony, > > What do you think about using a user level callback for strict type checks > instead of declare(). It won't allow changing behavior per file, but this > has its own cons and pros. > > set_strict_type_checker(function ($clas