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

Reply via email to