note 124947 added to language.oop5.static
| From: | fakhar_anwar123 at hotmail dot com | Date: | Sun, 26 Apr 2020 11:21:10 +0000 |
| Subject: | note 124947 added to language.oop5.static | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-214538@lists.php.net to get a copy of this message | ||
Asnwer selcted as correct solves problem. There is a valid use case (Design Pattern) where class
with static member function needs to call non-static member function and before that this static
members should also instantiate singleton using constructor a constructor.
**Case:**
For example, I am implementing Swoole HTTP Request event providing it a call-back as a Class with
static member. Static Member does two things; it creates Singleton Object of the class by doing
initialization in class constructor, and second this static members does is to call a non-static
method 'run()' to handle Request (by bridging with Phalcon). Hence, static class without
constructor and non-static call will not work for me.
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.195 (proxied: 58.65.159.186)
----
Manual Page -- http://php.net/manual/en/language.oop5.static.php
Edit -- https://master.php.net/note/edit/124947
Del: integrated -- https://master.php.net/note/delete/124947/integrated
Del: useless -- https://master.php.net/note/delete/124947/useless
Del: bad code -- https://master.php.net/note/delete/124947/bad+code
Del: spam -- https://master.php.net/note/delete/124947/spam
Del: non-english -- https://master.php.net/note/delete/124947/non-english
Del: in docs -- https://master.php.net/note/delete/124947/in+docs
Del: other reasons-- https://master.php.net/note/delete/124947
Reject -- https://master.php.net/note/reject/124947
Search -- https://master.php.net/manage/user-notes.php