Re: A modest proposal: __contructStatic

From: Date: Sun, 15 Feb 2015 23:09:41 +0000
Subject: Re: A modest proposal: __contructStatic
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-82765@lists.php.net to get a copy of this message
Patrick Schaaf wrote: > Am 15.02.2015 21:05 schrieb "Rowan Collins" <rowan.collins@gmail.com>: > >> // Now wherever in the code you want the default instance, just use this: >> $value = MyRedis::singleton()->get($key); > > You can surely see how this is more readable / easier to write: > > $value = MyRedir::get($key); It's possible to add static methods or use __callStatic() to delegate to the singleton's instance methods, though. -- Christoph M. Becker

« previous php.internals (#82765) next »