disallow non-static method calls with self/static in PHP 7
| From: | Robert Stoll | Date: | Sun, 12 Oct 2014 08:37:37 +0000 |
| Subject: | disallow non-static method calls with self/static in PHP 7 | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-77896@lists.php.net to get a copy of this message | ||
Hey,
I just stumbled over a method call of a non-static method with self and was asking myself again, why
does PHP support
this behaviour. An example to outline what I am writing of:
class A{
function foo(){
self::bar();
}
function bar(){}
}
IMO it should not be allowed to call non-static methods with self or static. Sure, it is just a
small detail but for
someone who starts learning PHP it is an unnecessary supplement.
Maybe it is too drastic to disallow it in PHP 7 but yeah. I would like to know what you think about
it and if someone
has a good reason why it is allowed nowadays then please help me out.
Cheers,
Robert